Update model checks in App.jsx
This commit is contained in:
17
src/App.jsx
17
src/App.jsx
@@ -1901,7 +1901,7 @@ async function regenerateFromIndex(index, overrideUserText = null) {
|
|||||||
if (activeSidebarMode !== 'chats' || !hasFilePayload(event)) return
|
if (activeSidebarMode !== 'chats' || !hasFilePayload(event)) return
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
imageDragDepthRef.current += 1
|
imageDragDepthRef.current += 1
|
||||||
if (selectedModelSupportsVision && eventHasImageFiles(event)) {
|
if (selectedVisionModelSupportsVision && eventHasImageFiles(event)) {
|
||||||
setIsChatDragActive(true)
|
setIsChatDragActive(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1909,8 +1909,8 @@ async function regenerateFromIndex(index, overrideUserText = null) {
|
|||||||
const handleChatDragOver = (event) => {
|
const handleChatDragOver = (event) => {
|
||||||
if (activeSidebarMode !== 'chats' || !hasFilePayload(event)) return
|
if (activeSidebarMode !== 'chats' || !hasFilePayload(event)) return
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.dataTransfer.dropEffect = selectedModelSupportsVision ? 'copy' : 'none'
|
event.dataTransfer.dropEffect = selectedVisionModelSupportsVision ? 'copy' : 'none'
|
||||||
if (selectedModelSupportsVision && eventHasImageFiles(event) && !isChatDragActive) {
|
if (selectedVisionModelSupportsVision && eventHasImageFiles(event) && !isChatDragActive) {
|
||||||
setIsChatDragActive(true)
|
setIsChatDragActive(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1928,7 +1928,7 @@ async function regenerateFromIndex(index, overrideUserText = null) {
|
|||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
imageDragDepthRef.current = 0
|
imageDragDepthRef.current = 0
|
||||||
setIsChatDragActive(false)
|
setIsChatDragActive(false)
|
||||||
if (!selectedModelSupportsVision) {
|
if (!selectedVisionModelSupportsVision) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
await appendComposerImageFiles(event.dataTransfer?.files)
|
await appendComposerImageFiles(event.dataTransfer?.files)
|
||||||
@@ -1939,8 +1939,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 && !selectedModelSupportsVision) {
|
if (composerAttachments.length > 0 && !selectedVisionModelSupportsVision) {
|
||||||
window.alert('The selected model does not support image inputs.')
|
window.alert('The selected vision model does not support image inputs.')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1957,6 +1957,7 @@ async function sendMessage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const outgoingAttachments = composerAttachments.map(({ id, ...attachment }) => ({ ...attachment }))
|
const outgoingAttachments = composerAttachments.map(({ id, ...attachment }) => ({ ...attachment }))
|
||||||
|
const requestModel = resolveChatRequestModel(outgoingAttachments)
|
||||||
const userMsg = {
|
const userMsg = {
|
||||||
role: 'user',
|
role: 'user',
|
||||||
content: trimmedInput,
|
content: trimmedInput,
|
||||||
@@ -2066,7 +2067,7 @@ async function sendMessage() {
|
|||||||
signal: requestController.signal,
|
signal: requestController.signal,
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
session_id: targetSessionId,
|
session_id: targetSessionId,
|
||||||
model,
|
model: requestModel,
|
||||||
message: userMsg.content,
|
message: userMsg.content,
|
||||||
enriched_message: userMsg.content && contextBlocks.length > 0 ? enrichedPrompt : null,
|
enriched_message: userMsg.content && contextBlocks.length > 0 ? enrichedPrompt : null,
|
||||||
stream: true,
|
stream: true,
|
||||||
@@ -2130,7 +2131,7 @@ async function sendMessage() {
|
|||||||
signal: requestController.signal,
|
signal: requestController.signal,
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
session_id: targetSessionId,
|
session_id: targetSessionId,
|
||||||
model,
|
model: requestModel,
|
||||||
message: userMsg.content,
|
message: userMsg.content,
|
||||||
enriched_message: userMsg.content && contextBlocks.length > 0 ? enrichedPrompt : null,
|
enriched_message: userMsg.content && contextBlocks.length > 0 ? enrichedPrompt : null,
|
||||||
stream: false,
|
stream: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user