Skip to content

Commit 6b10d2d

Browse files
authored
release: 0.5.2
release: 0.5.2
2 parents 3adc54a + ff7b225 commit 6b10d2d

File tree

103 files changed

+5378
-446
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+5378
-446
lines changed

CONTRIBUTING.md

Lines changed: 68 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ We use GitHub to host code, to track issues and feature requests, as well as acc
4040
1. Clone the repository:
4141

4242
```bash
43-
git clone https://github.com/yourusername/deepchat.git
43+
git clone https://github.com/ThinkInAIXYZ/deepchat.git
4444
cd deepchat
4545
```
4646

@@ -95,31 +95,81 @@ We use GitHub to host code, to track issues and feature requests, as well as acc
9595

9696
## Project Structure
9797

98-
- `/src` - Main source code
99-
- `/scripts` - Build and development scripts
100-
- `/resources` - Application resources
101-
- `/build` - Build configuration
102-
- `/out` - Build output
98+
- `src/main/`: Electron main process. Presenters live here (window/tab/thread/config/llmProvider/mcp/config/knowledge/sync/floating button/deeplink/OAuth, etc.).
99+
- `src/preload/`: Context-isolated IPC bridge; only exposes whitelisted APIs to the renderer.
100+
- `src/renderer/`: Vue 3 + Pinia app. App code under `src/renderer/src` (components, stores, views, lib, i18n). Shell UI lives in `src/renderer/shell/`.
101+
- `src/shared/`: Shared types/utilities and presenter contracts used by both processes.
102+
- `runtime/`: Bundled runtimes used by MCP and agent tooling (Node/uv).
103+
- `scripts/`, `resources/`: Build, packaging, and asset pipelines.
104+
- `build/`, `out/`, `dist/`: Build outputs (do not edit manually).
105+
- `docs/`: Design docs and guides.
106+
- `test/`: Vitest suites for main/renderer.
103107

104-
## Code Style
108+
## Architecture Overview
105109

106-
- We use ESLint for JavaScript/TypeScript linting
107-
- Prettier for code formatting
108-
- EditorConfig for maintaining consistent coding styles
110+
### Design Principles
109111

110-
Please ensure your code follows our style guidelines by running:
112+
- **Presenter pattern**: All system capabilities are in main-process presenters; the renderer calls them via the typed `usePresenter` hook and preload bridge.
113+
- **Multi-window + multi-tab shell**: WindowPresenter and TabPresenter manage true Electron windows/BrowserViews with detach/move support; an EventBus fans out cross-process events.
114+
- **Clear data boundaries**: Chat data lives in SQLite (`app_db/chat.db`), settings in Electron Store, knowledge bases in DuckDB, and backups via SyncPresenter. Renderer never touches the filesystem directly.
115+
- **Tooling-first runtime**: LLMProviderPresenter handles streaming, rate limits, and provider instances (cloud/local/ACP agent). MCPPresenter boots MCP servers, router marketplace, and in-memory tools with a bundled Node runtime.
116+
- **Safety & resilience**: contextIsolation is on; file access is gated behind presenters (e.g., ACP workdir registration); backup/import pipelines validate inputs; rate-limit guards prevent provider overload.
111117

