mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-04 13:22:41 +02:00
Merge pull request #876 from aleksas/fix/upstream-extension-runtime-dev
Fix/upstream extension runtime dev
This commit is contained in:
commit
54e56e1b9a
2 changed files with 5 additions and 9 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,11 +3,12 @@ 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";
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
global.Node = {
|
globalThis.Node = {
|
||||||
ELEMENT_NODE: 1,
|
ELEMENT_NODE: 1,
|
||||||
ATTRIBUTE_NODE: 2,
|
ATTRIBUTE_NODE: 2,
|
||||||
TEXT_NODE: 3,
|
TEXT_NODE: 3,
|
||||||
|
|
@ -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