mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-21 18:55:16 +02:00
fix(extension): use custom backend url for uploads
This commit is contained in:
parent
a818c3b4d0
commit
594d2b1410
2 changed files with 4 additions and 8 deletions
|
|
@ -2,6 +2,7 @@ import type { PlasmoMessaging } from "@plasmohq/messaging";
|
||||||
import { Storage } from "@plasmohq/storage";
|
import { Storage } from "@plasmohq/storage";
|
||||||
|
|
||||||
import { emptyArr, webhistoryToLangChainDocument } from "~utils/commons";
|
import { emptyArr, webhistoryToLangChainDocument } from "~utils/commons";
|
||||||
|
import { buildBackendUrl } from "~utils/backend-url";
|
||||||
|
|
||||||
const clearMemory = async () => {
|
const clearMemory = async () => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -130,10 +131,7 @@ const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
||||||
body: JSON.stringify(toSend),
|
body: JSON.stringify(toSend),
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await fetch(
|
const response = await fetch(await buildBackendUrl("/api/v1/documents"), requestOptions);
|
||||||
`${process.env.PLASMO_PUBLIC_BACKEND_URL}/api/v1/documents`,
|
|
||||||
requestOptions
|
|
||||||
);
|
|
||||||
const resp = await response.json();
|
const resp = await response.json();
|
||||||
if (resp) {
|
if (resp) {
|
||||||
await clearMemory();
|
await clearMemory();
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import type { PlasmoMessaging } from "@plasmohq/messaging";
|
||||||
import { Storage } from "@plasmohq/storage";
|
import { Storage } from "@plasmohq/storage";
|
||||||
import { convertHtmlToMarkdown } from "dom-to-semantic-markdown";
|
import { convertHtmlToMarkdown } from "dom-to-semantic-markdown";
|
||||||
import { DOMParser } from "linkedom";
|
import { DOMParser } from "linkedom";
|
||||||
|
import { buildBackendUrl } from "~utils/backend-url";
|
||||||
import { getRenderedHtml, webhistoryToLangChainDocument } from "~utils/commons";
|
import { getRenderedHtml, webhistoryToLangChainDocument } from "~utils/commons";
|
||||||
import type { WebHistory } from "~utils/interfaces";
|
import type { WebHistory } from "~utils/interfaces";
|
||||||
|
|
||||||
|
|
@ -122,10 +123,7 @@ const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
||||||
body: JSON.stringify(toSend),
|
body: JSON.stringify(toSend),
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await fetch(
|
const response = await fetch(await buildBackendUrl("/api/v1/documents"), requestOptions);
|
||||||
`${process.env.PLASMO_PUBLIC_BACKEND_URL}/api/v1/documents`,
|
|
||||||
requestOptions
|
|
||||||
);
|
|
||||||
const resp = await response.json();
|
const resp = await response.json();
|
||||||
if (resp) {
|
if (resp) {
|
||||||
res.send({
|
res.send({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue