feat: ability to update knowledge base default file limit

This commit is contained in:
n4ze3m
2024-07-21 20:13:37 +05:30
parent 943813f759
commit af09c8eed6
14 changed files with 101 additions and 33 deletions

View File

@@ -98,3 +98,14 @@ export const getOpenOnRightClick = async (): Promise<string> => {
export const setOpenOnRightClick = async (option: "webUI" | "sidePanel"): Promise<void> => {
await storage.set("openOnRightClick", option);
};
export const getTotalFilePerKB = async (): Promise<number> => {
const totalFilePerKB = await storage.get<number>("totalFilePerKB");
return totalFilePerKB || 10;
}
export const setTotalFilePerKB = async (totalFilePerKB: number): Promise<void> => {
await storage.set("totalFilePerKB", totalFilePerKB);
};

View File

@@ -2,6 +2,7 @@ import { Storage } from "@plasmohq/storage"
import { cleanUrl } from "../libs/clean-url"
import { urlRewriteRuntime } from "../libs/runtime"
import { getChromeAIModel } from "./chrome"
import { setTotalFilePerKB } from "./app"
const storage = new Storage()
@@ -324,11 +325,13 @@ export const setDefaultEmbeddingChunkOverlap = async (overlap: number) => {
export const saveForRag = async (
model: string,
chunkSize: number,
overlap: number
overlap: number,
totalFilePerKB: number
) => {
await setDefaultEmbeddingModelForRag(model)
await setDefaultEmbeddingChunkSize(chunkSize)
await setDefaultEmbeddingChunkOverlap(overlap)
await setTotalFilePerKB(totalFilePerKB)
}
export const getWebSearchPrompt = async () => {