mirror of
https://github.com/open-webui/open-webui
synced 2025-05-12 01:27:13 +00:00
refac
This commit is contained in:
parent
2be9e55545
commit
64fe2de962
@ -65,11 +65,9 @@
|
|||||||
import { getAndUpdateUserLocation, getUserSettings } from '$lib/apis/users';
|
import { getAndUpdateUserLocation, getUserSettings } from '$lib/apis/users';
|
||||||
import {
|
import {
|
||||||
chatCompleted,
|
chatCompleted,
|
||||||
generateTitle,
|
|
||||||
generateQueries,
|
generateQueries,
|
||||||
chatAction,
|
chatAction,
|
||||||
generateMoACompletion,
|
generateMoACompletion,
|
||||||
generateTags,
|
|
||||||
stopTask
|
stopTask
|
||||||
} from '$lib/apis';
|
} from '$lib/apis';
|
||||||
|
|
||||||
@ -1492,14 +1490,8 @@
|
|||||||
taskId = res.task_id;
|
taskId = res.task_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait until history/message have been updated
|
|
||||||
await tick();
|
await tick();
|
||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
|
|
||||||
// if ($settings?.autoTags ?? true) {
|
|
||||||
// await setChatTags(messages);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOpenAIError = async (error, responseMessage) => {
|
const handleOpenAIError = async (error, responseMessage) => {
|
||||||
@ -1667,40 +1659,6 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const setChatTags = async (messages) => {
|
|
||||||
if (!$temporaryChatEnabled) {
|
|
||||||
const currentTags = await getTagsById(localStorage.token, $chatId);
|
|
||||||
if (currentTags.length > 0) {
|
|
||||||
const res = await deleteTagsById(localStorage.token, $chatId);
|
|
||||||
if (res) {
|
|
||||||
allTags.set(await getAllTags(localStorage.token));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const lastMessage = messages.at(-1);
|
|
||||||
const modelId = selectedModels[0];
|
|
||||||
|
|
||||||
let generatedTags = await generateTags(localStorage.token, modelId, messages, $chatId).catch(
|
|
||||||
(error) => {
|
|
||||||
console.error(error);
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
generatedTags = generatedTags.filter(
|
|
||||||
(tag) => !currentTags.find((t) => t.id === tag.replaceAll(' ', '_').toLowerCase())
|
|
||||||
);
|
|
||||||
console.log(generatedTags);
|
|
||||||
|
|
||||||
for (const tag of generatedTags) {
|
|
||||||
await addTagById(localStorage.token, $chatId, tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
chat = await getChatById(localStorage.token, $chatId);
|
|
||||||
allTags.set(await getAllTags(localStorage.token));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getWebSearchResults = async (
|
const getWebSearchResults = async (
|
||||||
model: string,
|
model: string,
|
||||||
parentId: string,
|
parentId: string,
|
||||||
|
Loading…
Reference in New Issue
Block a user