Commit Graph
90 Commits
Author SHA1 Message Date
Abeautifulsnow 99ded5c8bb fix(ai-agent): align table scrollbar themes 2026-08-18 10:52:01 +08:00
Guoyu Su 38a7815b72 feat(ai): add message copy actions 2026-08-15 00:28:12 +08:00
Lan-zk 7a01a440b8 feat(ai): add conversation history search 2026-08-13 16:04:11 +08:00
lewis c72b429899 feat(ai): add Qoder CLI provider 2026-08-11 21:33:15 +08:00
Abeautifulsnow 0402fea37b feat(ai): make default assistant mode (Ask/Agent) configurable 2026-08-10 01:06:44 +08:00
t8y2 bff03ed78a fix(ui): improve panel resize and sidebar borders 2026-08-05 14:23:03 +08:00
miracle bcafc4a474 fix(query): preserve structured backend errors 2026-08-02 16:37:46 +08:00
Abeautifulsnow b053adf175 fix(ai): preserve saved and manual models 2026-08-02 16:33:46 +08:00
二丫讲梵 61dc49ca4d fix(ai): preserve Dameng database and schema scopes 2026-08-02 09:01:22 +08:00
Abeautifulsnow f64d363abe feat(ai): export assistant analysis result as markdown 2026-07-31 21:17:57 +08:00
zhangyc e2ba75b102 feat(saved-sql): run queries in the current database 2026-07-31 01:57:39 +08:00
Guoyu Su d0a55b1b07 fix(sqlite): normalize database context routing 2026-07-30 03:12:02 +08:00
Coolomi 0a5fbb6f8c fix(ai): preserve Codex reasoning effort capabilities 2026-07-29 04:27:07 +08:00
Guoyu Su c7e7b7c9d9 feat(ai): unify model discovery and effort handling 2026-07-28 21:37:55 +08:00
Abeautifulsnow cb9d0f7cbf fix(ai): harden write SQL confirmation flow 2026-07-28 11:56:23 +08:00
Freedom 1cdbf4fa3d fix(desktop): unify UI colors onto theme tokens 2026-07-28 11:24:10 +08:00
Abeautifulsnow 122853d089 fix(ai): reset action when reselecting active mode 2026-07-27 12:33:06 +08:00
ooooooo ad2d52e3ca fix(editor): preserve container link references while streaming 2026-07-23 17:29:45 +08:00
zipg 590e9042e8 fix(ai): support Windows Claude Code MCP config 2026-07-23 12:51:11 +08:00
t8y2 e6224ec0b0 fix(ai): refresh model options after adding config 2026-07-22 23:09:54 +08:00
Abeautifulsnow 1fb3e2816b feat(ai): add custom prompt templates 2026-07-22 13:43:39 +08:00
t8y2 330d27d718 fix(redis): route AI commands to Redis console 2026-07-22 11:41:43 +08:00
Abeautifulsnow c417e54698 fix(ai): preserve last-used model during app session 2026-07-17 18:14:49 +08:00
Guoyu Su d3947d246c feat(ai): add Claude Code CLI provider 2026-07-17 01:17:06 +08:00
lexmin0412 dd3a2e30a4 feat(ai): support multiple configurations and models 2026-07-16 17:59:40 +08:00
Abeautifulsnow 7c43c03254 feat(ai): show reasoning character count when collapsed 2026-07-16 17:31:21 +08:00
vrustx 1c34b2b568 fix(connection): share connection group path map 2026-07-15 19:29:38 +08:00
t8y2 51da4cd0dd fix(ai): keep streaming response font size consistent 2026-07-15 16:56:52 +08:00
t8y2 c29ad9ba17 fix(ai): stabilize message hover layout 2026-07-15 16:42:33 +08:00
wuxiemian 1be66fb115 feat(safety): add production environment safeguards 2026-07-12 10:02:27 +08:00
Abeautifulsnow 088a4a081b fix(ai): preserve editor content for SQL actions 2026-07-11 08:55:51 +08:00
zipg e1d6d1224e feat(oracle): support explain plans 2026-07-10 17:55:03 +08:00
t8y2 5a666b1f48 fix(ai): improve assistant execution and MCP settings 2026-07-10 14:31:08 +08:00
gggaiitx 482f7421be feat(editor): send selected SQL to AI panel 2026-07-09 18:12:27 +08:00
Abeautifulsnow 1cfb39a7b0 fix(ai): restore global reasoning toggle accidentally reverted by d90847bb
fix(ai): restore global reasoning toggle accidentally reverted by d90847bb

Commit 09f9e446 replaced per-message expandedReasoning (Set<number>) with
a global reasoningExpanded boolean ref, defaulting to collapsed so all
messages share the same toggle state. This avoided the flip-flop where
reasoning auto-expanded during streaming and collapsed afterward.

Commit d90847bb (SQL file references) inadvertently reverted this when
resolving merge conflicts during its large template restructure.

Changes:
- Replace expandedReasoning (Set<number>) with reasoningExpanded (ref(false))
- Replace per-index toggleReasoning(i) with global toggleReasoning()
- Template uses reasoningExpanded instead of expandedReasoning.has(i) || msg.isThinking
@
2026-07-09 13:17:23 +08:00
lexmin0412 ac4b98c97c feat(ai): add general action mode 2026-07-08 19:31:19 +08:00
zipg 4d96bac5ff fix(ai): adjust history message editor width 2026-07-08 17:51:09 +08:00
zipg 3497df033f feat(grid): support searching filter columns 2026-07-07 16:19:29 +08:00
zipg d90847bbba feat(ai): support SQL library file references 2026-07-07 15:39:10 +08:00
Abeautifulsnow 09f9e44661 fix(ai): make reasoning expand/collapse consistent across messages
fix(ai): make reasoning expand/collapse consistent across messages

Replace per-message expandedReasoning Set with a global reasoningExpanded
boolean ref so all messages share the same toggle state. Default to collapsed.
This avoids the flip-flop where reasoning auto-expands during streaming and
collapses afterward, requiring repeated manual toggles.

- Replace expandedReasoning (Set<number>) with reasoningExpanded (boolean)
- Remove per-index toggleReasoning; use global flip instead
- Template uses reasoningExpanded instead of expandedReasoning.has(i) || msg.isThinking
@
2026-07-07 13:36:53 +08:00
Abeautifulsnow 8539011f25 feat(ai): split Ask/Agent action menus with task-oriented Agent actions
* feat(ai): add task-oriented Agent actions with per-action contract

Introduce three Agent-native actions — query, exploreSchema,
executeAndExplain — so Agent mode surfaces task-oriented operations
instead of reusing Ask's SQL-producing action set.

- ai.ts: extend AiAction with the new actions; add ASK_ACTIONS /
  AGENT_ACTIONS and defaultActionForMode / isValidActionForMode
  helpers; raise maxTokens for the explanatory task actions.
- aiSkills.ts: add skill definitions (zh/en) for the three actions.
- aiAgentPlan.ts: task actions no longer emit a misleading
  "unsupported_action" execute step; they execute via the
  execute_query tool events, not the legacy client-side path.
- agent_loop.rs: per-action task-contract rules in both the prompt
  augmentation and repair paths (query -> execute & answer from real
  data; exploreSchema -> list_tables/get_columns; executeAndExplain
  -> run current SQL & explain).
- i18n (en/zh-CN/zh-TW): new action labels, placeholders, a
  generateNoExec label for Agent mode, and a task-oriented agent
  modeHint.

es/it/ja/pt-BR have no `ai` section and fall back to `en`, matching
existing coverage.

* feat(ai): split Ask/Agent action menus with mode-aware defaults

Wire the new Agent task actions into the assistant UI so each mode
shows a distinct, intent-matching action set.

- actionButtons is now a computed returning Ask or Agent buttons
  based on assistantMode. Agent menu: query / exploreSchema /
  executeAndExplain / generate (labeled "生成但不执行" via
  generateNoExec). Ask menu is unchanged.
