mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
refac
This commit is contained in:
parent
0ebe4f8f84
commit
3111d1bf61
1 changed files with 18 additions and 10 deletions
|
|
@ -1396,10 +1396,10 @@
|
|||
const submitPrompt = async (userPrompt, { _raw = false } = {}) => {
|
||||
console.log('submitPrompt', userPrompt, $chatId);
|
||||
|
||||
const messages = createMessagesList(history, history.currentId);
|
||||
const _selectedModels = selectedModels.map((modelId) =>
|
||||
$models.map((m) => m.id).includes(modelId) ? modelId : ''
|
||||
);
|
||||
|
||||
if (JSON.stringify(selectedModels) !== JSON.stringify(_selectedModels)) {
|
||||
selectedModels = _selectedModels;
|
||||
}
|
||||
|
|
@ -1413,15 +1413,6 @@
|
|||
return;
|
||||
}
|
||||
|
||||
if (messages.length != 0 && messages.at(-1).done != true) {
|
||||
// Response not done
|
||||
return;
|
||||
}
|
||||
if (messages.length != 0 && messages.at(-1).error && !messages.at(-1).content) {
|
||||
// Error in response
|
||||
toast.error($i18n.t(`Oops! There was an error in the previous response.`));
|
||||
return;
|
||||
}
|
||||
if (
|
||||
files.length > 0 &&
|
||||
files.filter((file) => file.type !== 'image' && file.status === 'uploading').length > 0
|
||||
|
|
@ -1431,6 +1422,7 @@
|
|||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
($config?.file?.max_count ?? null) !== null &&
|
||||
files.length + chatFiles.length > $config?.file?.max_count
|
||||
|
|
@ -1443,9 +1435,25 @@
|
|||
return;
|
||||
}
|
||||
|
||||
if (history?.currentId) {
|
||||
const lastMessage = history.messages[history.currentId];
|
||||
if (lastMessage.done != true) {
|
||||
// Response not done
|
||||
return;
|
||||
}
|
||||
|
||||
if (lastMessage.error && !lastMessage.content) {
|
||||
// Error in response
|
||||
toast.error($i18n.t(`Oops! There was an error in the previous response.`));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
messageInput?.setText('');
|
||||
prompt = '';
|
||||
|
||||
const messages = createMessagesList(history, history.currentId);
|
||||
|
||||
// Reset chat input textarea
|
||||
if (!($settings?.richTextInput ?? true)) {
|
||||
const chatInputElement = document.getElementById('chat-input');
|
||||
|
|
|
|||
Loading…
Reference in a new issue