addAiCommand method

void addAiCommand({
  1. required AiConfig config,
  2. required Client httpClient,
  3. AgentStyle style = const AgentStyle(),
  4. void onModeChanged(
    1. AgentMode mode
    )?,
  5. void onLanguageChanged(
    1. String? language
    )?,
})

Registers a live :ai command using config and httpClient.

Implementation

void addAiCommand({
  required AiConfig config,
  required http.Client httpClient,
  AgentStyle style = const AgentStyle(),
  void Function(AgentMode mode)? onModeChanged,
  void Function(String? language)? onLanguageChanged,
}) {
  register(
    AiCommand(
      config: config,
      provider: providerFor(config, httpClient),
      shield: CommandShield(),
      style: style,
      onModeChanged: onModeChanged,
      onLanguageChanged: onLanguageChanged,
    ),
  );
}