添加详细日志:显示服务端实际调用的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>
This commit is contained in:
2025-10-30 14:33:10 +08:00
parent a522d066ab
commit 5949d057fb
+9
View File
@@ -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',