修正: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>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { DIFY_BASE_URL } from '~/config/api-config';
|
||||
import { API_BASE_URL } from '~/config/api-config';
|
||||
|
||||
// 获取环境变量的服务端函数
|
||||
const getServerEnvVar = (name: string, defaultValue: string = '') => {
|
||||
@@ -14,8 +14,9 @@ const getServerEnvVar = (name: string, defaultValue: string = '') => {
|
||||
// Dify API 客户端配置
|
||||
// 注意:现在通过 FastAPI 后端的 /dify 路由代理访问 Dify,使用 JWT 认证
|
||||
const DIFY_CONFIG = {
|
||||
// API_URL 指向 FastAPI 后端的 /dify 路由(使用外网地址 nas.7bm.co:8000)
|
||||
API_URL: `${DIFY_BASE_URL}/dify`,
|
||||
// API_URL 指向 FastAPI 后端的 /dify 路由
|
||||
// API_BASE_URL 来自 api-config.ts,根据环境/端口自动配置
|
||||
API_URL: `${API_BASE_URL}/dify`,
|
||||
// API_KEY 保留用于配置验证(实际不再使用,改用JWT)
|
||||
API_KEY: getServerEnvVar('NEXT_PUBLIC_APP_KEY', ''),
|
||||
APP_ID: (() => {
|
||||
|
||||
Reference in New Issue
Block a user