{"id":25252815,"url":"https://github.com/generousman/deepseek-chat-ui","last_synced_at":"2025-04-06T16:10:28.058Z","repository":{"id":276930278,"uuid":"930747622","full_name":"GenerousMan/DeepSeek-Chat-UI","owner":"GenerousMan","description":"DeepSeek Chat UI, Build your own deepseek service through the API of public cloud vendors。支持上下文、历史会话、联网搜索、TXT/DOC/PDF文件上传、用户管理、流式输出。","archived":false,"fork":false,"pushed_at":"2025-03-07T02:38:18.000Z","size":3469,"stargazers_count":127,"open_issues_count":2,"forks_count":21,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-30T15:07:23.521Z","etag":null,"topics":["chatbot","chatgpt","deepseek","deepseek-r1","ui"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GenerousMan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-11T06:24:27.000Z","updated_at":"2025-03-26T04:13:03.000Z","dependencies_parsed_at":"2025-02-11T08:24:56.037Z","dependency_job_id":"5f9170bd-9b8c-42d7-b825-daeb49850e78","html_url":"https://github.com/GenerousMan/DeepSeek-Chat-UI","commit_stats":null,"previous_names":["generousman/deepseek-chat-ui"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenerousMan%2FDeepSeek-Chat-UI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenerousMan%2FDeepSeek-Chat-UI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenerousMan%2FDeepSeek-Chat-UI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenerousMan%2FDeepSeek-Chat-UI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GenerousMan","download_url":"https://codeload.github.com/GenerousMan/DeepSeek-Chat-UI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247509221,"owners_count":20950232,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatbot","chatgpt","deepseek","deepseek-r1","ui"],"created_at":"2025-02-12T04:18:36.355Z","updated_at":"2025-04-06T16:10:28.032Z","avatar_url":"https://github.com/GenerousMan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DeepSeek Chat-UI 🚀\n\n[![Streamlit](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://your-app-url.example.com)\n![License](https://img.shields.io/badge/License-MIT-blue.svg)\n\n基于Streamlit构建的智能聊天助手，集成深度思考模型与多用户管理系统，支持文件分析、会话管理和API密钥控制，支持联网搜索功能。\n本实现主要调用阿里云的deepseek服务，因此需要部署者提前申请好阿里云百炼的api key，格式为sk-xxxx。\n\n\u003cimg src=\"public/ui-2.png\" width=\"700\" /\u003e\n\n## 📜 更新日志\n- **2025.02.14**\n  - 完善了历史会话的展示功能\n  - 修复了多用户同时使用下的一些冲突问题\n- **2025.02.12**\n  - 新增多API源配置功能，支持在管理员面板动态切换不同服务提供商\n- **2025.02.11**\n  - 新增联网搜索功能，使用serper的api进行调用\n  - 注意，开启联网搜索可能会消耗比较多token，请合理配置搜索条目数。\n\n## 🌟 主要功能\n\n- **多用户认证系统**\n  - 用户注册/登录（支持密码哈希加密）\n  - 管理员特权控制面板\n  - 用户黑名单管理系统\n\u003cimg src=\"public/admin.png\" width=\"700\" /\u003e\n\n- **智能对话功能**\n  - 支持文件上传分析（TXT/DOC/DOCX/PDF）\n  - 上下文感知对话，会在单个session内保留上下文记忆\n  - 双阶段响应机制（思考过程可视化）\n  - 支持联网功能，在侧边栏中可以勾选是否生效\n  \u003cimg src=\"public/ui.jpg\" width=\"700\" /\u003e\n\n- **API密钥管理**\n  - 密钥配额控制（基于token计数）\n  - 使用情况跟踪\n  - 密钥吊销功能\n\n- **其它特性**\n  - SQLite数据库存储\n  - 会话自动保存与恢复\n  - 文件内容去重校验（MD5哈希）\n  - 中文优化token计数算法\n\n## 🛠️ 安装指南\n\n1. 克隆仓库：\n```bash\ngit clone https://github.com/GenerousMan/DeepSeek-Chat-UI.git\n```\n\n2. 安装依赖：\n需要`python` \u003e= 3.9\n\n```bash\npip install -r requirements.txt\n```\n\n## 🖥️ 使用说明\n\n1. 修改app.py中的变量，可以通过app.py中修改，也可以直接新建`.env`文件，变量包括：\n- dirs, 上传路径，以路径分隔符结尾。\n- admin_user，初始的管理员账户\n- admin_pass，初始的管理员密码\n- api_key，云服务的key，需要在[百炼](https://bailian.console.aliyun.com/?spm=5176.28197581.0.0.7dde29a4lSLESr#/model-market/detail/deepseek-r1)申请。\n- search_key, 搜索引擎的key，[serper](https://serper.dev/)可申请。\n\n`.env`文件示例如下：\n```bash\nSEARCH_API_KEY=xxx-serper-key\nCHAT_API_KEY=sk-xxx\nADMIN_USERNAME=admin\nADMIN_PASSWORD=admin\n```\n\n2. 启动应用：\n```bash\nstreamlit run app.py\n```\n\n3. 访问路径：\n- **普通用户**：`http://localhost:8501`\n- **管理员面板**：通过侧边栏设置按钮进入，登录管理员账户即可\n\n\u003cimg src=\"public/login.jpg\" width=\"700\" /\u003e\n\n4. 初始化user key：\n作为管理员登录后，需要创建user key，否则无法使用。\nuser key的作用是记录使用量，避免服务提供给他人使用后被恶意薅用量，请谨慎配置。\n这个user key和api使用的key是不同的：\n- **user key**: 可自定义，仅和user绑定。\n\n\u003cimg src=\"public/user-key.jpg\" width=\"700\" /\u003e\n\n- **api key**: 云服务提供的，一般为sk-xxx格式。是整个项目和云服务的对接途径。\n\n\u003cimg src=\"public/api-key.jpg\" width=\"700\" /\u003e\n\n5. 功能操作：\n- 上传文件（单个文件最大1MB）\n- 可点击创建新会话\n- 可管理历史会话\n- 普通用户可以登录后查看key的使用量\n- 管理员可查看使用统计和密钥管理\n\n## 📂 项目结构\n```\n├── app.py                 # 主应用逻辑\n├── admin_utils.py         # 管理员相关逻辑\n├── api_utils.py           # api相关逻辑\n├── auth_utils.py          # 认证相关逻辑\n├── db_utils.py            # 数据库相关逻辑\n├── file_utils.py          # 文件上传、处理逻辑\n├── helper_utils.py        # session管理相关逻辑\n├── requirements.txt       # 依赖清单\n├── uploads/               # 文件存储目录\n├── app.db                 # 数据库文件\n├── .env                   # 环境配置文件\n└── public/                # 静态资源\n    └── deep-seek.png      # logo\n```\n\n## 🔧 技术架构\n\n**核心组件**：\n- Streamlit (Web框架)\n- SQLite (数据库)\n- bcrypt (密码哈希)\n- textract (文件解析)\n- DeepSeek API (AI模型)\n\n**关键技术**：\n- 会话状态管理\n- 文件内容哈希校验\n- Token配额算法（中文优化）\n- 数据库事务处理\n- 响应流式处理\n\n## 🤝 贡献指南\n\n欢迎通过以下方式参与贡献：\n1. 提交Issue报告问题\n2. 发起Pull Request改进代码\n3. 完善项目文档\n\n## ⚠️ 注意事项\n\n- 生产环境部署前需：\n  - 替换默认管理员凭证\n  - 配置HTTPS加密\n  - 定期备份数据库\n- 文件解析功能依赖系统库：\n  ```bash\n  # Ubuntu系统需安装：\n  sudo apt-get install -y poppler-utils tesseract-ocr\n\n  # MacOS安装：\n  brew install tesseract poppler\n  ```\n\n\n## 📄 许可证\n\n本项目采用 [MIT License](LICENSE)，保留署名权利。\n\n---\n\n*本项目与DeepSeek品牌无官方关联，仅为技术演示用途。敏感操作前请做好数据备份。*","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenerousman%2Fdeepseek-chat-ui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgenerousman%2Fdeepseek-chat-ui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenerousman%2Fdeepseek-chat-ui/lists"}