MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / checkAIProviderAcknowledgment

Method checkAIProviderAcknowledgment

src/Client/ClientBase.cpp:3554–3584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3552}
3553
3554bool ClientBase::checkAIProviderAcknowledgment()
3555{
3556 // If API key came from environment and user hasn't acknowledged yet, ask for confirmation
3557 if (ai_inferred_from_env && !ai_provider_acknowledged && is_interactive)
3558 {
3559 // Clear any progress display
3560 if (need_render_progress && tty_buf)
3561 {
3562 std::unique_lock lock(tty_mutex);
3563 progress_indication.clearProgressOutput(*tty_buf, lock);
3564 }
3565
3566 const auto question = fmt::format(
3567 "AI SQL generation will use {} API key from environment variable.\n"
3568 "Do you want to continue? [y/N] ",
3569 ai_provider_name);
3570
3571 if (!ask(question, *std_in, *std_out))
3572 {
3573 // User declined
3574 error_stream << "AI query cancelled.\n";
3575 return false;
3576 }
3577
3578 // User accepted, remember for this session
3579 ai_provider_acknowledged = true;
3580 *std_out << '\n';
3581 }
3582
3583 return true;
3584}
3585#endif
3586
3587void ClientBase::addCommonOptions(OptionsDescription & options_description)

Callers

nothing calls this directly

Calls 3

askFunction · 0.85
clearProgressOutputMethod · 0.80
formatFunction · 0.50

Tested by

no test coverage detected