Back to skills
SKILL.md
2479 Tasks 600ce05f
ASecurity- [x] 1.1 创建 `chat_sessions` 表 (session_id, user_id, title, created_at, updated_at, last_message_at, message_count) - [x] 1.2 创建 `chat_messages` 表 (id, session_id, user_id, role, content, metadata, created_at) - [x] 1.3 `users` 表增加 `is_admin` 字段 (UInt8, 默认0) - [x] 1.4 更新 `sync_history` 表增加 `user_id` 字段
- 9 stars
- 0 votes
- 0 copies
- 1 view
- Added October 11, 2026
Works with
Security analysis
100/100npx -y skills add tools-only/X-Skills --skill 2479-tasks_600ce05f --agent claude-codeAre you the author of 2479 Tasks 600ce05f?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/tools-only-2479-tasks-600ce05f)# Tasks: 用户维度功能完善
## 1. 数据库Schema变更
- [x] 1.1 创建 `chat_sessions` 表 (session_id, user_id, title, created_at, updated_at, last_message_at, message_count)
- [x] 1.2 创建 `chat_messages` 表 (id, session_id, user_id, role, content, metadata, created_at)
- [x] 1.3 `users` 表增加 `is_admin` 字段 (UInt8, 默认0)
- [x] 1.4 更新 `sync_history` 表增加 `user_id` 字段
## 2. 用户管理员功能
- [x] 2.1 更新 auth/schemas.py 添加 is_admin 字段到 UserResponse
- [x] 2.2 更新 auth/service.py 支持管理员邮箱配置自动设置 is_admin
- [x] 2.3 添加 auth/dependencies.py 中的 `require_admin` 依赖
- [x] 2.4 更新 auth/router.py 的 `/me` 接口返回 is_admin
## 3. 对话历史持久化
- [x] 3.1 更新 chat/schemas.py 添加 Session/Message 模型
- [x] 3.2 重构 chat/service.py 实现数据库持久化
- [x] 3.2.1 create_session 写入数据库并绑定 user_id
- [x] 3.2.2 add_message 写入数据库
- [x] 3.2.3 get_session_history 从数据库查询
- [x] 3.2.4 get_user_sessions 获取用户所有会话列表
- [x] 3.3 更新 chat/router.py 添加用户认证和会话管理接口
- [x] 3.3.1 POST /session 需要登录,绑定 user_id
- [x] 3.3.2 GET /sessions 获取当前用户所有会话
- [x] 3.3.3 DELETE /session/{session_id} 删除会话
- [x] 3.3.4 流式接口验证 session 归属当前用户
## 4. 数据管理权限控制
- [x] 4.1 datamanage/router.py 所有路由添加 `require_admin` 依赖
- [x] 4.2 更新前端数据管理页面显示无权限提示(非管理员)
- [x] 4.3 sync_task_manager 创建任务时记录 user_id
## 5. 任务历史用户追踪
- [x] 5.1 更新 datamanage/schemas.py SyncHistory 添加 user_id, username
- [x] 5.2 更新 datamanage/service.py SyncTaskManager
- [x] 5.2.1 create_task 接收并存储 user_id
- [x] 5.2.2 get_tasks_paginated 支持 user_id 筛选
- [x] 5.3 任务历史API返回操作用户信息
## 6. Agent用户上下文
- [x] 6.1 chat/router.py 流式接口 context 添加 user_id
- [x] 6.2 orchestrator.py 将 user_id 传递给子Agent (已实现: context 透传)
- [x] 6.3 enhanced_portfolio_agent.py 工具自动使用 context 中的 user_id
- [x] 6.4 portfolio_agent.py 用户隔离存储实现
## 7. 测试验证
- [x] 7.1 测试对话历史创建、查询、删除
- [x] 7.2 测试非管理员访问数据管理返回 403
- [x] 7.3 测试任务历史记录包含用户信息
- [x] 7.4 测试持仓分析只返回当前用户数据
Attribution
Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.