mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
➿ fix: createFileSearchTool to return tuples for error messages (#10547)
This commit is contained in:
parent
1b2f1ff09b
commit
49c57b27fd
2 changed files with 203 additions and 57 deletions
|
|
@ -78,11 +78,11 @@ const createFileSearchTool = async ({ userId, files, entity_id, fileCitations =
|
|||
return tool(
|
||||
async ({ query }) => {
|
||||
if (files.length === 0) {
|
||||
return 'No files to search. Instruct the user to add files for the search.';
|
||||
return ['No files to search. Instruct the user to add files for the search.', undefined];
|
||||
}
|
||||
const jwtToken = generateShortLivedToken(userId);
|
||||
if (!jwtToken) {
|
||||
return 'There was an error authenticating the file search request.';
|
||||
return ['There was an error authenticating the file search request.', undefined];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -122,7 +122,7 @@ const createFileSearchTool = async ({ userId, files, entity_id, fileCitations =
|
|||
const validResults = results.filter((result) => result !== null);
|
||||
|
||||
if (validResults.length === 0) {
|
||||
return 'No results found or errors occurred while searching the files.';
|
||||
return ['No results found or errors occurred while searching the files.', undefined];
|
||||
}
|
||||
|
||||
const formattedResults = validResults
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue