Commit Graph
534 Commits
Author SHA1 Message Date
digua 0801ccf940 feat(ai): stream structured analysis plans 2026-06-10 00:15:25 +08:00
digua 9ad012680d feat(ai): integrate chart planning support 2026-06-10 00:15:25 +08:00
digua 6f54dcc62b feat(cli): expose full agent stream events 2026-06-10 00:15:25 +08:00
digua 2d413f4202 feat(ai): render analysis plan blocks 2026-06-10 00:15:25 +08:00
digua 2d88215d63 test: add default test runner 2026-06-08 10:14:42 +08:00
digua c2295e317f refactor: align ai chat and segment identifiers 2026-06-07 20:27:27 +08:00
digua 296573ed5c refactor(ai): centralize chart runtime policy 2026-06-05 11:12:42 +08:00
CEQ151 15470444e5 feat(ai): improve chart runtime UX 2026-06-05 11:12:42 +08:00
CEQ151 782f67ba63 feat(ai): add slash-activated chart runtime with EChart init fix
- Add ChartSpec validation and chart data normalization (bar/line/pie/heatmap)
- Add render_chart analysis tool with SQL safety (readonly check, outer LIMIT wrapper, CTE write rejection)
- Add chart content block type and ChartBlockRenderer for inline chart rendering
- Add slash menu chart capability activation (single-use per message)
- Add chart payload transport through Electron and CLI Web tool adapters
- Add error block handling for render-only chart tool failures
- Add chart payload persistence through content_blocks JSON storage
- Fix EChart.vue init timing: defer initChart() to nextTick so container
  layout completes before ECharts reads width (was rendering 92px canvases)
- Add comprehensive test coverage: core, integration, agent flow, frontend, smoke
- Add i18n for render_chart and get_schema in 4 locales
- Add project handoff documentation
2026-06-05 11:12:42 +08:00
CEQ151 8f785ee0a8 fix(desktop): smooth Windows title bar overlay 2026-06-05 11:12:42 +08:00
digua 0bd4d31dd2 fix(ui): adjust preset chip stacking 2026-06-05 11:12:42 +08:00
digua 5144c8070a fix(update): suppress cli dev update badge 2026-06-04 14:37:12 +08:00
digua 8b2e6de479 fix: harden preferences and update notice checks 2026-06-04 14:37:12 +08:00
digua f4580c55f1 fix(ai): ensure builtin masking rules before preprocessing 2026-06-04 14:37:12 +08:00
digua cd9f297124 fix(update): harden update notice checks 2026-06-04 14:37:12 +08:00
digua 9030d6b0c3 feat(update): add in-app update notice 2026-06-04 14:37:12 +08:00
digua 218c3c9ee9 feat(ai): group desensitize rules 2026-06-04 14:37:12 +08:00
digua 0c82a300e8 feat(ai): enable preprocess defaults 2026-06-04 14:37:12 +08:00
CEQ151andClaude Opus 4.8 185e88ba3e fix(import): refresh sidebar message count after incremental import
After incremental import via Electron IPC, the sidebar session list
showed stale message counts. Three contributing gaps:

1. The chat:incrementalImport IPC handler did not notify the renderer
   to refresh the session list (unlike the API route which calls
   notifySessionListChanged). Added win.webContents.send('api:importCompleted')
   to trigger the Sidebar's existing onImportCompleted listener.

2. The postImportHook in worker adapters was async (due to dynamic
   import()) but the caller did not await it, causing a race condition
   where loadSessions() could read stale overview cache before
   computeAndSetOverviewCache() finished. Converted to static import
   making the hook synchronous, and updated the type to void | Promise<void>
   with await at call sites in both incremental-importer and
   streaming-importer.

3. The @imported handlers on group-chat and private-chat pages only
   refreshed local analysis data without calling sessionStore.loadSessions().
   Added the call so the sidebar updates immediately on the client side.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 10:20:28 +08:00
