feat: 前端后端地址改为 NEXT_PUBLIC_API_BASE 可配置,补全 .env.example
- 部署到云服务器后浏览器不能再连 localhost:8000,API_BASE 现可经 NEXT_PUBLIC_API_BASE 指定(未设置时保持本地默认值,行为不变) - .env.example 补全数据库/监听端口/各 provider/向量与重排的完整变量 Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -89,7 +89,10 @@ export interface McpToolInfo {
|
||||
input_schema?: unknown;
|
||||
}
|
||||
|
||||
const API_BASE = "http://localhost:8000/api";
|
||||
// 部署时通过 NEXT_PUBLIC_API_BASE 指定后端地址(如 https://bookmate.example.com/api);
|
||||
// 未设置时保持本地开发默认值 http://localhost:8000/api
|
||||
const API_BASE =
|
||||
(process.env.NEXT_PUBLIC_API_BASE || "http://localhost:8000/api").replace(/\/+$/, "");
|
||||
|
||||
async function request<T>(path: string, options?: RequestInit): Promise<T> {
|
||||
const res = await fetch(`${API_BASE}${path}`, {
|
||||
|
||||
Reference in New Issue
Block a user