测试日期 / Test Date: 2026-03-07 状态 / Status: ✅ 全部测试通过 / All Tests Passed!
| 项目 / Item | 版本/值 / Version/Value |
|---|---|
| Node.js | v22.22.0 |
| npm | 10.9.4 |
| 操作系统 / OS | Linux 5.15.77-amd64-desktop |
| API Key | sk-xxxxxxxxxxxxxxxx (DeepSeek) |
# 在项目根目录创建 .env 文件 / Create .env file in project root
DEEPSEEK_API_KEY=sk-xxxxxxxxxxxxxxxx
PORT=8000
MAX_CONCURRENT=10
DEFAULT_TIMEOUT=60000# 前端依赖 / Frontend dependencies
cd frontend
npm install
# 后端依赖 / Backend Dependencies
cd ../backend/node
npm install修改 backend/node/src/index.ts,添加从项目根目录加载 .env:
Modify backend/node/src/index.ts to load .env from project root:
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const rootDir = path.resolve(__dirname, '../../..');
dotenv.config({ path: path.join(rootDir, '.env') });cd backend/node
npm run dev输出 / Output:
╔═══════════════════════════════════════════════════════════╗
║ AskOnce API Server ║
║ Server running at: http://localhost:8000 ║
║ WebSocket at: ws://localhost:8000/ws ║
╚═══════════════════════════════════════════════════════════╝
# 健康检查 / Health check
curl http://localhost:8000/api/health
# 输出 / Output: {"status":"healthy","timestamp":"2026-03-07T12:26:10.674Z"}
# 单模型查询 / Single model query
curl -X POST http://localhost:8000/api/query \
-H "Content-Type: application/json" \
-d '{"prompt": "你好,请用一句话介绍自己", "model_ids": ["deepseek-v3"]}'| 测试项 / Test Item | 结果 / Result | 说明 / Description |
|---|---|---|
| 后端启动 / Backend Startup | ✅ 成功 / Success | 监听端口 8000 / Listening on port 8000 |
| 健康检查 / Health Check | ✅ 正常 / Normal | 返回 healthy 状态 / Returns healthy status |
| 获取模型列表 / Get Model List | ✅ 正常 / Normal | 返回 14 个模型 / Returns 14 models |
| 前端启动 / Frontend Startup | ✅ 成功 / Success | 监听端口 3002 / Listening on port 3002 |
| 单模型查询 / Single Model Query | ✅ 成功 / Success | DeepSeek V3 正常响应 / DeepSeek V3 responded normally |
| 多模型并发查询 / Multi-model Query | ✅ 成功 / Success | V3 和 R1 同时响应 / V3 and R1 responded simultaneously |
curl -X POST http://localhost:8000/api/query \
-H "Content-Type: application/json" \
-d '{"prompt": "你好,请用一句话介绍自己", "model_ids": ["deepseek-v3"]}'结果 / Result:
{
"request_id": "req_1772886383770",
"status": "completed",
"results": [{
"model_id": "deepseek-v3",
"status": "completed",
"content": "你好,我是DeepSeek,由深度求索公司创造的AI助手,乐于为你提供解答和帮助!😊",
"tokens_used": 36,
"duration": 2025
}]
}耗时 / Duration: 2.025 秒 / seconds
curl -X POST http://localhost:8000/api/query \
-H "Content-Type: application/json" \
-d '{"prompt": "什么是量子计算?用一句话解释", "model_ids": ["deepseek-v3", "deepseek-r1"]}'结果 / Result:
{
"request_id": "req_1772886396354",
"status": "completed",
"results": [
{
"model_id": "deepseek-v3",
"status": "completed",
"content": "量子计算是利用量子比特的叠加与纠缠特性,在特定问题上实现远超经典计算机算力的新型计算模式。",
"tokens_used": 35,
"duration": 1828
},
{
"model_id": "deepseek-r1",
"status": "completed",
"content": "量子计算是一种利用量子叠加与纠缠等特性,通过量子比特实现指数级加速信息处理的新型计算方式。",
"tokens_used": 55,
"duration": 2637
}
]
}耗时 / Duration: 2.637 秒 (两个模型并发执行 / Two models executed concurrently)
curl http://localhost:3002结果 / Result: HTML 页面正常返回,包含 AskOnce 标题 / HTML page returned normally with AskOnce title
问题 / Issue: 使用示例 API Key 导致 401 认证错误 / Sample API Key caused 401 authentication error
解决 / Solution: 配置真实的 DeepSeek API Key / Configure real DeepSeek API Key
问题 / Issue: .env 文件在项目根目录,但后端从 backend/node 运行 / .env in project root, but backend runs from backend/node
解决 / Solution: 修改 dotenv.config() 加载路径 / Modify dotenv.config() loading path
# 1. 配置 API Key (已配置) / Configure API Key (Configured)
DEEPSEEK_API_KEY=sk-xxxxxxxxxxxxxxxx
# 2. 安装依赖 (已完成) / Install dependencies (Completed)
cd frontend && npm install
cd ../backend/node && npm install
# 3. 启动服务 (两个终端) / Start services (Two terminals)
# 终端1: 后端 / Terminal 1: Backend
cd backend/node && npm run dev
# 终端2: 前端 / Terminal 2: Frontend
cd frontend && npm run dev
# 4. 访问 / Access
# 前端 / Frontend: http://localhost:3000 (或 3001/3002 如果端口被占用 / or 3001/3002 if port is occupied)
# 后端 / Backend: http://localhost:8000| 功能 / Feature | 状态 / Status | 备注 / Notes |
|---|---|---|
| 并发查询 / Concurrent Query | ✅ | 两个 DeepSeek 模型同时响应 / Two DeepSeek models responded simultaneously |
| 流式响应 / Streaming Response | 🔄 | 代码已实现,需前端测试 / Code implemented, needs frontend testing |
| AI 评审 / AI Judge | 🔄 | 需要更多模型 / Needs more models |
| 多视图展示 / Multi-view Display | 🔄 | 需要前端界面测试 / Needs frontend UI testing |
✅ AskOnce 项目运行成功!/ AskOnce Project Running Successfully!
- 后端 API 正常运行 / Backend API running normally
- DeepSeek 模型调用成功 / DeepSeek model called successfully
- 多模型并发查询工作正常 / Multi-model concurrent query working normally
- 前端页面可访问 / Frontend page accessible
报告版本 / Report Version: v1.2 更新日期 / Updated: 2026-03-07 作者 / Author: SeekSage