digua 6e016837bc fix(data): harden directory and database migrations 2026-06-03 00:46:34 +08:00
digua f234a25ff6 fix(storage): require legacy data before showing migrate hint 2026-06-03 00:46:34 +08:00
digua bb4986d703 fix(storage): reset legacy data hint after directory changes 2026-06-03 00:46:34 +08:00
digua e68ce77266 feat(data): support CLI web data directory migration 2026-06-03 00:46:34 +08:00
digua a94986f117 feat(storage): allow ignoring legacy data prompt 2026-06-03 00:46:34 +08:00
digua 04c97ca9cf fix(data): defer data directory migration until restart 2026-06-03 00:46:34 +08:00
diguaandClaude Sonnet 4.6 f978845dde fix(layout): migrate isSidebarCollapsed persistence from sessionStorage to localStorage
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03 00:46:34 +08:00
digua 40d7d9e840 fix(ai): harden validation and db handle reuse 2026-06-02 15:41:21 +08:00
digua eea1dad907 fix(electron): offload chart plugin compute to worker 2026-06-02 15:41:21 +08:00
diguaandClaude Opus 4.8 d96299b16e fix(ai): enable fetch-models and validate buttons when editing with stored key
In edit mode the API key is intentionally not returned to the client,
causing both buttons to be disabled. Now the backend resolves the stored
key by configId when the client sends an empty key, and the frontend
passes configId for the reuse case so both buttons work without exposing
the key.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 15:41:21 +08:00
digua b66aeb9737 fix(ui): resolve web type-check regressions 2026-06-02 15:41:21 +08:00
digua bf14c68899 refactor(ai): migrate remaining AI IPC to shared HTTP routes 2026-06-02 15:41:21 +08:00
digua 7dcc37e714 refactor(electron): remove session index IPC 2026-06-02 15:41:21 +08:00
digua 9a0e6093f3 fix(ai): harden shared SSE streaming 2026-06-02 15:41:21 +08:00
digua 1af644e4ab refactor(ai): migrate streaming to shared HTTP SSE
Squash Phase 2-2 streaming migration: frontend stream service, LLM SSE route, Agent SSE route, and IPC/preload cleanup.
2026-06-02 15:41:21 +08:00
diguaandCursor 769115240e feat(cache): migrate cache routes to shared HTTP package
Create CacheServiceAdapter + FetchCacheAdapter service layer and move
7 cache routes (info, clear, data-dir, import-log, save-to-downloads,
open-dir, show-in-folder) to @openchatlab/http-routes. Inject platform
callbacks (shell.openPath, showItemInFolder) via HttpRouteContext.
Frontend calls converge from window.cacheApi to useCacheService().
Electron IPC retains only selectDataDir/setDataDir (native dialog).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 15:41:21 +08:00
diguaandCursor fcca22a8dc refactor(ai): remove orphaned AI conversation/message IPC handlers
Migrate conversation/message CRUD and debug queries from IPC to HTTP
by having ElectronAIAdapter extend FetchAIAdapter. Remove 18 dead
handlers (14 CRUD + 3 debug + 1 compressContext) from ipc/ai.ts and
slim down preload AiApi to IPC-only methods (filtering, export, tool
testing, desensitize rules, native shell).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 15:41:21 +08:00
diguaandClaude Sonnet 4.6 1310b04bc0 fix(ui): make data source token required in add modal
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 15:41:21 +08:00
diguaandCursor ae90db63a5 feat(merge): migrate merge routes from IPC to shared HTTP package
Unify the merge workflow (parse/conflicts/execute/clear/export-for-merge)
across CLI, Electron, and web-serve into a single set of shared routes in
@openchatlab/http-routes.

Key changes:
- Move MergeSessionCache from CLI to node-runtime shared package
- Add dual-mode parse route (multipart upload for web, JSON filePath for Electron)
- Integrate merge routes into Electron internal API server with @fastify/multipart
- Create installMergeShims() with filePath-to-handle mapping for frontend
- Remove Electron merge IPC handlers, merger module, and preload bridges (~790 lines deleted)
- Address CodeX review: CHAT_DB_TABLES in openDatabase, no chatApi patching,
  outputName sanitization, resp.ok checks, @fastify/multipart in desktop deps

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 15:41:21 +08:00
diguaandCursor 3ab162162b feat(ai): migrate AI CRUD routes to shared package and establish frontend service layer
Extract LLM config, assistant, skill, conversation and summary CRUD
routes from CLI-specific ai.ts into @openchatlab/http-routes, enabling
Electron Internal Server to serve AI endpoints via shared routes.

Frontend service layer:
- Create src/services/{llm,assistant,skill}/ with typed adapters
- Migrate all window.llmApi/assistantApi/skillApi calls to service layer
- Clean up Electron preload: remove CRUD bridges, keep only streaming IPC

Shared AI routes (packages/http-routes):
- ai-llm: config CRUD, provider registry, model catalog, custom store
- ai-assistants: CRUD, import/reimport, tool catalog
- ai-skills: CRUD, import/reimport, builtin catalog
- ai-conversations: conversation/message/debug CRUD
- ai-summaries: summary generation with LLM config injection
- Add requireAi fail-fast option to registerSharedRoutes

Backend improvements:
- Extract CustomProviderStore/CustomModelStore to node-runtime
- Fix authProfile persistence (onApiKeyCreated returns profileName)
- Reuse AI manager singletons in Electron (avoid dual instances)
- Prevent plaintext API key leakage in addConfig response
- Add authProfile regression tests

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 15:41:21 +08:00
diguaandCursor 09a7d7c5e2 refactor: remove unused chart plugin and NLP API shims
Both shims were installed only in web-serve mode. Chart modules
already use useDataService() directly and NLP components use
HTTP helpers, so the window.chatApi.pluginQuery/pluginCompute/
getMemberActivity/getAvailableYears and window.nlpApi shims
have zero remaining callers.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 15:41:21 +08:00
diguaandCursor f9b5b6b13d refactor: consolidate IPC bridge to native-only
Remove business IPC handlers/preload APIs that are now served by
Internal HTTP Server: preferences, NLP, data queries, message search,
analytics, members, SQL lab. Migrate chart modules from window.*Api
direct calls to useDataService() and NLP components to HTTP.