112-
```bash
113-
pnpm run lint
114-
pnpm run build
115-
pnpm run i18n
116118
```
119+
┌─────────────────────────────────────────────────────────────┐
120+
│ Electron Main (TS) │
121+
│ Presenters: window/tab/thread/config/llm/mcp/knowledge/ │
122+
│ sync/oauth/deeplink/floating button │
123+
│ Storage: SQLite chat.db, ElectronStore settings, backups │
124+
└───────────────┬─────────────────────────────────────────────┘
125+
│ IPC (contextBridge + EventBus)
126+
┌───────────────▼─────────────────────────────────────────────┐
127+
│ Preload (strict API) │
128+
└───────────────┬─────────────────────────────────────────────┘
129+
│ Typed presenters via `usePresenter`
130+
┌───────────────▼─────────────────────────────────────────────┐
131+
│ Renderer (Vue 3 + Pinia + Tailwind + shadcn/ui) │
132+
│ Shell UI, chat flow, ACP workspace, MCP console, settings │
133+
└───────────────┬─────────────────────────────────────────────┘
134+
135+
┌───────────────▼─────────────────────────────────────────────┐
136+
│ Runtime add-ons: MCP Node runtime, Ollama controls, ACP │
137+
│ agent processes, DuckDB knowledge, sync backups │
138+
└─────────────────────────────────────────────────────────────┘
139+
```
140+
141+
### Domain Modules & Feature Notes
142+
143+
- **LLM pipeline**: `LLMProviderPresenter` orchestrates providers with rate-limit guards, per-provider instances, model discovery, ModelScope sync, custom model import, Ollama lifecycle, embeddings, and the agent loop (tool calls, streaming states). Session persistence for ACP agents lives in `AcpSessionPersistence`.
144+
- **MCP stack**: `McpPresenter` uses ServerManager/ToolManager/McpRouterManager to start/stop servers, choose npm registries, auto-start default/builtin servers, and surface tools/prompts/resources. Supports StreamableHTTP/SSE/Stdio transports and a debugging UI.
145+
- **ACP (Agent Client Protocol)**: ACP providers spawn agent processes, map notifications into chat blocks, and feed the **ACP Workspace** (plan panel with incremental updates, terminal output, and a guarded file tree that requires `registerWorkdir`). PlanStateManager deduplicates plan items and keeps recent completions.
146+
- **Knowledge & search**: Built-in knowledge bases use DuckDB/vector pipelines with text splitters and MCP-backed configs; search assistants auto-select models and support API + simulated-browser engines via MCP or custom templates.
147+
- **Shell & UX**: Multi-window/multi-tab navigation, floating chat window, deeplink handling, sync/backup/restore (SQLite + configs zipped with manifest), notifications, and upgrade channel selection.
148+
149+
## Best Practices
150+
151+
- **Use presenters, not Node APIs in the renderer**: All OS/network/filesystem work should go through the preload bridge and presenters. Keep features multi-window-safe by scoping state to `tabId`/`windowId`.
152+
- **i18n everywhere**: All user-visible strings belong in `src/renderer/src/i18n`; avoid hardcoded text in components.
153+
- **State & UI**: Favor Pinia stores and composition utilities; keep components stateless where possible and compatible with detached tabs. Consider artifacts, variants, and streaming states when touching chat flows.
154+
- **LLM/MCP/ACP changes**: Respect rate limits; clean up active streams before switching providers; emit events via `eventBus`. For MCP, persist changes through `configPresenter` and surface server start/stop events. For ACP, always call `registerWorkdir` before reading the filesystem and clear plan/workspace state when sessions end.
155+
- **Data & persistence**: Use `sqlitePresenter` for conversation data, `configPresenter` for settings/providers, and `syncPresenter` for backup/import. Do not write directly into `appData` from the renderer.
156+
- **Testing & quality gates**: Before sending a PR, run `pnpm run format`, `pnpm run lint`, `pnpm run typecheck`, and relevant `pnpm test*` suites. Use `pnpm run i18n` to validate locale keys when adding strings.
157+
158+
## Code Style
159+
160+
- TypeScript + Vue 3 Composition API + Pinia; Tailwind + shadcn/ui for styling.
161+
- Prettier enforces single quotes and no semicolons; `pnpm run format` before committing.
162+
- OxLint is used for linting (`pnpm run lint`). Type checking via `pnpm run typecheck` (node + web targets).
163+
- Tests use Vitest (`test/main`, `test/renderer`). Name tests `*.test.ts`/`*.spec.ts`.
164+
- Follow naming conventions: PascalCase components/types, camelCase variables/functions, SCREAMING_SNAKE_CASE constants.
117165
118166
## Pull Request Process
119167
120-
1. Update the README.md with details of changes to the interface, if applicable.
121-
2. Update documentation in the `/docs` directory if needed.
122-
3. The PR will be merged once you have the sign-off of at least one maintainer.
168+
1. Keep PRs focused; describe what changed and which issues are addressed.
169+
2. Include screenshots/GIFs for UI changes and note any docs updates (README/CONTRIBUTING/docs).
170+
3. Verify format + lint + typecheck + relevant tests locally; note anything not run.
171+
4. Target the `dev` branch; external contributors should fork-first and open PRs against `dev`.
172+
5. At least one maintainer approval is required before merge.
123173
124174
## Any Questions?
125175

CONTRIBUTING.zh.md

Lines changed: 68 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
1. 克隆仓库:
4141

4242
```bash
43-
git clone https://github.com/yourusername/deepchat.git
43+
git clone https://github.com/ThinkInAIXYZ/deepchat.git
4444
cd deepchat
4545
```
4646

@@ -95,31 +95,81 @@ pnpm run dev
9595

9696
## 项目结构
9797

98-
- `/src` - 主要源代码
99-
- `/scripts` - 构建和开发脚本
100-
- `/resources` - 应用资源
101-
- `/build` - 构建配置
102-
- `/out` - 构建输出
98+
- `src/main/`:Electron 主进程。Presenter 全部集中于此(window/tab/thread/config/llmProvider/mcp/knowledge/sync/浮窗/deeplink/OAuth 等)。
99+
- `src/preload/`:开启 contextIsolation 的 IPC 桥,只暴露白名单 API 给渲染进程。
100+
- `src/renderer/`:Vue 3 + Pinia 应用。业务代码在 `src/renderer/src`(components、stores、views、lib、i18n),Shell UI 在 `src/renderer/shell/`
101+
- `src/shared/`:主渲染共享的类型、工具和 presenter 契约。
102+
- `runtime/`:随应用发布的 MCP/Agent 运行时(Node/uv)。
103+
- `scripts/``resources/`:构建、打包与资产管线。
104+
- `build/``out/``dist/`:构建产物(请勿直接修改)。
105+
- `docs/`:设计文档与指南。
106+
- `test/`:Vitest 测试(main/renderer)。
103107

104-
## 代码风格
108+
## 架构概览
105109

106-
- 使用 ESLint 进行 JavaScript/TypeScript 代码检查
107-
- 使用 Prettier 进行代码格式化
108-
- 使用 EditorConfig 维护一致的编码风格
110+
### 设计原则
109111

110-
请确保您的代码符合我们的代码风格指南,可以运行以下命令:
112+
- **Presenter 模式**:系统能力集中在主进程 Presenter,通过 preload 的 `usePresenter` 类型化调用。
113+
- **多窗口 + 多 Tab Shell**:WindowPresenter 与 TabPresenter 管理真正的 Electron 窗口/BrowserView,可分离/移动;EventBus 负责跨进程广播。
114+
- **清晰数据边界**:聊天数据在 SQLite(`app_db/chat.db`),设置在 Electron Store,知识库在 DuckDB,备份由 SyncPresenter 负责;渲染进程不直接读写文件系统。
115+
- **工具优先运行时**:LLMProviderPresenter 统一流式处理、限流、实例管理(云/本地/ACP Agent);MCPPresenter 启动 MCP 服务器、Router 市场和内置工具,捆绑 Node 运行时。
116+
- **安全与韧性**:开启 contextIsolation;文件访问经 Presenter 授权(如 ACP 需要 `registerWorkdir`);备份/导入校验输入;限流保护避免 Provider 过载。
111117

112-
```bash
113-
pnpm run lint
114-
pnpm run i18n
115-
pnpm run build
116118
```
119+
┌─────────────────────────────────────────────────────────────┐
120+
│ Electron Main (TS) │
121+
│ Presenters: window/tab/thread/config/llm/mcp/knowledge/ │
122+
│ sync/oauth/deeplink/浮窗 │
123+
│ 存储: SQLite chat.db, ElectronStore, 备份 │
124+
└───────────────┬─────────────────────────────────────────────┘
125+
│ IPC (contextBridge + EventBus)
126+
┌───────────────▼─────────────────────────────────────────────┐
127+
│ Preload (strict API) │
128+
└───────────────┬─────────────────────────────────────────────┘
129+
│ Typed presenters via `usePresenter`
130+
┌───────────────▼─────────────────────────────────────────────┐
131+
│ Renderer (Vue 3 + Pinia + Tailwind + shadcn/ui) │
132+
│ Shell UI, 聊天流转, ACP 工作区, MCP 控制台, 设置 │
133+
└───────────────┬─────────────────────────────────────────────┘
134+
135+
┌───────────────▼─────────────────────────────────────────────┐
136+
│ 运行时扩展: MCP Node 运行时, Ollama 控制, ACP Agent 进程, │
137+
│ DuckDB 知识库, 同步备份 │
138+
└─────────────────────────────────────────────────────────────┘
139+
```
140+
141+
### 模块与特性要点
142+
143+
- **LLM 管线**:`LLMProviderPresenter` 负责 Provider 编排、限流守卫、实例管理、模型发现、ModelScope 同步、自定义模型导入、Ollama 生命周期、Embedding、Agent Loop(工具调用、流式状态),ACP Agent 会话持久化在 `AcpSessionPersistence`。
144+
- **MCP 栈**:`McpPresenter` 搭配 ServerManager/ToolManager/McpRouterManager 启停服务,选择 npm registry,自动拉起默认/内置服务器,并在 UI 中呈现 Tools/Prompts/Resources,支持 StreamableHTTP/SSE/Stdio 传输及调试窗口。
145+
- **ACP(Agent Client Protocol)**:ACP Provider 启动 Agent 进程,将通知映射为聊天区块,并驱动 **ACP Workspace**(计划面板增量更新、终端输出、受控文件树,需先 `registerWorkdir`)。PlanStateManager 去重计划项并保留最近完成记录。
146+
- **知识与搜索**:内置知识库采用 DuckDB + 文本切分 + MCP 配置;搜索助手自动择模,支持 API 搜索和模拟浏览搜索引擎,亦可用自定义模板。
147+
- **Shell & 体验**:多窗口/多 Tab 导航、悬浮聊天窗、deeplink 启动、同步/备份/恢复(SQLite+配置清单打包 zip)、通知、升级通道、隐私开关。
148+
149+
## 最佳实践
150+
151+
- **渲染层勿直接用 Node API**:所有 OS/网络/文件操作经 preload Presenter;注意使用 `tabId`/`windowId` 保障多窗口安全。
152+
- **全量 i18n**:用户可见文案放在 `src/renderer/src/i18n`,避免组件内硬编码。
153+
- **状态与 UI**:倾向 Pinia store 与组合式工具,保持组件尽量无状态并兼容 tab 分离;修改聊天流时留意 artifacts、variants、流式状态。
154+
- **LLM/MCP/ACP 变更**:尊重限流;切换 Provider 前清理活跃流;通过 eventBus 派发事件。MCP 相关改动要落盘到 `configPresenter`,并呈现 server start/stop 事件。ACP 访问文件前调用 `registerWorkdir`,会话结束需清理计划/工作区状态。
155+
- **数据与持久化**:会话用 `sqlitePresenter`,设置/Provider 用 `configPresenter`,备份导入用 `syncPresenter`;不要从渲染进程直接写 `appData`。
156+
- **质量门槛**:提交前运行 `pnpm run format`、`pnpm run lint`、`pnpm run typecheck` 及相关 `pnpm test*`。新增文案后跑 `pnpm run i18n` 校验 key。
157+
158+
## 代码风格
159+
160+
- TypeScript + Vue 3 Composition API + Pinia;样式使用 Tailwind + shadcn/ui。
161+
- Prettier:单引号、无分号;提交前请执行 `pnpm run format`。
162+
- OxLint 用于代码检查(`pnpm run lint`);类型检查 `pnpm run typecheck`(node + web 双目标)。
163+
- 测试使用 Vitest(`test/main`、`test/renderer`),命名 `*.test.ts` / `*.spec.ts`。
164+
- 命名约定:组件/类型 PascalCase,变量/函数 camelCase,常量 SCREAMING_SNAKE_CASE。
117165
118166
## Pull Request 流程
119167
120-
1. 如果涉及接口变更,请更新 README.md
121-
2. 如有需要,请更新 `/docs` 目录中的文档
122-
3. 获得至少一位维护者的批准后,PR 将被合并
168+
1. 保持 PR 聚焦,描述改动内容及关联 Issue。
169+
2. UI 变更请附截图/GIF,并注明涉及的文档更新(README/CONTRIBUTING/docs)。
170+
3. 本地确认 format + lint + typecheck + 相关测试,如未执行请在 PR 备注。
171+
4. 目标分支为 `dev`;外部贡献者请先 Fork,再向 `dev` 提 PR。
172+
5. 至少需一位维护者批准后合并。
123173
124174
## 有问题?
125175

README.jp.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@
1212
<a href="https://github.com/ThinkInAIXYZ/deepchat/pulls"><img src="https://img.shields.io/github/issues-pr/ThinkInAIXYZ/deepchat" alt="Pull Requests Badge"/></a>
1313
<a href="https://github.com/ThinkInAIXYZ/deepchat/issues"><img src="https://img.shields.io/github/issues/ThinkInAIXYZ/deepchat" alt="Issues Badge"/></a>
1414
<a href="https://github.com/ThinkInAIXYZ/deepchat/blob/main/LICENSE"><img src="https://img.shields.io/github/license/ThinkInAIXYZ/deepchat" alt="License Badge"/></a>
15+
<a href="https://github.com/ThinkInAIXYZ/deepchat/releases/latest"><img src="https://img.shields.io/endpoint?url=https://api.pinstudios.net/api/badges/downloads/ThinkInAIXYZ/deepchat/total" alt="Downloads"></a>
1516
<a href="https://deepwiki.com/ThinkInAIXYZ/deepchat"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
1617
</p>
1718

19+
<div align="center">
20+
<a href="https://trendshift.io/repositories/15162" target="_blank"><img src="https://trendshift.io/api/badge/repositories/15162" alt="ThinkInAIXYZ%2Fdeepchat | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
21+
</div>
22+
1823
<div align="center">
1924
<a href="./README.zh.md">中文</a> / <a href="./README.md">English</a> / <a href="./README.jp.md">日本語</a>
2025
</div>

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@
1212
<a href="https://github.com/ThinkInAIXYZ/deepchat/pulls"><img src="https://img.shields.io/github/issues-pr/ThinkInAIXYZ/deepchat" alt="Pull Requests Badge"/></a>
1313
<a href="https://github.com/ThinkInAIXYZ/deepchat/issues"><img src="https://img.shields.io/github/issues/ThinkInAIXYZ/deepchat" alt="Issues Badge"/></a>
1414
<a href="https://github.com/ThinkInAIXYZ/deepchat/blob/main/LICENSE"><img src="https://img.shields.io/github/license/ThinkInAIXYZ/deepchat" alt="License Badge"/></a>
15+
<a href="https://github.com/ThinkInAIXYZ/deepchat/releases/latest"><img src="https://img.shields.io/endpoint?url=https://api.pinstudios.net/api/badges/downloads/ThinkInAIXYZ/deepchat/total" alt="Downloads"></a>
1516
<a href="https://deepwiki.com/ThinkInAIXYZ/deepchat"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
1617
</p>
1718

19+
<div align="center">
20+
<a href="https://trendshift.io/repositories/15162" target="_blank"><img src="https://trendshift.io/api/badge/repositories/15162" alt="ThinkInAIXYZ%2Fdeepchat | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
21+
</div>
22+
1823
<div align="center">
1924
<a href="./README.zh.md">中文</a> / <a href="./README.md">English</a> / <a href="./README.jp.md">日本語</a>
2025
</div>

0 commit comments

Comments
 (0)