- Switching mode lands on that mode's default (Ask -> generate,
  Agent -> query); the shared `generate` is not carried across
  because its label/semantics differ per mode. Vector DBs stay on
  `generate` since their action menu is hidden and they lack SQL
  tools (no execute_query contract).
- External Ask-style triggers (Fix with AI, Explain history) switch
  to Ask mode when invoked from Agent mode so the action is valid
  and the menu reflects what runs.
- Reset the active action to the mode default after each send.

* test(ai): cover Agent task-action contract and mode/action mapping

Lock in the deterministic parts of the Ask/Agent split so only the
LLM-behavior criteria need manual verification.

Backend (agent_loop.rs):
- query contract instructs the LLM to call execute_query and is not
  treated as a SQL-producing action.
- exploreSchema contract points to list_tables/get_columns and says
  not to execute data queries.
- executeAndExplain contract tells the LLM to run the current SQL.
- task actions do not require a SQL deliverable (a conclusion without
  a fenced SQL block still satisfies the contract).
- query repair prompt also targets execute_query.

Frontend (aiActions.spec.ts):
- defaultActionForMode: Ask -> generate, Agent -> query (not generate).
- isValidActionForMode: generate valid in both; Ask-only actions
  rejected in Agent mode and vice versa.
- ASK_ACTIONS / AGENT_ACTIONS composition (Agent menu starts with
  query and still offers generate).

* fix(ai): correct action menu on mode-switched triggers and i18n gaps

Issues found during review of the Ask/Agent action split:

