fix: relative/absolute url patch for vector count

connect #516
This commit is contained in:
timothycarambat 2024-01-10 19:27:39 -08:00
parent dfd03e332c
commit 4af9b9d5cc
2 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import { API_BASE, AUTH_TIMESTAMP } from "@/utils/constants";
import { API_BASE, AUTH_TIMESTAMP, fullApiUrl } from "@/utils/constants";
import { baseHeaders } from "@/utils/request";
import DataConnector from "./dataConnector";
@ -10,7 +10,7 @@ const System = {
.catch(() => false);
},
totalIndexes: async function (slug = null) {
const url = new URL(`${API_BASE}/system/system-vectors`);
const url = new URL(`${fullApiUrl()}/system/system-vectors`);
if (!!slug) url.searchParams.append("slug", encodeURIComponent(slug));
return await fetch(url.toString(), {
headers: baseHeaders(),

View File

@ -7,3 +7,8 @@ export const COMPLETE_QUESTIONNAIRE = "anythingllm_completed_questionnaire";
export const USER_BACKGROUND_COLOR = "bg-historical-msg-user";
export const AI_BACKGROUND_COLOR = "bg-historical-msg-system";
export function fullApiUrl() {
if (API_BASE !== "/api") return API_BASE;
return `${window.location.origin}/api`;
}