Commit Graph
414 Commits
Author SHA1 Message Date
digua 12f9ae90eb feat(web): enable AI page data loading in web mode via HTTP endpoints
- Move assistant/skill MD parsers to @openchatlab/node-runtime (shared)
- Move BUILTIN_TOOL_CATALOG, provider-registry, model-catalog to @openchatlab/core
- Add /_web/ai/* HTTP routes for assistants, skills, LLM config, providers, models, tools
- Frontend shims: read ops call HTTP, write/agent ops return stubs
- Remove IS_ELECTRON guard in llm.ts to enable web-mode config loading
- Improve web-mode AI chat error message to be user-friendly
2026-05-14 20:29:06 +08:00
digua 4b15d65b13 refactor(nlp): extract shared NLP logic to core + node-runtime
Move platform-agnostic NLP types, stopwords, POS tag definitions, and
text utilities into @openchatlab/core. Move segmenter engine, word
frequency computation, and dict manager into @openchatlab/node-runtime.

Electron nlp/ becomes a thin re-export layer; server nlp.ts shrinks
from ~450 to ~85 lines retaining only HTTP route definitions. Both
platforms now share the same NLP implementation via node-runtime.

Also fixes createJiebaNlpProvider to use shared getJieba() with disk
dict loading (was using empty Jieba instance causing degraded POS tags
in language preference analysis), adds ensureDefaultDict at server
startup, and adds /_web/nlp/* HTTP routes with window.nlpApi shim.
2026-05-14 19:50:03 +08:00
digua 6ca27b1194 refactor: unify query logic into @openchatlab/core and add analytics HTTP routes 2026-05-14 19:20:51 +08:00
digua ccee680077 feat(services): Phase 0 — service layer infrastructure
- Create src/services/ directory structure with 6 domain folders
- Add registry.ts: platform detection + adapter registration mechanism
- Add utils/sse.ts: generic SSE client (fetchSSE, fetchSSEWithHandlers)
- Add utils/http.ts: shared GET/POST/DELETE helpers for Fetch adapters
- Add services/index.ts: unified exports entry point
- Add task plan: .docs/tasks/2026-05-11-service-layer-refactoring.md
2026-05-13 22:07:41 +08:00
digua 42272575b7 feat(web): implement demo import for web mode via SSE endpoint
- Add POST /_web/demo/import backend endpoint: downloads demo data from
  chatlab.fun and imports using streamImport with SSE progress
- Refactor DemoImportButton.vue to support both Electron (IPC) and
  Web (SSE fetch) modes with shared result handling
2026-05-13 21:53:38 +08:00
digua 700b4266f3 fix(web): session index, CORS proxy, demo guard, and dev script improvements
- Add session index endpoints (generate-index, clear-index) with writable db
- Add window.sessionApi shims for web mode (getStats, generate, getSessions, etc.)
- Fix CORS: add Vite dev proxy for chatlab.fun, centralize CHATLAB_SITE_BASE
- Guard DemoImportButton: show fallback message in web mode
- Use tsx watch for dev:serve hot-reloading
- Reorganize dev scripts: dev:app (web frontend), dev:serve (backend), dev:web (both)
2026-05-13 21:51:27 +08:00
digua 6695181759 fix(web): resolve runtime errors in web mode
- Fix streamImport error handling: close db before deleting files on failure
- Add POST /_web/sessions/:id/query endpoint for parameterized readonly SQL
- Expose PreparedStatement.readonly property in DatabaseAdapter interface
- Fix Fastify error handler to respect statusCode on non-ApiError errors
- Implement FetchAdapter.pluginQuery via HTTP endpoint
- Add web-api-shim.ts: window.chatApi/aiApi polyfills for chart-* and
  MessageList (pluginQuery, pluginCompute, getMemberActivity,
  getAvailableYears, message browsing methods)
- Fix Sidebar: navigate to home after deleting the currently viewed session
2026-05-13 21:25:50 +08:00
digua d14931bf1b fix: guard Electron-specific calls in BasicSettingsTab for web mode
Add IS_ELECTRON guards around window.api.setThemeSource,
window.api.app.getOpenAtLogin, and window.api.app.setOpenAtLogin
to prevent crashes when opening settings in web mode.
2026-05-13 20:39:46 +08:00
digua 3363640e75 feat: add web import support with adapter pattern and ImportArea refactor
- Extend QueryAdapter with importFile, detectFormat, scanMultiChatFile,
  and getSupportedFormats methods
- Implement FetchAdapter import methods with FormData upload and SSE
  progress stream parsing
- Implement ElectronAdapter import methods wrapping existing IPC calls
- Refactor ImportArea.vue to handle both Electron (native dialog + paths)
  and Web (FileDropZone + File objects) import flows
- Add 'indexing' stage to ImportProgress type
- Revert CLI-only import UI, restore drag-and-drop for web mode
2026-05-13 20:28:46 +08:00
digua 4e1f03e252 refactor: extract parser to @openchatlab/parser shared package
Move all 14+ format parsers (QQ, WeChat, Telegram, WhatsApp, LINE,
Discord, Instagram, etc.) from electron/main/parser/ to packages/parser/
as a standalone shared package. Electron's parser module becomes a thin
re-export wrapper. This enables the server to use the same parser for
CLI serve Web import functionality.
2026-05-13 20:19:13 +08:00
digua 086bd882a7 feat(web): implement FetchAdapter and /_web/ internal API routes
Phase 3A.1: Create the HTTP bridge between the Vue SPA frontend
and chatlab serve backend for the CLI serve Web version.

Server side (packages/server):
- Add /_web/ route group (routes/web.ts) with no auth requirement,
  covering: sessions CRUD, time range, member-activity/hourly/daily/
  weekday/message-type stats, members CRUD+pagination+merge+history,
  SQL Lab execute+schema.
- Skip auth hook for /_web/ prefix (same-origin internal API).
- Add getTimeRange() to @openchatlab/core basic queries.

Client side (src/adapters):
- FetchAdapter wrapping all /_web/ endpoints with proper HTTP verbs,
  TimeFilter query param serialization, and error handling.
- Unimplemented analysis methods (catchphrase, mention, cluster, etc.)
  throw descriptive errors for progressive enhancement.
- Wire FetchAdapter into adapter factory (non-Electron, non-browser).
2026-05-13 19:53:01 +08:00
digua 9ac4276465 refactor(adapters): replace window.chatApi calls with QueryAdapter
Phase 3.0.3: Systematically replace all data-query window.chatApi
calls across 24 files with getAdapter() from the new adapter layer.

Replaced categories:
- Session CRUD (getSessions, getSession, deleteSession, renameSession)
- Statistics (getMemberActivity, getHourlyActivity, getDailyActivity,
  getWeekdayActivity, getMessageTypeDistribution, getAvailableYears)
- Member management (getMembers, getMembersPaginated, updateMemberAliases,
  mergeMembers, deleteMember, getMemberNameHistory)
- Social analysis (getMentionAnalysis, getLaughAnalysis,
  getCatchphraseAnalysis, getLanguagePreferenceAnalysis,
  getRelationshipStats)
- SQL Lab (executeSQL, getSchema)

Remaining window.chatApi calls are Electron-specific operations
(import, migration, file dialog, demo, export) that will be handled
separately with IS_ELECTRON guards in future phases.

Also adds initAdapter() call in App.vue onMounted to bootstrap the
adapter before any data loading occurs.
2026-05-13 19:46:41 +08:00
digua f6b3dabc31 feat(adapters): define QueryAdapter interface and ElectronAdapter
Phase 3.0.1 + 3.0.2: Introduce the adapter abstraction layer for
multi-platform support (Electron / CLI serve Web / Online Web).

- src/adapters/types.ts: QueryAdapter interface with 30+ methods
  covering sessions, statistics, members, social analysis, SQL Lab,
  and plugin system. AdapterCapabilities for feature flags.
- src/adapters/electron.ts: ElectronAdapter wrapping window.chatApi
  with full capability support, zero behavior change for desktop.
- src/adapters/index.ts: async factory with compile-time adapter
  selection via __IS_ELECTRON__ / __IS_BROWSER_STANDALONE__.
- src/utils/platform.ts: add IS_BROWSER_STANDALONE detection.
- src/env.d.ts: declare __IS_BROWSER_STANDALONE__ global.
2026-05-13 19:37:57 +08:00
digua 24bdcc0a0e docs: update 2026-05-09 00:28:41 +08:00
digua 63af381f27 fix: 修复部分BUG 2026-05-06 23:56:45 +08:00
digua 0f9f21db83 feat: 迁移到pnpm-workspace 2026-05-06 23:56:45 +08:00
digua f181c70402 feat: 新用户支持查看Demo示例 2026-05-06 23:56:45 +08:00
digua 50da84fe38 feat: 移除向量模型配置逻辑 2026-05-06 23:56:45 +08:00
digua f6cc5c8fb8 feat: 优化设置和展示逻辑 2026-05-06 23:56:45 +08:00
digua 99b4d3e275 feat: debug_context 记录完整 LLM 上下文 2026-05-06 23:56:45 +08:00
digua df0b2a36d2 feat: 上下文压缩行为优化 2026-05-06 23:56:45 +08:00
digua 0c3bbcb37a feat: 优化AI模型配置文案和UI 2026-05-06 23:56:45 +08:00
digua 47ef10f780 feat: 上下文压缩逻辑优化 2026-05-06 23:56:45 +08:00
digua 59f1548258 feat: 重构debug模式,新增原始数据查看 2026-05-06 23:56:45 +08:00
digua b290a85499 feat: 优化上下文窗口配置逻辑 2026-05-06 23:56:45 +08:00
digua 5fc7b5670c feat: 支持上下文自动压缩和新增相关配置 2026-05-06 23:56:45 +08:00
digua ecdb699579 feat: 支持模型上下文窗口预设和配置 2026-05-06 23:56:45 +08:00
digua 78689b2650 fix: 修复部分逻辑漏洞 2026-04-28 23:18:35 +08:00
digua 3423bf04e5 feat: 优化部分展示样式 2026-04-28 23:18:35 +08:00
digua 5e919d3c0b feat: 支持远程模型列表获取功能 2026-04-28 23:18:35 +08:00
digua 97de1e9439 feat: OpenAI 兼容 API 地址自动补全 /v1 并支持实时预览 2026-04-28 23:18:35 +08:00
digua 57455e3120 feat: AI 对话错误详情展示优化 2026-04-28 23:18:35 +08:00
digua e2c20e2e3c feat: 默认时间筛选优化 2026-04-28 00:06:08 +08:00
digua ed6a979aa5 feat: 支持快捷工具入口位置配置 2026-04-28 00:06:08 +08:00
digua 541708b953 fix: 修复弹窗样式覆盖问题 2026-04-28 00:06:08 +08:00
digua 30d61fdf2e feat: 禁止将数据目录设置在应用安装目录下 2026-04-28 00:06:08 +08:00
digua a80730eb4c fix: 修复设置页内弹窗被遮挡的 z-index 问题 2026-04-28 00:06:08 +08:00
digua c97e2e7098 feat: 支持配置每次拉取消息数 2026-04-26 23:38:29 +08:00
digua 352a071a21 feat: 支持远程会话分页发现 2026-04-26 23:38:29 +08:00
xuncha ef2334b758 feat: 订阅新增类型选择 2026-04-26 23:38:29 +08:00
digua 0f4a0da536 feat: 迁移至ChatLab组织 2026-04-24 22:33:56 +08:00
digua 071a8dbb2f fix: AI对话中的链接应该在浏览器中打开(resolve #150) 2026-04-24 22:33:56 +08:00
digua 68e7285570 feat: 全局样式优化 2026-04-24 22:33:56 +08:00
digua a6e574115a feat: 优化快速提问展示逻辑 2026-04-24 22:33:56 +08:00
digua ad62f9e727 feat: 优化设置弹窗弹出方式 2026-04-24 22:33:56 +08:00
digua c3e165409a feat: 支持开机自启动 2026-04-24 22:33:56 +08:00
digua 2be18adf18 feat: 支持DeepSeek V4模型 2026-04-24 22:33:56 +08:00
digua b270eccea1 fix: 修复存量类型警告 2026-04-23 00:04:27 +08:00
digua 0cdaa8ff4f feat: 隐藏记忆入口 2026-04-23 00:02:49 +08:00
digua 87a631657d feat: AI助手交互逻辑优化 2026-04-22 23:46:31 +08:00