mirror of
https://github.com/github/awesome-copilot.git
synced 2026-04-15 20:55:55 +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
@@ -19,8 +19,8 @@ func main() {
|
||||
// Create session with a memorable ID
|
||||
session, err := client.CreateSession(ctx, &copilot.SessionConfig{
|
||||
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
|
||||
SessionID: "user-123-conversation",
|
||||
Model: "gpt-5",
|
||||
SessionID: "user-123-conversation",
|
||||
Model: "gpt-5.4",
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
@@ -32,9 +32,9 @@ func main() {
|
||||
}
|
||||
fmt.Printf("Session created: %s\n", session.SessionID)
|
||||
|
||||
// Destroy session but keep data on disk
|
||||
session.Destroy()
|
||||
fmt.Println("Session destroyed (state persisted)")
|
||||
// Disconnect session but keep data on disk
|
||||
session.Disconnect()
|
||||
fmt.Println("Session disconnected (state persisted)")
|
||||
|
||||
// Resume the previous session
|
||||
resumed, err := client.ResumeSession(ctx, "user-123-conversation", &copilot.ResumeSessionConfig{OnPermissionRequest: copilot.PermissionHandler.ApproveAll})
|
||||
@@ -49,7 +49,7 @@ func main() {
|
||||
}
|
||||
|
||||
// List sessions
|
||||
sessions, err := client.ListSessions(ctx)
|
||||
sessions, err := client.ListSessions(ctx, nil)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@@ -65,5 +65,5 @@ func main() {
|
||||
}
|
||||
fmt.Println("Session deleted")
|
||||
|
||||
resumed.Destroy()
|
||||
resumed.Disconnect()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user