Make Internal Server a hard dependency, delete ElectronDataAdapter/
MessageAdapter/PreferencesAdapter and IPC fallback path. Retain IPC
only for native capabilities: file import, AI/LLM, session-index
summaries, agent streaming.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 15:41:21 +08:00
digua 96a9d143c4 feat(electron): add internal http server for renderer adapters 2026-06-02 15:41:21 +08:00
diguaandCursor cd3ae8c5ba feat(auth): harden auth security and add remember-me login
Improve auth hook security: restructure URL classification to fix
/_web/* bypass when requireAuth is active, use HMAC-SHA256 for constant-
time token comparison, remove dead webModeEnabled code.

Improve frontend auth flow: extract initializeApp() with watch-based
re-init after login, add getToken callback for real-time store reads,
unify SSE 401 handling via fetchWithAuth, switch default storage to
sessionStorage, add router guard consuming meta.public.

Add "Remember this device" checkbox on login page with dual
localStorage/sessionStorage strategy and safety warning.

Add 23 unit tests for auth hook matrix and http client.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 15:41:21 +08:00
diguaandCursor 8490e2b257 feat(web): add token auth support for frontend with login page
Complete the frontend side of the --require-auth feature:

- Add configureHttpClient() with token injection and 401 handling
- Auto-inject Authorization header in all HTTP helpers and SSE
- Replace 32+ direct fetch('/_web/...') calls with fetchWithAuth
- Add login page for Server mode (token input + validation)
- Add auth store for token persistence (localStorage)
- Add logout button in Settings > About (Server mode only)
- Add i18n translations for login flow (zh-CN/en-US/zh-TW/ja-JP)
- Fix login redirect loop caused by concurrent 401 responses

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 15:41:21 +08:00
diguaandClaude Sonnet 4.6 1b596d664f fix(ui): fix sidebar tooltip placement and API for Nuxt UI v4
Nuxt UI v4 废弃 :popper="{ placement }",改为 :content="{ side }",
旧写法被忽略导致 tooltip 一律显示在下方。

- 展开态按钮(收起、搜索、排序、管理)→ side: bottom
- 折叠态元素(会话项、SidebarButton)→ side: right
- SidebarButton 重构:UTooltip 只包折叠态 div,避免 Reka UI as-child
  在 v-if/v-else 切换时 trigger 引用错乱导致 tooltip 位置错误

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 16:56:08 +08:00
diguaandClaude Sonnet 4.6 69d887c7e2 fix(ui): fix TitleBar dark mode red background and z-index layering
1. 移除 :global(.dark) + 子选择器写法(Vue scoped 编译时选择器泄漏导致
   html.dark { background: #e81123 } 使网页外背景变红),改用 CSS 变量
   + 独立非 scoped <style> 块覆盖深色模式
2. 将 z-index 从 30 提升至 40,使 TitleBar 高于 PageHeader 的
   titlebar-drag-cover (z-30),同时低于 header-actions (z-40, 后挂载),
   三层层叠关系正确:drag-cover < TitleBar ≤ header-actions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 16:56:08 +08:00
digua d1637b41b8 feat(ui): optimize page header and toolbar layout 2026-05-31 16:56:08 +08:00
diguaandCursor 999ce58007 fix(ai): use active slot modelId for thinking level and context window computation
The supportedThinkingLevels, modelContextWindow, and model name display
were reading from config.model (static config value) instead of the
slot's modelId (actual user-selected model). This caused the thinking
selector to show/hide incorrectly when users switched models.

Also fix HTTP utils sending Content-Type: application/json with empty
body when body is null (e.g. setFastModel(null)), which caused Fastify
to return 400.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-31 10:28:29 +08:00
diguaandCursor 9bc0c4279d refactor(ui): simplify model button and optimize session index loading
- StatusBar model button: show model name instead of provider, click opens
  settings directly (scrolls to default model section), remove dropdown
- SessionIndexSection: replace N serial pluginQuery calls with single batch
  API (GET /_web/sessions/index-stats), add IntersectionObserver lazy loading
- Full-stack implementation: CLI route, Electron IPC/Worker, frontend adapters

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-31 10:28:29 +08:00
diguaandCursor 783d61f742 feat(ai): upgrade thinking level control with default/auto options and broader model coverage
- Add 'default' option (no reasoning params sent, model uses native behavior)
- Add 'auto' option for models that natively support it (deepseek_hybrid, kimi, doubao)
- Expand model recognition with regex coverage for 15+ model families
- Add Gemini 2.5+ thinking level support via native Google provider
- Simplify deepseek_hybrid options to ['default', 'off', 'auto'] aligned with Cherry Studio
- Use primary theme color for thinking selector instead of hardcoded blue
- Update docs with thinking control architecture section

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-31 10:28:29 +08:00