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`
}
type GatewayConfig struct {
Host string `json:"host" env:"PICOCLAW_GATEWAY_HOST"`
Port int `json:"port" env:"PICOCLAW_GATEWAY_PORT"`

View File

@@ -7,7 +7,6 @@ import (
json "encoding/json"
copilot "github.com/github/copilot-sdk/go"
)
type GitHubCopilotProvider struct {
@@ -37,9 +36,7 @@ func NewGitHubCopilotProvider(uri string, connectMode string, model string) *Git
defer client.Stop()
session, _ = client.CreateSession(context.Background(), &copilot.SessionConfig{
Model: model,
Hooks: &copilot.SessionHooks{
},
Hooks: &copilot.SessionHooks{},
})
}
@@ -67,24 +64,19 @@ 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),
})
return &LLMResponse{
FinishReason : "stop",
FinishReason: "stop",
Content: content,
}, nil
}
func (p *GitHubCopilotProvider) GetDefaultModel() string {
return "gpt-4.1"

View File

@@ -317,14 +317,13 @@ func CreateProvider(cfg *config.Config) (LLMProvider, error) {
case "github_copilot", "copilot":
if cfg.Providers.GitHubCopilot.APIBase != "" {
apiBase = cfg.Providers.GitHubCopilot.APIBase
}else {
} else {
apiBase = "localhost:4321" // no `http://` beacause grpc mode`
}
return NewGitHubCopilotProvider(apiBase, cfg.Providers.GitHubCopilot.ConnectMode, model), nil
}
}
// Fallback: detect provider from model name