forked from ruc-datalab/DeepAnalyze
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.ts
More file actions
66 lines (56 loc) · 2.09 KB
/
Copy pathconfig.ts
File metadata and controls
66 lines (56 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// API配置
export const API_CONFIG = {
// 后端API基础地址
BACKEND_BASE_URL:
process.env.NEXT_PUBLIC_BACKEND_URL || "http://localhost:8200",
// 静态文件服务基础地址(前端可配置下载/预览所使用的文件基址)
// 例如:http://<server-ip>:8100 或 https://cdn.example.com
FILE_SERVER_BASE:
process.env.NEXT_PUBLIC_FILE_SERVER_BASE || "http://localhost:8100",
// 模拟AI API地址
AI_API_BASE_URL:
process.env.NEXT_PUBLIC_AI_API_URL || "http://localhost:8000",
// WebSocket地址
WEBSOCKET_URL: process.env.NEXT_PUBLIC_WEBSOCKET_URL || "ws://localhost:8001",
// API端点
ENDPOINTS: {
// 聊天
CHAT_COMPLETIONS: "/chat/completions",
// 文件管理
WORKSPACE_FILES: "/workspace/files",
WORKSPACE_TREE: "/workspace/tree",
WORKSPACE_UPLOAD: "/workspace/upload",
WORKSPACE_CLEAR: "/workspace/clear",
WORKSPACE_DELETE_FILE: "/workspace/file",
WORKSPACE_UPLOAD_TO: "/workspace/upload-to",
WORKSPACE_DELETE_DIR: "/workspace/dir",
// 代码执行
EXECUTE_CODE: "/execute",
// 导出报告
EXPORT_REPORT: "/export/report",
},
};
// 构建完整的API URL
export const buildApiUrl = (
endpoint: string,
baseUrl: string = API_CONFIG.BACKEND_BASE_URL
) => {
return `${baseUrl}${endpoint}`;
};
// 预定义的API URLs
export const API_URLS = {
// 后端服务
WORKSPACE_FILES: buildApiUrl(API_CONFIG.ENDPOINTS.WORKSPACE_FILES),
WORKSPACE_TREE: buildApiUrl(API_CONFIG.ENDPOINTS.WORKSPACE_TREE),
WORKSPACE_UPLOAD: buildApiUrl(API_CONFIG.ENDPOINTS.WORKSPACE_UPLOAD),
WORKSPACE_CLEAR: buildApiUrl(API_CONFIG.ENDPOINTS.WORKSPACE_CLEAR),
WORKSPACE_DELETE_FILE: buildApiUrl(
API_CONFIG.ENDPOINTS.WORKSPACE_DELETE_FILE
),
WORKSPACE_UPLOAD_TO: buildApiUrl(API_CONFIG.ENDPOINTS.WORKSPACE_UPLOAD_TO),
WORKSPACE_DELETE_DIR: buildApiUrl(API_CONFIG.ENDPOINTS.WORKSPACE_DELETE_DIR),
EXECUTE_CODE: buildApiUrl(API_CONFIG.ENDPOINTS.EXECUTE_CODE),
EXPORT_REPORT: buildApiUrl(API_CONFIG.ENDPOINTS.EXPORT_REPORT),
// AI服务
CHAT_COMPLETIONS: buildApiUrl(API_CONFIG.ENDPOINTS.CHAT_COMPLETIONS),
};