make fmt
This commit is contained in:
@@ -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"`
|
||||||
|
|||||||
@@ -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{},
|
||||||
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -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),
|
Prompt: string(fullcontent),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
return &LLMResponse{
|
return &LLMResponse{
|
||||||
FinishReason : "stop",
|
FinishReason: "stop",
|
||||||
Content: content,
|
Content: content,
|
||||||
}, nil
|
}, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (p *GitHubCopilotProvider) GetDefaultModel() string {
|
func (p *GitHubCopilotProvider) GetDefaultModel() string {
|
||||||
|
|
||||||
return "gpt-4.1"
|
return "gpt-4.1"
|
||||||
|
|||||||
@@ -317,14 +317,13 @@ func CreateProvider(cfg *config.Config) (LLMProvider, error) {
|
|||||||
case "github_copilot", "copilot":
|
case "github_copilot", "copilot":
|
||||||
if cfg.Providers.GitHubCopilot.APIBase != "" {
|
if cfg.Providers.GitHubCopilot.APIBase != "" {
|
||||||
apiBase = cfg.Providers.GitHubCopilot.APIBase
|
apiBase = cfg.Providers.GitHubCopilot.APIBase
|
||||||
}else {
|
} else {
|
||||||
apiBase = "localhost:4321" // no `http://` beacause grpc mode`
|
apiBase = "localhost:4321" // no `http://` beacause grpc mode`
|
||||||
}
|
}
|
||||||
return NewGitHubCopilotProvider(apiBase, cfg.Providers.GitHubCopilot.ConnectMode, model), nil
|
return NewGitHubCopilotProvider(apiBase, cfg.Providers.GitHubCopilot.ConnectMode, model), nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback: detect provider from model name
|
// Fallback: detect provider from model name
|
||||||
|
|||||||
Reference in New Issue
Block a user