config.ts 571 B

12345678910111213
  1. // 统一的 API 配置
  2. // 使用相对路径,自动适配当前域名(无论是否绑定域名都能工作)
  3. // 前端和后端通过 Nginx 代理在同一域名下,所以使用相对路径即可
  4. export const API_BASE_URL = "";
  5. /** 知识库/文档/导入等接口需带当前用户 ID,供后端校验「是否开放知识库」开关 */
  6. export function getAgentHeaders(): Record<string, string> {
  7. if (typeof window === "undefined") return {};
  8. const id = window.localStorage.getItem("agent_user_id");
  9. if (!id) return {};
  10. return { "X-User-Id": id };
  11. }