一个智能认知助手应用,支持知识图谱可视化和多智能体对话。
cognitive-board/
├── backend/ # 后端服务
│ ├── src/
│ │ ├── routes/ # API 路由
│ │ ├── services/ # 业务逻辑服务
│ │ └── index.ts # 服务器入口
│ ├── package.json
│ └── tsconfig.json
├── frontend/ # 前端应用
│ ├── src/
│ │ ├── api/ # API 客户端
│ │ ├── components/ # React 组件
│ │ ├── services/ # 前端服务
│ │ └── App.tsx # 主应用
│ ├── package.json
│ └── vite.config.ts
└── README.md
cd backend
npm installcd frontend
npm install复制 backend/.env.example 为 backend/.env 并填入你的 Gemini API Key:
cd backend
cp .env.example .env
# 编辑 .env 文件,填入 API_KEY复制 frontend/.env.example 为 frontend/.env(可选,默认使用 localhost:3001):
cd frontend
cp .env.example .envcd backend
npm run dev后端将在 http://localhost:3001 运行
cd frontend
npm run dev前端将在 http://localhost:3000 运行
- 使用
npm run dev启动开发服务器(支持热重载) - 使用
npm run build构建生产版本 - 使用
npm start运行生产版本
- 使用
npm run dev启动开发服务器 - 使用
npm run build构建生产版本 - 使用
npm run preview预览生产版本
流式发送消息到 Gemini AI
请求体:
{
"message": "用户消息内容"
}响应: Server-Sent Events (SSE) 流,格式:
data: {"chunk": "文本片段"}
data: {"done": true}
- Node.js + Express
- TypeScript
- @google/genai
- React 19
- TypeScript
- Vite
- Tailwind CSS
Private