From 5949d057fb1012cbf5551d6d906edc9e4291f98d Mon Sep 17 00:00:00 2001 From: Wenyan Date: Thu, 30 Oct 2025 14:33:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=A6=E7=BB=86=E6=97=A5?= =?UTF-8?q?=E5=BF=97=EF=BC=9A=E6=98=BE=E7=A4=BA=E6=9C=8D=E5=8A=A1=E7=AB=AF?= =?UTF-8?q?=E5=AE=9E=E9=99=85=E8=B0=83=E7=94=A8=E7=9A=84FastAPI=E5=9C=B0?= =?UTF-8?q?=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加日志输出: 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 --- app/services/dify-client.server.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/services/dify-client.server.ts b/app/services/dify-client.server.ts index 052b8ad..559967b 100644 --- a/app/services/dify-client.server.ts +++ b/app/services/dify-client.server.ts @@ -29,6 +29,8 @@ const DIFY_CONFIG = { console.log('🔧 Dify Client Config:', { apiUrl: DIFY_CONFIG.API_URL, + apiBaseUrl: API_BASE_URL, + fullDifyUrl: `${API_BASE_URL}/dify`, appId: DIFY_CONFIG.APP_ID, hasApiKey: !!DIFY_CONFIG.API_KEY, configComplete: !!(DIFY_CONFIG.API_URL && DIFY_CONFIG.APP_ID) @@ -38,6 +40,13 @@ console.log('🔧 Dify Client Config:', { const difyFetch = async (endpoint: string, options: RequestInit = {}, jwt?: string) => { const url = `${DIFY_CONFIG.API_URL}/${endpoint.replace(/^\//, '')}`; + console.log('🌐 [DifyClient] 请求FastAPI代理:', { + endpoint, + fullUrl: url, + baseUrl: API_BASE_URL, + hasJWT: !!jwt + }); + // 使用 JWT 认证而非 API_KEY const headers: HeadersInit = { 'Content-Type': 'application/json',