修复:恢复CHAT_CONFIG.APP_ID和API_KEY字段,解决"应用配置不正确"错误
问题:移除APP_ID和API_KEY后,chat/index.tsx第125行检查失败, 导致显示"应用暂时不可用,应用配置不正确" 修改: 1. app/config/chat.ts - 添加 APP_ID = 'docreview-chat' (用于localStorage key) - 添加 API_KEY = '' (空值,保持兼容性) - 说明:API_KEY不再用于直接调用Dify,服务端通过JWT处理 2. app/components/chat/index.tsx - 修改hasSetAppConfig检查:从检查APP_ID和API_KEY改为只检查API_URL - 说明:客户端现在通过Remix API routes调用,不需要验证API_KEY 调用流程保持不变: 客户端 → /api/* → JWT验证 → FastAPI /dify → Dify 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -121,8 +121,9 @@ export default function Chat() {
|
||||
// 跟踪新对话是否已发送第一条消息
|
||||
const [newConversationFirstMessageSent, setNewConversationFirstMessageSent] = useState<Set<string>>(new Set());
|
||||
|
||||
// 检查应用配置
|
||||
const hasSetAppConfig = CHAT_CONFIG.APP_ID && CHAT_CONFIG.API_KEY;
|
||||
// 检查应用配置 - 现在客户端通过Remix API routes调用,不需要APP_KEY
|
||||
// 只检查API_URL是否配置
|
||||
const hasSetAppConfig = !!CHAT_CONFIG.API_URL;
|
||||
|
||||
/**
|
||||
* 处理开始聊天
|
||||
|
||||
@@ -42,6 +42,12 @@ export const CHAT_CONFIG = {
|
||||
// 客户端 → /api/* routes → dify-client.server.ts → FastAPI /dify → Dify
|
||||
API_URL: getApiBaseUrl(),
|
||||
|
||||
// 应用ID - 用于localStorage key(固定值)
|
||||
APP_ID: 'docreview-chat',
|
||||
|
||||
// API_KEY 不再需要 - 服务端通过JWT处理认证
|
||||
API_KEY: '', // 保留字段以兼容旧代码
|
||||
|
||||
// 应用信息
|
||||
APP_INFO: {
|
||||
title: '大模型对话',
|
||||
|
||||
Reference in New Issue
Block a user