Update index.ts

This commit is contained in:
Classic298 2025-06-21 13:56:09 +02:00 committed by GitHub
parent 4cd0119fd1
commit 05ffb9363f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,6 +4,8 @@ import { getTimeRange } from '$lib/utils';
export const createNewChat = async (token: string, chat: object) => { export const createNewChat = async (token: string, chat: object) => {
let error = null; let error = null;
const { folder_id, ...chatData } = chat as any;
const res = await fetch(`${WEBUI_API_BASE_URL}/chats/new`, { const res = await fetch(`${WEBUI_API_BASE_URL}/chats/new`, {
method: 'POST', method: 'POST',
headers: { headers: {
@ -12,7 +14,8 @@ export const createNewChat = async (token: string, chat: object) => {
authorization: `Bearer ${token}` authorization: `Bearer ${token}`
}, },
body: JSON.stringify({ body: JSON.stringify({
chat: chat chat: chatData,
...(folder_id && { folder_id: folder_id })
}) })
}) })
.then(async (res) => { .then(async (res) => {