Fix: handle individual rag config properly

This commit is contained in:
weberm1 2025-05-09 22:47:11 +02:00
parent b1937a9dfa
commit 8a3927a528
3 changed files with 10 additions and 5 deletions

View File

@ -1,9 +1,11 @@
import { WEBUI_API_BASE_URL } from '$lib/constants';
export const uploadFile = async (token: string, file: File, knowledge_id: string) => {
export const uploadFile = async (token: string, file: File, knowledge_id?: string) => {
const data = new FormData();
data.append('file', file);
data.append('knowledge_id', knowledge_id);
if (knowledge_id) {
data.append('knowledge_id', knowledge_id);
}
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/files/`, {

View File

@ -17,10 +17,10 @@ export const createNewKnowledge = async (
authorization: `Bearer ${token}`
},
body: JSON.stringify({
form_data: {name: name,
name: name,
description: description,
access_control: accessControl},
rag_data: rag_config
access_control: accessControl,
rag_config: rag_config
})
})
.then(async (res) => {

View File

@ -200,6 +200,7 @@ type EmbeddingModelUpdateForm = {
embedding_engine: string;
embedding_model: string;
embedding_batch_size?: number;
collection_name?: string;
};
export const updateEmbeddingConfig = async (token: string, payload: EmbeddingModelUpdateForm) => {
@ -264,6 +265,8 @@ export const getRerankingConfig = async (token: string, collectionForm?: Collect
type RerankingModelUpdateForm = {
reranking_model: string;
collection_name?: string;
};
export const updateRerankingConfig = async (token: string, payload: RerankingModelUpdateForm) => {