Files
leaudit-platform-frontend/docs
TanWenyan 3254cec5ca 修复Dify对话记录加载问题:移除user参数,由后端自动管理
问题描述:
- 用户登录后无法加载历史对话记录
- 根本原因:前端传递的user值与实际用户不一致,导致Dify无法找到对应的对话

解决方案:
- 后端已实现user字段自动填充功能(v1.2.7-post2)
- 前端采用方案A:完全移除user参数传递
- 让后端从JWT中自动提取username并管理user字段

修改内容:
1. dify-client.server.ts
   - 移除所有方法的user参数
   - GET请求移除user查询参数
   - POST/DELETE请求移除user字段
   - 移除generateUserId工具函数

2. 所有API路由
   - 移除getSessionInfo中的user解构
   - 移除difyClient方法调用中的user参数传递
   - 日志中移除user信息输出

影响接口:
- GET /dify/conversations - 会话列表
- GET /dify/messages - 消息历史
- POST /dify/chat-messages - 发送消息
- POST /dify/conversations/{id}/name - 重命名会话
- DELETE /dify/conversations/{id} - 删除会话
- POST /dify/messages/{id}/feedbacks - 消息反馈

参考文档:docs/dify-frontend-user-field-guide.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 10:37:45 +08:00
..
2025-05-30 21:42:44 +08:00
2025-05-30 21:42:44 +08:00