mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 09:20:15 +01:00
fix: Improve content type mismatch handling in useStepHandler
- Enhanced the condition for detecting content type mismatches to include additional checks, ensuring more robust validation of content types before processing updates.
This commit is contained in:
parent
08052844cf
commit
b8fa8eb316
1 changed files with 7 additions and 2 deletions
|
|
@ -101,8 +101,13 @@ export default function useStepHandler({
|
||||||
}
|
}
|
||||||
/** Prevent overwriting an existing content part with a different type */
|
/** Prevent overwriting an existing content part with a different type */
|
||||||
const existingType = (updatedContent[index]?.type as string | undefined) ?? '';
|
const existingType = (updatedContent[index]?.type as string | undefined) ?? '';
|
||||||
if (existingType && !contentType.startsWith(existingType)) {
|
if (
|
||||||
console.warn('Content type mismatch');
|
existingType &&
|
||||||
|
existingType !== contentType &&
|
||||||
|
!contentType.startsWith(existingType) &&
|
||||||
|
!existingType.startsWith(contentType)
|
||||||
|
) {
|
||||||
|
console.warn('Content type mismatch', { existingType, contentType, index });
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue