mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-23 03:40:14 +01:00
🐛 fix: Prevent Empty File Uploads & Assistants Fixes (#2611)
* chore: update default models for openai/assistants * fix: allows assistants models fetching * change default models order, ensure assistant_id is defined if intended * fix: prevent empty files from being uploaded
This commit is contained in:
parent
a0288f1c5c
commit
c8baceac76
6 changed files with 24 additions and 7 deletions
|
|
@ -163,6 +163,10 @@ const useFileHandling = (params?: UseFileHandling) => {
|
|||
const validateFiles = (fileList: File[]) => {
|
||||
const existingFiles = Array.from(files.values());
|
||||
const incomingTotalSize = fileList.reduce((total, file) => total + file.size, 0);
|
||||
if (incomingTotalSize === 0) {
|
||||
setError('Empty files are not allowed.');
|
||||
return false;
|
||||
}
|
||||
const currentTotalSize = existingFiles.reduce((total, file) => total + file.size, 0);
|
||||
|
||||
if (fileList.length + files.size > fileLimit) {
|
||||
|
|
|
|||
|
|
@ -64,6 +64,11 @@ const buildDefaultConvo = ({
|
|||
endpoint,
|
||||
};
|
||||
|
||||
// Ensures assistant_id is always defined
|
||||
if (endpoint === EModelEndpoint.assistants && !defaultConvo.assistant_id && convo.assistant_id) {
|
||||
defaultConvo.assistant_id = convo.assistant_id;
|
||||
}
|
||||
|
||||
defaultConvo.tools = lastConversationSetup?.tools ?? lastSelectedTools ?? defaultConvo.tools;
|
||||
defaultConvo.jailbreak = jailbreak ?? defaultConvo.jailbreak;
|
||||
defaultConvo.toneStyle = toneStyle ?? defaultConvo.toneStyle;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue