mirror of
https://github.com/github/awesome-copilot.git
synced 2026-04-15 12:45:57 +00:00
docs: update go sdk examples (#1393)
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
66a60afe70
commit
aaf86f6055
@@ -103,7 +103,7 @@ func main() {
|
||||
cwd, _ := os.Getwd()
|
||||
session, err := client.CreateSession(ctx, &copilot.SessionConfig{
|
||||
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
|
||||
Model: "gpt-5",
|
||||
Model: "gpt-5.4",
|
||||
SystemMessage: &copilot.SystemMessageConfig{
|
||||
Content: fmt.Sprintf(`
|
||||
<context>
|
||||
@@ -123,19 +123,15 @@ The current working directory is: %s
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer session.Destroy()
|
||||
defer session.Disconnect()
|
||||
|
||||
// Set up event handling
|
||||
session.On(func(event copilot.SessionEvent) {
|
||||
switch event.Type {
|
||||
case "assistant.message":
|
||||
if event.Data.Content != nil {
|
||||
fmt.Printf("\n🤖 %s\n\n", *event.Data.Content)
|
||||
}
|
||||
case "tool.execution_start":
|
||||
if event.Data.ToolName != nil {
|
||||
fmt.Printf(" ⚙️ %s\n", *event.Data.ToolName)
|
||||
}
|
||||
switch d := event.Data.(type) {
|
||||
case *copilot.AssistantMessageData:
|
||||
fmt.Printf("\n🤖 %s\n\n", d.Content)
|
||||
case *copilot.ToolExecutionStartData:
|
||||
fmt.Printf(" ⚙️ %s\n", d.ToolName)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user