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
@@ -71,7 +71,7 @@ func ralphLoop(ctx context.Context, promptFile string, maxIterations int) error
|
||||
// Fresh session each iteration — context isolation is the point
|
||||
session, err := client.CreateSession(ctx, &copilot.SessionConfig{
|
||||
OnPermissionRequest: copilot.PermissionHandler.ApproveAll,
|
||||
Model: "gpt-5.1-codex-mini",
|
||||
Model: "gpt-5.3-codex",
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -80,7 +80,7 @@ func ralphLoop(ctx context.Context, promptFile string, maxIterations int) error
|
||||
_, err = session.SendAndWait(ctx, copilot.MessageOptions{
|
||||
Prompt: string(prompt),
|
||||
})
|
||||
session.Destroy()
|
||||
session.Disconnect()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -146,10 +146,10 @@ func ralphLoop(ctx context.Context, mode string, maxIterations int) error {
|
||||
fmt.Printf("\n=== Iteration %d/%d ===\n", i, maxIterations)
|
||||
|
||||
session, err := client.CreateSession(ctx, &copilot.SessionConfig{
|
||||
Model: "gpt-5.1-codex-mini",
|
||||
Model: "gpt-5.3-codex",
|
||||
WorkingDirectory: cwd,
|
||||
OnPermissionRequest: func(_ copilot.PermissionRequest, _ map[string]string) copilot.PermissionRequestResult {
|
||||
return copilot.PermissionRequestResult{Kind: "approved"}
|
||||
OnPermissionRequest: func(_ copilot.PermissionRequest, _ copilot.PermissionInvocation) (copilot.PermissionRequestResult, error) {
|
||||
return copilot.PermissionRequestResult{Kind: "approved"}, nil
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
@@ -157,16 +157,16 @@ func ralphLoop(ctx context.Context, mode string, maxIterations int) error {
|
||||
}
|
||||
|
||||
// Log tool usage for visibility
|
||||
session.On(func(event copilot.Event) {
|
||||
if toolExecution, ok := event.(copilot.ToolExecutionStartEvent); ok {
|
||||
fmt.Printf(" ⚙ %s\n", toolExecution.Data.ToolName)
|
||||
session.On(func(event copilot.SessionEvent) {
|
||||
if d, ok := event.Data.(*copilot.ToolExecutionStartData); ok {
|
||||
fmt.Printf(" ⚙ %s\n", d.ToolName)
|
||||
}
|
||||
})
|
||||
|
||||
_, err = session.SendAndWait(ctx, copilot.MessageOptions{
|
||||
Prompt: string(prompt),
|
||||
})
|
||||
session.Destroy()
|
||||
session.Disconnect()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user