Skip to content
Snippets Groups Projects
Commit 4af9b9d5 authored by timothycarambat's avatar timothycarambat
Browse files

fix: relative/absolute url patch for vector count

connect #516
parent dfd03e33
No related branches found
No related tags found
No related merge requests found
import { API_BASE, AUTH_TIMESTAMP } from "@/utils/constants"; import { API_BASE, AUTH_TIMESTAMP, fullApiUrl } from "@/utils/constants";
import { baseHeaders } from "@/utils/request"; import { baseHeaders } from "@/utils/request";
import DataConnector from "./dataConnector"; import DataConnector from "./dataConnector";
...@@ -10,7 +10,7 @@ const System = { ...@@ -10,7 +10,7 @@ const System = {
.catch(() => false); .catch(() => false);
}, },
totalIndexes: async function (slug = null) { 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)); if (!!slug) url.searchParams.append("slug", encodeURIComponent(slug));
return await fetch(url.toString(), { return await fetch(url.toString(), {
headers: baseHeaders(), headers: baseHeaders(),
......
...@@ -7,3 +7,8 @@ export const COMPLETE_QUESTIONNAIRE = "anythingllm_completed_questionnaire"; ...@@ -7,3 +7,8 @@ export const COMPLETE_QUESTIONNAIRE = "anythingllm_completed_questionnaire";
export const USER_BACKGROUND_COLOR = "bg-historical-msg-user"; export const USER_BACKGROUND_COLOR = "bg-historical-msg-user";
export const AI_BACKGROUND_COLOR = "bg-historical-msg-system"; export const AI_BACKGROUND_COLOR = "bg-historical-msg-system";
export function fullApiUrl() {
if (API_BASE !== "/api") return API_BASE;
return `${window.location.origin}/api`;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment