# cufe-chat-webui **Repository Path**: cuber_lawrence/cufe-chat-webui ## Basic Information - **Project Name**: cufe-chat-webui - **Description**: chat-webui - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-06-17 - **Last Updated**: 2025-06-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). ## Getting Started First, run the development server: ```bash npm run dev # or yarn dev # or pnpm dev # or bun dev ``` Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. You can start editing the page by modifying `app/page.js`. The page auto-updates as you edit the file. This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. ## Learn More To learn more about Next.js, take a look at the following resources: - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! ## Deploy on Vercel The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. # CUFEL agent生成研报项目的智能聊天助手 ## 快速开始 ### 环境要求 - Node.js 18+ - npm 或 yarn ### 安装依赖 ```bash npm install ``` ### 环境变量配置 在项目根目录创建 `.env.local` 文件: ```bash # NextAuth.js 配置 NEXTAUTH_URL=http://localhost:3000 NEXTAUTH_SECRET=your-secret-key-here-change-in-production # 后端 API 地址(根据实际情况修改) API_BASE_URL=http://localhost:8000 ``` ### 启动开发服务器 ```bash npm run dev ``` 访问 [http://localhost:3000](http://localhost:3000) 查看应用。 ### 测试账号 - 用户名:`admin` - 密码:`admin` - 测试邀请码:`123456` ## 后端接口文档 ### 🔐 认证相关接口 ``` POST /api/auth/register # 用户注册(需要邀请码验证) POST /api/auth/login # 用户登录 POST /api/auth/logout # 用户登出 POST /api/auth/refresh # 刷新 token GET /api/auth/me # 获取当前用户信息 POST /api/auth/verify-invite # 验证邀请码 ``` ### 👤 用户管理接口 ``` GET /api/users/profile # 获取用户资料 PUT /api/users/profile # 更新用户资料 GET /api/users/sessions # 获取用户会话列表 DELETE /api/users/sessions/{id} # 删除特定会话 ``` ### 💬 聊天会话接口 ``` GET /api/sessions # 获取用户的所有聊天会话 POST /api/sessions # 创建新的聊天会话 GET /api/sessions/{id} # 获取特定会话详情 PUT /api/sessions/{id} # 更新会话信息(如标题) DELETE /api/sessions/{id} # 删除会话 ``` ### 📝 消息相关接口 ``` GET /api/sessions/{id}/messages # 获取会话中的所有消息 POST /api/sessions/{id}/messages # 发送新消息 PUT /api/messages/{id} # 编辑消息 DELETE /api/messages/{id} # 删除消息 ``` ### 🤖 LLM 调用接口 ``` POST /api/llm/chat # 发送消息给 LLM POST /api/llm/stream # 流式聊天接口 GET /api/llm/models # 获取可用的 LLM 模型列表 ``` ### 📊 搜索和记录接口 ``` POST /api/search # 执行搜索查询 GET /api/search/history # 获取搜索历史 GET /api/search/records/{id} # 获取特定搜索记录 ``` ### 🗂️ 文件管理接口 ``` POST /api/files/upload # 上传文件 GET /api/files/{id} # 下载/获取文件 DELETE /api/files/{id} # 删除文件 GET /api/files # 获取用户文件列表 ``` ### 📈 用户反馈接口 ``` POST /api/feedback # 提交用户反馈 GET /api/feedback # 获取用户反馈历史 PUT /api/feedback/{id} # 更新反馈状态 ``` ### 🔧 系统管理接口(管理员) ``` GET /api/admin/users # 获取所有用户列表 PUT /api/admin/users/{id} # 更新用户状态 GET /api/admin/invitations # 获取邀请码列表 POST /api/admin/invitations # 创建新邀请码 GET /api/admin/stats # 获取系统统计信息 ``` ## 数据格式示例 ### 用户注册请求 ```json { "username": "string", "email": "string", "password": "string", "invitation_code": "string" } ``` ### 发送消息请求 ```json { "content": "string", "message_type": "user|assistant", "session_id": "string" } ``` ### 创建会话请求 ```json { "title": "string", "initial_message": "string" } ``` ## To-do list - [x] 侧边栏 - [x] 聊天界面 - [ ] 调整UI,现在有点没对齐 - [ ] messages的额外选项,给用户确认 - [x] 关于页面 - [ ] 历史记录页面 - [ ] canvas对接 - [ ] 登录注册页面 - [ ] 个人中心页面