feat(ai): make default assistant mode (Ask/Agent) configurable

This commit is contained in:
Abeautifulsnow authored and GitHub committed 2026-08-10 01:06:44 +08:00
1 parent 681c6f35c5
commit 0402fea37b
19 files changed
+202 -15

No files matched your search

+2 -1
View File
@@ -1,4 +1,5 @@
import type { AiConfig } from "@/stores/settingsStore";
import type { AiAssistantMode } from "@/types/ai";
import { uuid } from "@/lib/common/utils";
import type { ColumnInfo, ConnectionConfig, DatabaseType, ForeignKeyInfo, IndexInfo, QueryResult, QueryTab } from "@/types/database";
import type { PromptTemplate } from "@/types/promptTemplate";
@@ -36,7 +37,7 @@ function dbLabel(dbType: DatabaseType): string {
}
export type AiAction = "general" | "generate" | "explain" | "optimize" | "fix" | "convert" | "sampleData" | "query" | "exploreSchema" | "executeAndExplain";
export type AiAssistantMode = "ask" | "agent";
export type { AiAssistantMode } from "@/types/ai";
/** Actions shown in the Ask mode menu: SQL-producing, never auto-run. */
export const ASK_ACTIONS: AiAction[] = ["general", "generate", "explain", "optimize", "fix", "convert", "sampleData"];
@@ -163,6 +163,7 @@ describe("settings search", () => {
{ titleKey: "settings.exportRowLimitEnabled", category: "data", targetId: "data" },
{ titleKey: "settings.exportRowLimit", category: "data", targetId: "data" },
{ titleKey: "settings.queryExportKeysetOptimizationEnabled", category: "data", targetId: "data" },
{ titleKey: "ai.defaultAiMode", category: "ai", targetId: "ai" },
{ titleKey: "ai.maxAgentTurns", category: "ai", targetId: "ai" },
{ titleKey: "ai.maxRetriesGlobal", category: "ai", targetId: "ai" },
{ titleKey: "ai.globalInstructions", category: "ai", targetId: "ai" },
@@ -211,6 +211,7 @@ export const SETTINGS_SEARCH_DEFINITIONS: readonly SettingsSearchDefinition[] =
{ id: "sync-secrets-passphrase", category: "sync", titleKey: "settings.syncSecretsPassphrase", targetId: "sync", visible: desktopOnly },
{ id: "ai-config", category: "ai", titleKey: "ai.configList", targetId: "ai" },
{ id: "ai-prompts", category: "ai", titleKey: "ai.promptTemplates", descriptionKey: "ai.promptTemplatesDescription", targetId: "ai" },
{ id: "ai-default-mode", category: "ai", titleKey: "ai.defaultAiMode", descriptionKey: "ai.defaultAiModeDescription", targetId: "ai" },
{ id: "ai-agent-turn-limit", category: "ai", titleKey: "ai.maxAgentTurns", descriptionKey: "ai.maxAgentTurnsDescription", targetId: "ai" },
{ id: "ai-global-retries", category: "ai", titleKey: "ai.maxRetriesGlobal", descriptionKey: "ai.maxRetriesGlobalDescription", targetId: "ai" },
{ id: "ai-global-instructions", category: "ai", titleKey: "ai.globalInstructions", descriptionKey: "ai.globalInstructionsDescription", targetId: "ai" },