feat: Improve model selection and embedding

Refactor embedding models and their handling to improve performance and simplify the process.
Add a new model selection mechanism,  and enhance the UI for model selection, offering clearer and more user-friendly options for embedding models.
Refactor embeddings to use a common model for page assist and RAG, further improving performance and streamlining the workflow.
This commit is contained in:
n4ze3m
2024-10-12 23:32:00 +05:30
parent ba071ffeb1
commit 768ff2e555
14 changed files with 98 additions and 43 deletions

View File

@@ -133,6 +133,28 @@ export const getAllModels = async ({
}
}
export const getEmbeddingModels = async ({ returnEmpty }: {
returnEmpty?: boolean
}) => {
try {
const ollamaModels = await getAllModels({ returnEmpty })
const customModels = await ollamaFormatAllCustomModels()
return [
...ollamaModels.map((model) => {
return {
...model,
provider: "ollama"
}
}),
...customModels
]
} catch (e) {
console.error(e)
return []
}
}
export const deleteModel = async (model: string) => {
const baseUrl = await getOllamaURL()
const response = await fetcher(`${cleanUrl(baseUrl)}/api/delete`, {
@@ -341,7 +363,7 @@ export const saveForRag = async (
await setDefaultEmbeddingChunkSize(chunkSize)
await setDefaultEmbeddingChunkOverlap(overlap)
await setTotalFilePerKB(totalFilePerKB)
if(noOfRetrievedDocs) {
if (noOfRetrievedDocs) {
await setNoOfRetrievedDocs(noOfRetrievedDocs)
}
}