Remove premature defer client.Stop() in GitHub Copilot provider
This commit is contained in:
parent
214b201bfa
commit
3101c33cc7
1 changed files with 6 additions and 2 deletions
|
|
@ -33,11 +33,15 @@ func NewGitHubCopilotProvider(uri string, connectMode string, model string) (*Gi
|
||||||
if err := client.Start(context.Background()); err != nil {
|
if err := client.Start(context.Background()); err != nil {
|
||||||
return nil, fmt.Errorf("Can't connect to Github Copilot, https://github.com/github/copilot-sdk/blob/main/docs/getting-started.md#connecting-to-an-external-cli-server for details")
|
return nil, fmt.Errorf("Can't connect to Github Copilot, https://github.com/github/copilot-sdk/blob/main/docs/getting-started.md#connecting-to-an-external-cli-server for details")
|
||||||
}
|
}
|
||||||
defer client.Stop()
|
var err error
|
||||||
session, _ = client.CreateSession(context.Background(), &copilot.SessionConfig{
|
session, err = client.CreateSession(context.Background(), &copilot.SessionConfig{
|
||||||
Model: model,
|
Model: model,
|
||||||
Hooks: &copilot.SessionHooks{},
|
Hooks: &copilot.SessionHooks{},
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
client.Stop()
|
||||||
|
return nil, fmt.Errorf("failed to create Copilot session: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue