This commit is contained in:
Lixeer
2026-02-15 06:55:20 +08:00
parent ecbe31599e
commit 7a9659971d
3 changed files with 49 additions and 60 deletions

View File

@@ -179,8 +179,6 @@ type ProviderConfig struct {
ConnectMode string `json:"connect_mode,omitempty" env:"PICOCLAW_PROVIDERS_{{.Name}}_CONNECT_MODE"` //only for Github Copilot, `stdio` or `grpc` ConnectMode string `json:"connect_mode,omitempty" env:"PICOCLAW_PROVIDERS_{{.Name}}_CONNECT_MODE"` //only for Github Copilot, `stdio` or `grpc`
} }
type GatewayConfig struct { type GatewayConfig struct {
Host string `json:"host" env:"PICOCLAW_GATEWAY_HOST"` Host string `json:"host" env:"PICOCLAW_GATEWAY_HOST"`
Port int `json:"port" env:"PICOCLAW_GATEWAY_PORT"` Port int `json:"port" env:"PICOCLAW_GATEWAY_PORT"`

View File

@@ -7,7 +7,6 @@ import (
json "encoding/json" json "encoding/json"
copilot "github.com/github/copilot-sdk/go" copilot "github.com/github/copilot-sdk/go"
) )
type GitHubCopilotProvider struct { type GitHubCopilotProvider struct {
@@ -37,9 +36,7 @@ func NewGitHubCopilotProvider(uri string, connectMode string, model string) *Git
defer client.Stop() defer client.Stop()
session, _ = client.CreateSession(context.Background(), &copilot.SessionConfig{ session, _ = client.CreateSession(context.Background(), &copilot.SessionConfig{
Model: model, Model: model,
Hooks: &copilot.SessionHooks{ Hooks: &copilot.SessionHooks{},
},
}) })
} }
@@ -69,14 +66,10 @@ func (p *GitHubCopilotProvider) Chat(ctx context.Context, messages []Message, to
fullcontent, _ := json.Marshal(out) fullcontent, _ := json.Marshal(out)
content, _ := p.session.Send(ctx, copilot.MessageOptions{ content, _ := p.session.Send(ctx, copilot.MessageOptions{
Prompt: string(fullcontent), Prompt: string(fullcontent),
}) })
return &LLMResponse{ return &LLMResponse{
FinishReason: "stop", FinishReason: "stop",
Content: content, Content: content,
@@ -84,7 +77,6 @@ func (p *GitHubCopilotProvider) Chat(ctx context.Context, messages []Message, to
} }
func (p *GitHubCopilotProvider) GetDefaultModel() string { func (p *GitHubCopilotProvider) GetDefaultModel() string {
return "gpt-4.1" return "gpt-4.1"

View File

@@ -324,7 +324,6 @@ func CreateProvider(cfg *config.Config) (LLMProvider, error) {
} }
} }
// Fallback: detect provider from model name // Fallback: detect provider from model name