mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-03 21:29:08 +00:00
Automatically generate titles for conversations from history
This commit is contained in:
@@ -319,6 +319,23 @@ export async function packageFilesForUpload(files: FileList): Promise<FormData>
|
||||
return formData;
|
||||
}
|
||||
|
||||
export function generateNewTitle(conversationId: string, setTitle: (title: string) => void) {
|
||||
fetch(`/api/chat/title?conversation_id=${conversationId}`, {
|
||||
method: "POST",
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res.ok) throw new Error(`Failed to call API with error ${res.statusText}`);
|
||||
return res.json();
|
||||
})
|
||||
.then((data) => {
|
||||
setTitle(data.title);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
return;
|
||||
});
|
||||
}
|
||||
|
||||
export function uploadDataForIndexing(
|
||||
files: FileList,
|
||||
setWarning: (warning: string) => void,
|
||||
|
||||
Reference in New Issue
Block a user