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:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user