fix(extension): use custom backend url for uploads

This commit is contained in:
Aleksas Pielikis 2026-03-12 16:12:13 +02:00
parent a818c3b4d0
commit 594d2b1410
2 changed files with 4 additions and 8 deletions

View file

@ -2,6 +2,7 @@ import type { PlasmoMessaging } from "@plasmohq/messaging";
import { Storage } from "@plasmohq/storage";
import { emptyArr, webhistoryToLangChainDocument } from "~utils/commons";
import { buildBackendUrl } from "~utils/backend-url";
const clearMemory = async () => {
try {
@ -130,10 +131,7 @@ const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
body: JSON.stringify(toSend),
};
const response = await fetch(
`${process.env.PLASMO_PUBLIC_BACKEND_URL}/api/v1/documents`,
requestOptions
);
const response = await fetch(await buildBackendUrl("/api/v1/documents"), requestOptions);
const resp = await response.json();
if (resp) {
await clearMemory();

View file

@ -3,6 +3,7 @@ import type { PlasmoMessaging } from "@plasmohq/messaging";
import { Storage } from "@plasmohq/storage";
import { convertHtmlToMarkdown } from "dom-to-semantic-markdown";
import { DOMParser } from "linkedom";
import { buildBackendUrl } from "~utils/backend-url";
import { getRenderedHtml, webhistoryToLangChainDocument } from "~utils/commons";
import type { WebHistory } from "~utils/interfaces";
@ -122,10 +123,7 @@ const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
body: JSON.stringify(toSend),
};
const response = await fetch(
`${process.env.PLASMO_PUBLIC_BACKEND_URL}/api/v1/documents`,
requestOptions
);
const response = await fetch(await buildBackendUrl("/api/v1/documents"), requestOptions);
const resp = await response.json();
if (resp) {
res.send({