Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions dashboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,25 @@
/ (兜底) -> dashboard/dist (静态 SPA)
```

`contextseek.http.dashboard` 把现有 API 路由和构建好的前端组合进**同一个进程**
`contextseek desktop-server` 启动 `contextseek.http.server` 的同源服务
前端是预构建的静态文件,和 API 同源、同端口,无需任何代理。桌面壳
(Tauri / Electron / pywebview)只需指向本地 `:8000` 即可。
(Tauri / Electron / pywebview)只需指向本地 `127.0.0.1:8000` 即可。

## 构建 / 运行

需要 Node.js(提供 `npm`)。在仓库根目录:

```bash
make dashboard # 构建前端到 dashboard/dist,再单进程提供 API + SPA
make desktop-spa # 构建前端到 dashboard/dist
make desktop-server # 在 127.0.0.1:8000 提供 API + SPA
```

或手动:

```bash
npm --prefix dashboard install && npm --prefix dashboard run build
contextseek-dashboard # 等价于 uvicorn contextseek.http.dashboard:app --port 8000
npm --prefix dashboard install
npm --prefix dashboard run build
contextseek desktop-server --host 127.0.0.1 --port 8000
```

浏览器打开 http://127.0.0.1:8000 。
Expand All @@ -46,14 +48,15 @@ contextseek-dashboard # 等价于 uvicorn contextseek.http.dashboard:app --por

| 变量 | 作用 | 默认 |
|---|---|---|
| `VITE_CTX_DEFAULT_SCOPE` | UI 默认 scope(构建时注入) | `contextseek` |
| `CTX_SERVER_PORT` | `contextseek-dashboard` 监听端口 | `8000` |
| `VITE_CTX_BASE` | API 基础路径;同源构建时留空 | `""` |
| `CTX_DESKTOP_PORT` | 未传 `--port` 时 `contextseek desktop-server` 使用的端口 | `8000` |
| `CTX_DASHBOARD_DIST` | 指定已构建 SPA 的 `dist` 目录 | 自动查找 `dashboard/dist` |

参见 [.env.example](.env.example)。
存储、模型等通用服务配置参见仓库根目录的 [.env.example](../.env.example)。

## 后续:打包成桌面应用

单进程设计便于桌面壳集成:用 Tauri / Electron / pywebview 启动
`contextseek-dashboard`(或直接嵌入 uvicorn),窗口指向 `http://127.0.0.1:8000`。
`contextseek desktop-server`(或直接嵌入 uvicorn),窗口指向 `http://127.0.0.1:8000`。
若后续要加回聊天(agentseek)能力,可恢复 `ChatPanel` 并在同一 FastAPI 进程内提供
agent 端点,保持单进程。
Loading