feat(ai): 添加 AI 助手功能支持多模型对话

- 集成 OpenAI 兼容网关和 Ollama 原生 API 接口
- 新增 AI 测试页面支持流式对话和模型切换
- 配置开发环境同源反向代理解决浏览器 CORS 问题
- 添加环境变量配置支持 AI API 和 Ollama 接口设置
- 实现聊天历史记录、中断请求和参数调节功能
- 提供 Nginx 反向代理配置文档用于生产环境部署
This commit is contained in:
2026-02-27 22:15:41 +08:00
parent acec6570e1
commit b40326c3a9
9 changed files with 832 additions and 3 deletions

View File

@@ -16,6 +16,18 @@ export const MODULES_API_URL =
export const FILE_SERVER =
import.meta.env.VITE_FILE_SERVER || 'https://your-file-server.com';
// OpenAI-compatible gateway (Ollama/Open-WebUI/LiteLLM etc.)
export const AI_API_URL =
import.meta.env.VITE_AI_API_URL ||
// Prefer same-origin reverse proxy during local development to avoid CORS.
(import.meta.env.DEV ? '/ai-proxy' : 'https://ai-api.websoft.top/api/v1');
// Ollama native API endpoint (usually http://host:11434).
// Note: browsers cannot call http from an https site (mixed-content); prefer same-origin proxy.
export const OLLAMA_API_URL =
import.meta.env.VITE_OLLAMA_API_URL ||
(import.meta.env.DEV ? '/ollama-proxy' : 'http://47.119.165.234:11434');
/**
* 以下配置一般不需要修改
*/