(ctx context.Context, client *cloudquery_api.ClientWithResponses, teamName string, resumeConversation bool)
| 148 | } |
| 149 | |
| 150 | func aiCmd(ctx context.Context, client *cloudquery_api.ClientWithResponses, teamName string, resumeConversation bool) error { |
| 151 | ctx, cancel := signal.NotifyContext(ctx, os.Interrupt, syscall.SIGTERM) |
| 152 | defer cancel() |
| 153 | |
| 154 | errCh := make(chan error) |
| 155 | |
| 156 | go func() { |
| 157 | errCh <- aiCmdInner(ctx, client, teamName, resumeConversation) |
| 158 | }() |
| 159 | |
| 160 | select { |
| 161 | case err := <-errCh: |
| 162 | // Regardless of the error, the conversation ends here |
| 163 | api.EndConversation(context.Background(), client, teamName) |
| 164 | if err == nil { |
| 165 | fmt.Println("Goodbye! 👋") |
| 166 | } |
| 167 | return err |
| 168 | case <-ctx.Done(): |
| 169 | // End the conversation when context is cancelled (e.g., Ctrl+C) |
| 170 | api.EndConversation(context.Background(), client, teamName) |
| 171 | fmt.Println("\nGoodbye! 👋") |
| 172 | return nil |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | func aiCmdInner(ctx context.Context, client *cloudquery_api.ClientWithResponses, teamName string, resumeConversation bool) error { |
| 177 | aiMuted.Println(`Your conversation with the AI may be recorded for quality assurance purposes. If you prefer not to use AI-assisted setup, run cloudquery init --disable-ai.`) |
no test coverage detected