Update attachment handling in sendMessage function
This commit is contained in:
@@ -2385,8 +2385,8 @@ async function regenerateFromIndex(index, overrideUserText = null) {
|
|||||||
async function sendMessage() {
|
async function sendMessage() {
|
||||||
const trimmedInput = input.trim()
|
const trimmedInput = input.trim()
|
||||||
if (isSending || (!trimmedInput && composerAttachments.length === 0) || !model) return
|
if (isSending || (!trimmedInput && composerAttachments.length === 0) || !model) return
|
||||||
if (composerAttachments.length > 0 && !selectedVisionModelSupportsVision) {
|
if (composerAttachments.some(attachmentIsImage) && !canAttachImages) {
|
||||||
window.alert('The selected vision model does not support image inputs.')
|
window.alert(imageAttachmentUnavailableReason)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2403,13 +2403,15 @@ async function sendMessage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const outgoingAttachments = composerAttachments.map(({ id, ...attachment }) => ({ ...attachment }))
|
const outgoingAttachments = composerAttachments.map(({ id, ...attachment }) => ({ ...attachment }))
|
||||||
const requestModel = resolveChatRequestModel(outgoingAttachments)
|
const composerSnapshot = input
|
||||||
|
const attachmentSnapshot = composerAttachments.map(attachment => ({ ...attachment }))
|
||||||
const userMsg = {
|
const userMsg = {
|
||||||
role: 'user',
|
role: 'user',
|
||||||
content: trimmedInput,
|
content: trimmedInput,
|
||||||
attachments: outgoingAttachments,
|
attachments: outgoingAttachments,
|
||||||
id: `msg-${Date.now()}-${Math.random()}`
|
id: `msg-${Date.now()}-${Math.random()}`
|
||||||
}
|
}
|
||||||
|
setIsAttachmentMenuOpen(false)
|
||||||
justSentMessage.current = true
|
justSentMessage.current = true
|
||||||
lastSentSessionRef.current = targetSessionId
|
lastSentSessionRef.current = targetSessionId
|
||||||
setUserScrolledUp(targetSessionId, false)
|
setUserScrolledUp(targetSessionId, false)
|
||||||
|
|||||||
Reference in New Issue
Block a user