PingChuan
|
7e7648383e
|
feat:合同文档列表预览完成Collabora集成
|
2025-11-21 11:04:14 +08:00 |
|
LiangShiyong
|
3850d05bdd
|
feat: 1. 将大部分的请求从fetch改成axios方便管理。
2. 给文档类型添加入口模块和相关数据的渲染。并且给文档类型进行功能上的角色权限区分
3. 新增角色权限管理页面
|
2025-11-20 20:34:31 +08:00 |
|
TanWenyan
|
a33213bd1d
|
修复删除会话的错误提示问题(实际成功但显示500错误)
问题分析:
- 删除会话实际成功,但前端提示"Failed to delete conversation: 500"
- difyFetch在响应非2xx时直接抛出异常,导致deleteConversation无法正常返回
- 即使Dify已删除会话,前端也会收到500错误
修复方案:
1. dify-client.server.ts - deleteConversation方法
- 添加try-catch捕获difyFetch异常
- 删除操作特殊处理:即使API返回错误也返回成功
- 理由:会话可能已被删除,避免误报错误
- 下次加载会话列表时会自然发现会话已不存在
2. api.client.ts - deleteConversation函数
- 添加详细日志记录响应状态
- 记录错误详情便于调试
现在删除会话不再误报错误,用户体验更好
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-10-30 15:44:41 +08:00 |
|
TanWenyan
|
8e4213e634
|
修复删除对话时报500错误的问题
问题:
- 删除对话实际成功但前端报错"Failed to delete conversation: 500"
- Dify删除API返回的可能不是JSON格式(空响应或文本)
- 原代码直接调用response.json()导致解析失败抛出异常
修复:
1. 添加Content-Type检查,只有JSON才解析
2. 非JSON响应直接返回成功标识 { result: 'success' }
3. 添加详细日志方便调试
现在删除对话能正确显示成功,无需刷新页面
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-10-30 15:16:37 +08:00 |
|
TanWenyan
|
78e218b953
|
添加返回数据日志,查看API响应内容
添加日志:
1. 打印fetchConversations返回的完整数据
2. 打印fetchAppParams返回的完整数据
3. 打印chat组件接收到的数据
4. 打印解析后的conversations数组
帮助诊断数据格式问题
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-10-30 14:55:46 +08:00 |
|
TanWenyan
|
a5e5f289c1
|
添加详细的客户端请求日志,便于排查问题
添加日志:
1. 请求URL和配置
2. 响应状态
3. 错误详情(包含响应body)
4. 捕获所有异常
帮助诊断:
- API_URL配置是否正确
- 请求是否发送成功
- 响应状态码和内容
- 具体的错误信息
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-10-30 14:51:05 +08:00 |
|
TanWenyan
|
5949d057fb
|
添加详细日志:显示服务端实际调用的FastAPI地址
添加日志输出:
1. 启动时显示完整的Dify API URL配置
- apiBaseUrl: 当前环境的FastAPI地址
- fullDifyUrl: 完整的Dify代理路径
2. 每次请求时显示:
- endpoint: 请求的具体端点
- fullUrl: 完整的请求URL (baseUrl/dify/endpoint)
- baseUrl: FastAPI基础地址
- hasJWT: 是否携带JWT
示例输出(端口51703):
🔧 Dify Client Config: {
apiUrl: 'http://172.16.0.55:8073/dify',
apiBaseUrl: 'http://172.16.0.55:8073',
fullDifyUrl: 'http://172.16.0.55:8073/dify'
}
🌐 [DifyClient] 请求FastAPI代理: {
endpoint: 'chat-messages',
fullUrl: 'http://172.16.0.55:8073/dify/chat-messages',
baseUrl: 'http://172.16.0.55:8073',
hasJWT: true
}
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-10-30 14:33:10 +08:00 |
|
TanWenyan
|
a522d066ab
|
修正:Dify统一使用FastAPI后端地址,移除独立difyBaseUrl配置
问题:错误地为Dify创建了独立的difyBaseUrl配置
正确架构:
客户端 → /api/* → Remix routes → dify-client.server →
FastAPI baseUrl/dify/* → Dify服务
修改:
1. app/config/api-config.ts
- 移除 difyBaseUrl 字段
- 所有环境统一使用 baseUrl (FastAPI后端地址)
- 添加注释说明 baseUrl 包含 /dify 代理
2. app/services/dify-client.server.ts
- 使用 API_BASE_URL 而非 DIFY_BASE_URL
- API_URL: `${API_BASE_URL}/dify`
各环境FastAPI地址:
- development: http://172.16.0.55:8000
- testing: http://nas.7bm.co:8873
- production: http://10.79.97.17:8000
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-10-30 14:24:35 +08:00 |
|
TanWenyan
|
cf6e9c2421
|
紧急修复:客户端改为调用Remix API routes,不再直接调用Dify API
根本问题:客户端代码直接调用Dify API(12980端口),绕过了服务端代理
修改内容:
1. app/config/api-config.ts
- 添加独立的 difyBaseUrl 配置(指向外网 nas.7bm.co:8000)
- 导出 DIFY_BASE_URL 供服务端使用
2. app/config/chat.ts
- 移除直接Dify API配置(NEXT_PUBLIC_API_URL, APP_ID, API_KEY)
- 移除 generateUserId 函数
- API_URL 改为 '/api'(指向Remix API routes)
3. app/services/api.client.ts
- 所有fetch调用改为相对路径 /api/*
- 移除所有 Authorization 头(服务端自动处理JWT)
- 移除所有 user 参数传递(服务端从JWT提取)
- credentials 改为 'include' 以携带cookie
4. app/services/dify-client.server.ts
- 使用 DIFY_BASE_URL 替代 API_BASE_URL
5. app/utils/dify-test.client.ts
- 测试函数改为调用Remix API routes
调用链路:
客户端 → /api/* → Remix API routes → dify-client.server.ts → FastAPI /dify → Dify
解决问题:
- ✅ 不再直接调用 nas.7bm.co:12980(Dify端口)
- ✅ 统一通过 nas.7bm.co:8000/dify(FastAPI代理)
- ✅ 所有请求都经过JWT认证
- ✅ user字段由后端自动管理
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-10-30 11:25:37 +08:00 |
|
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 |
|
TanWenyan
|
c4c08cb59b
|
重构Dify客户端:改为通过FastAPI代理并使用JWT认证
主要变更:
- 修改 dify-client.server.ts 使用 JWT 认证通过 FastAPI 后端代理访问 Dify API
- 所有 Dify API 路由(chat-messages, parameters, conversations, messages)添加 JWT 获取和传递逻辑
- API_URL 从直连 Dify 改为 FastAPI 后端的 /dify 路由
- 增强 JWT 认证失败的错误处理(返回401状态码)
- 添加详细的日志输出,便于调试
安全提升:
- DIFY_API_KEY 从前端移至后端,不再暴露在客户端代码
- 使用统一的 JWT 认证体系,提高系统安全性
文档:
- 新增 dify-proxy-backend-integration.md - 后端对接文档(包含完整 FastAPI 实现示例)
- 新增 dify-frontend-modification-summary.md - 前端修改总结
- 新增 CLAUDE.md - 项目架构说明文档
影响范围:
- app/services/dify-client.server.ts - 核心服务层
- app/routes/api.chat-messages.tsx - 聊天消息
- app/routes/api.parameters.tsx - 应用参数
- app/routes/api.conversations.tsx - 会话列表
- app/routes/api.messages.tsx - 消息历史
- app/routes/api.conversations.$id.tsx - 删除会话
- app/routes/api.conversations.$id.name.tsx - 重命名会话
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-10-30 09:47:48 +08:00 |
|
PingChuan
|
6698542839
|
删除调试打印信息
|
2025-07-02 10:28:47 +08:00 |
|
pingchuan
|
ce851cc448
|
取消统一转发Dify请求,改为由客户端直接发送
|
2025-07-01 15:54:28 +08:00 |
|
pingchuan
|
13fb6ce79f
|
修复打包后读取不到.env文件,编写打包脚本
|
2025-06-09 14:48:58 +08:00 |
|
pingchuan
|
ab960f6dd0
|
移除聊天组件中的调试日志
|
2025-06-06 15:31:36 +08:00 |
|
pingchuan
|
1b79f973da
|
更新AI聊天页面样式
|
2025-06-06 15:07:57 +08:00 |
|
pingchuan
|
af33de09db
|
基于 shiy-temp分支修改
|
2025-06-04 11:18:52 +08:00 |
|