- [#I01] triggerAction (Fix with AI / Explain history) invoked from
  Agent mode switched to Ask and set the action, but the mode-switch
  watch then reset activeAction to the Ask default ("generate"),
  overwriting the action just set — so the menu showed "Generate SQL"
  during a fix. Add a suppressModeActionReset flag so programmatic
  mode switches don't clobber the explicitly-set action.
- [#C01] Remove dead `unsupported_action` reason: buildAiAgentPlan no
  longer produces it, so drop the type variant and the unreachable
  skippedTitleKey case.
- [#I02] es/it/ja/pt-BR were missing the new Agent action keys
  (query/exploreSchema/executeAndExplain/generateNoExec) and their
  placeholders, causing English fallback in the Agent menu. Add the
  translations to match each locale's existing style.

* test(ai): align app-tests with task-action split

- aiSkills: add query/exploreSchema/executeAndExplain to the expected
  action set; broaden the id check (new ids are not _sql-suffixed) and
  relax the userInstruction assertion (schema inspection need not mention SQL).
- aiAgentPlan: drop the unsupported_action skipped step for non-generate
  actions (#C01 removed it from the plan and the reason union); add coverage
  for task-oriented Agent actions not driving client-side execution.

* test(ai): pin locale in dialect prompt spec

buildSystemPrompt selects zh/en copy via currentLocale(), which reflects the
host navigator.language. The spec asserts English strings, so it failed on
zh-CN machines (e.g. Windows with a Chinese system locale) while passing on
CI's en-US runners. Pin the locale to en in beforeAll so the assertions are
deterministic regardless of the host OS locale.
2026-07-06 14:41:39 +08:00
t8y2 7e7c4944e9 refactor(desktop): organize lib modules by domain 2026-07-04 13:53:52 +08:00
Abeautifulsnow fe4908321e feat(ai): support editing sent user messages
* feat(ai): support editing sent user messages

Adds inline edit support for user messages in the AI chat panel.
Hover over a user message to reveal the edit button; confirming the
edit truncates all subsequent history and re-sends with the new content.

* fix(ai): fix IME composition and ref-focus regression in message edit

- Handle IME composition events in onEditKeydown to prevent accidental
  submission on Enter during CJK candidate selection
- Replace per-render :ref focus callback with nextTick + data attribute
  to avoid cursor jumping on every keystroke
- Extract visibleToActualIndex into aiMessageEdit.ts for testability
- Add 8 unit tests covering index mapping with contextSummary messages

* fix(ai): prevent data loss and mention pollution in message edit

- Guard connection/config before truncating messages to prevent silent data
  loss when send() bails early
- Clear selectedMentions before resend to prevent stale chips from polluting
  edited message content
2026-07-03 15:18:56 +08:00
二丫讲梵 f1f4518b67 feat(ai-table-mentions): 增加AI表格提及候选项的过滤和格式化功能 (#2502)
- 引入AI表格提及候选项的限制常量
- 实现过滤候选项的函数,支持根据表名过滤
- 添加单元测试以验证提及解析和候选项过滤的功能
2026-07-03 14:17:43 +08:00
Abeautifulsnow e7dffeca37 fix(ai): tool call status cards, table overflow, streaming TextDelta
* fix(ai): merge tool call status cards

* fix(ai): constrain markdown table overflow

* fix(ai): restore streaming of answer text via TextDelta events

The on_chunk closure was missing live AgentEvent::TextDelta emission for text content, causing the AI answer text to appear all at once after the turn completed. Reasoning deltas were unaffected.

Root cause: commit c30033628 rewrote the on_chunk closure and accidentally dropped the TextDelta emit line while keeping ReasoningDelta intact.

Fix: restore TextDelta emit in on_chunk for incremental streaming, and remove the post-turn full-TextDelta workaround which would duplicate content.

* test(ai): extract chunk_to_events and add streaming event tests

Extract the event-generation logic from the on_chunk closure into a pure function chunk_to_events() to make it testable, and add 6 unit tests covering all chunk content combinations: text-only, reasoning-only, mixed, empty, and edge cases.

This ensures a regression like the one fixed in the previous commit (where TextDelta emission was dropped while ReasoningDelta was kept) would be caught by tests.
2026-07-02 18:49:50 +08:00
Abeautifulsnow a0754206d3 feat(ai-config): persist AI settings per provider (#2412)
## 背景说明
AI 设置原本只有一个配置槽,切换模型厂商时会覆盖之前填写的 endpoint、API Key、model 等信息。本次改动让每个模型厂商各自保存一份配置,并在设置页和对话窗口提供已配置状态与快速切换能力。

## 修改内容
- 新增 ai_provider_configs 存储表,用于按 provider 保存独立 AI 配置
- 新增 Tauri/Web API:保存和加载 provider 级 AI 配置
- 设置页 provider 下拉展示“当前/已配置”状态
- 设置页切换 provider 前会先保存当前表单编辑内容,避免未保存输入丢失
- 对话窗口模型选择器支持查看并切换已配置过的其他 provider
- provider 配置保存时强制 config.provider 与 provider key 一致,避免错位配置污染
- 所有语言补齐新增 i18n 文案

## 修复的问题
- 切换模型厂商时原厂商配置会丢失
- 设置页切换 provider 时本地表单编辑态可能未保存
- provider key 与 config.provider 不一致时可能激活错误厂商
- 对话窗口模型选择器只能看到当前 provider 的模型,不能看到其他已配置厂商

## 测试
- npx tsc --noEmit
- cargo check -p dbx-core
- cargo check -p dbx-web
- cargo check --manifest-path src-tauri/Cargo.toml
2026-07-02 14:24:57 +08:00
lexmin0412 bc409cffc0 feat(ai): add vector DB assistant tools 2026-06-29 11:46:41 +08:00
zipg 28e7cdfacc improve: 统一表单控件小圆角样式 2026-06-28 00:51:45 +08:00
t8y2 bc5ae91abd fix(ai): open assistant links externally 2026-06-27 16:40:04 +08:00
Oleksandr Liakhevych 034cce47e0 fix(ai): Codex CLI provider reliability fixes for DBX Desktop
* fix(ai): resolve Codex CLI from shell PATH on macOS

* fix(ai): hide Codex CLI subprocess windows on Windows

* feat(ai): allow to set environment variable for Codex CLI

* fix(ai): parse Codex MCP tool events

* fix(mcp): honor Postgres TLS settings in direct queries
2026-06-25 22:31:14 +08:00