Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/auto-commit.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Auto Commit Demo

on:
workflow_dispatch: # 手动触发
workflow_dispatch: # 手动触发

jobs:
auto-commit:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:

- name: Install
run: pnpm install --frozen-lockfile
- name: Format check
run: pnpm run format:check
- name: Lint
run: pnpm run lint
- name: Type check
Expand Down
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.next
out
build
coverage
node_modules
.pnpm-store
pnpm-lock.yaml
tsconfig.tsbuildinfo
6 changes: 4 additions & 2 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
当前版本仍使用 Next.js 内置 `/api/chat` 作为服务端代理。

环境变量:

- `DEEPSEEK_API_KEY`:模型 API Key
- `BASE_URL`:OpenAI-compatible 接口地址(例如 `https://api.deepseek.com/v1`)
- `NEXT_PUBLIC_AGENT_ADAPTER`:Agent adapter 模式(`mock` 或 `http`,默认 `mock`)
- `NEXT_PUBLIC_AGENT_API_BASE_URL`:当 `NEXT_PUBLIC_AGENT_ADAPTER=http` 时使用的后端地址
- `NEXT_PUBLIC_AGENT_TOOL_NAME`:HTTP 模式下默认工具名(默认 `deepscan.search`)

注意:

- 前端不直接暴露模型 Key。
- 当前不依赖登录即可运行。
- Agent 面板联调前至少配置 `NEXT_PUBLIC_AGENT_ADAPTER=http` 与 `NEXT_PUBLIC_AGENT_API_BASE_URL`。
Expand All @@ -35,6 +37,6 @@

## 迁移建议

1. 先新增 Gin 服务并对齐接口,再替换前端请求基址。
2. 会话与消息链路先迁移到 DB,再关闭本地写入。
1. 先新增 Gin 服务并对齐接口,再替换前端请求基址。
2. 会话与消息链路先迁移到 DB,再关闭本地写入。
3. Agent 与 MCP 在后端稳定后逐步放量。
4 changes: 4 additions & 0 deletions docs/page-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ flowchart TD
```

源码定位:

- `src/app/layout.tsx`:全局布局、主题与 Query Provider。
- `src/components/AppShell.tsx`:两栏骨架与侧边栏折叠状态。
- `src/app/page.tsx`:首页输入后跳转 `/chat/new?q=...`。
Expand Down Expand Up @@ -47,6 +48,7 @@ sequenceDiagram
```

源码定位:

- `src/app/components/InputField.tsx`:输入、提交与停止按钮。
- `src/app/chat/[chat_id]/page.tsx`:发送逻辑、流式状态、会话创建与跳转。
- `src/app/components/MessageList.tsx`:助手/用户消息渲染与代码块复制。
Expand Down Expand Up @@ -76,6 +78,7 @@ sequenceDiagram
```

源码定位:

- `src/components/Navbar.tsx`:会话列表操作。
- `src/lib/chatStore.ts`:会话元信息读写与排序。

Expand All @@ -87,6 +90,7 @@ sequenceDiagram
- `deepscan:sidebar-collapsed`:侧边栏折叠状态。

恢复流程:

1. 进入 `/chat/[chat_id]` 时读取会话 ID。
2. 从 `deepscan:chat:<sessionId>:messages` 拉取历史消息。
3. 渲染消息列表并继续在同一会话上下文发送。
16 changes: 16 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
import { defineConfig, globalIgnores } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import nextTs from "eslint-config-next/typescript";
import prettier from "eslint-config-prettier";
import simpleImportSort from "eslint-plugin-simple-import-sort";

const eslintConfig = defineConfig([
...nextVitals,
...nextTs,
{
plugins: {
"simple-import-sort": simpleImportSort,
},
rules: {
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"@typescript-eslint/consistent-type-imports": [
"error",
{ prefer: "type-imports", fixStyle: "inline-type-imports" },
],
},
},
prettier,
// Override default ignores of eslint-config-next.
globalIgnores([
// Default ignores of eslint-config-next:
Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"build": "next build",
"start": "next start",
"lint": "eslint",
"lint:fix": "eslint --fix",
"type-check": "tsc --noEmit",
"format": "prettier --write .",
"format:check": "prettier --check .",
"test": "vitest run"
},
"dependencies": {
Expand All @@ -33,6 +36,10 @@
"@types/react-syntax-highlighter": "^15.5.13",
"eslint": "^9",
"eslint-config-next": "16.1.6",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-simple-import-sort": "^12.1.1",
"prettier": "^3.8.1",
"prettier-plugin-tailwindcss": "^0.7.2",
"tailwindcss": "^4",
"typescript": "^5",
"vitest": "^4.0.18"
Expand Down
97 changes: 97 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
packages:
- .

ignoredBuiltDependencies:
- '@clerk/shared'
- "@clerk/shared"
- sharp
- unrs-resolver
10 changes: 10 additions & 0 deletions prettier.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/** @type {import("prettier").Config} */
const config = {
printWidth: 100,
semi: true,
singleQuote: false,
trailingComma: "all",
plugins: ["prettier-plugin-tailwindcss"],
};

export default config;
2 changes: 1 addition & 1 deletion src/app/api/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function POST(req: Request) {
} catch (error) {
return Response.json(
{ error: error instanceof Error ? error.message : "Missing model config" },
{ status: 500 }
{ status: 500 },
);
}

Expand Down
Loading
Loading