修正: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:
2025-10-30 14:24:35 +08:00
parent 8099d333e4
commit a522d066ab
2 changed files with 9 additions and 17 deletions
+5 -14
View File
@@ -5,10 +5,8 @@
*/
// 环境配置类型
interface ApiConfig {
// 主API基础URL
// 主API基础URLFastAPI后端地址,包含Dify代理)
baseUrl: string;
// Dify对话服务URL(独立配置,使用外网地址)
difyBaseUrl: string;
// 文档服务URL
documentUrl: string;
// 文档上传API URL
@@ -124,8 +122,7 @@ const portConfigs: Record<string, Partial<ApiConfig>> = {
const configs: Record<string, ApiConfig> = {
// 开发环境
development: {
baseUrl: 'http://172.16.0.55:8000',
difyBaseUrl: 'http://nas.7bm.co:8000', // Dify对话服务使用外网地址
baseUrl: 'http://172.16.0.55:8000', // FastAPI后端(包含/dify代理)
documentUrl: 'http://172.16.0.55:8000/docauditai/',
uploadUrl: 'http://172.16.0.55:8000/admin/documents',
oauth: {
@@ -139,8 +136,7 @@ const configs: Record<string, ApiConfig> = {
// 测试环境
testing: {
baseUrl: 'http://nas.7bm.co:8873',
difyBaseUrl: 'http://nas.7bm.co:8000', // Dify对话服务使用外网地址
baseUrl: 'http://nas.7bm.co:8873', // FastAPI后端(包含/dify代理)
documentUrl: 'http://nas.7bm.co:8873/docauditai/',
uploadUrl: 'http://nas.7bm.co:8873/admin/documents',
oauth: {
@@ -154,10 +150,7 @@ const configs: Record<string, ApiConfig> = {
// 生产环境
production: {
// postgrest
baseUrl: 'http://10.79.97.17:8000',
// Dify对话服务使用外网地址
difyBaseUrl: 'http://nas.7bm.co:8000',
baseUrl: 'http://10.79.97.17:8000', // FastAPI后端(包含/dify代理)
// minio
documentUrl: 'http://10.76.244.156:9000/docauditai/',
// 文件上传
@@ -176,8 +169,7 @@ const configs: Record<string, ApiConfig> = {
// 备用配置 (可以根据需要添加更多环境)
staging: {
baseUrl: 'http://172.16.0.119:9000/admin',
difyBaseUrl: 'http://nas.7bm.co:8000', // Dify对话服务使用外网地址
baseUrl: 'http://172.16.0.119:9000/admin', // FastAPI后端(包含/dify代理)
documentUrl: 'http://nas.7bm.co:9000/docauditai/',
uploadUrl: 'http://172.16.0.119:8000/admin/documents/upload',
oauth: {
@@ -351,7 +343,6 @@ export const apiConfig = getCurrentConfig();
// 导出具体的配置项,方便使用
export const {
baseUrl: API_BASE_URL,
difyBaseUrl: DIFY_BASE_URL,
documentUrl: DOCUMENT_URL,
uploadUrl: UPLOAD_URL,
oauth: OAUTH_CONFIG