auto-git:
[change] src/App.jsx
This commit is contained in:
37
src/App.jsx
37
src/App.jsx
@@ -181,33 +181,6 @@ export default function App() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setAssistantMessageContent(sessionId, messageId, content, options = {}) {
|
|
||||||
const { removeIfEmpty = false } = options
|
|
||||||
|
|
||||||
setChatSessions(prevSessions =>
|
|
||||||
prevSessions.map(session => {
|
|
||||||
if (session.session_id !== sessionId) return session
|
|
||||||
|
|
||||||
const nextMessages = []
|
|
||||||
for (const message of session.messages || []) {
|
|
||||||
if (message.id !== messageId) {
|
|
||||||
nextMessages.push(message)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if (removeIfEmpty && !content) continue
|
|
||||||
nextMessages.push({ ...message, content })
|
|
||||||
}
|
|
||||||
|
|
||||||
return { ...session, messages: nextMessages }
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
function messageHasImageAttachments(message) {
|
|
||||||
return Array.isArray(message?.attachments) && message.attachments.some(attachmentIsImage)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function syncVisionModelFromChatModel(nextModel, options = {}) {
|
async function syncVisionModelFromChatModel(nextModel, options = {}) {
|
||||||
const { allowCapabilityLookup = true } = options
|
const { allowCapabilityLookup = true } = options
|
||||||
if (!nextModel) {
|
if (!nextModel) {
|
||||||
@@ -252,16 +225,6 @@ export default function App() {
|
|||||||
await syncVisionModelFromChatModel(nextModel)
|
await syncVisionModelFromChatModel(nextModel)
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildAttachmentTitleSeed(text, attachments = []) {
|
|
||||||
const trimmed = String(text || '').trim()
|
|
||||||
if (trimmed) {
|
|
||||||
return trimmed
|
|
||||||
}
|
|
||||||
const firstAttachment = Array.isArray(attachments) ? attachments[0] : null
|
|
||||||
const firstName = getAttachmentDisplayName(firstAttachment, '')
|
|
||||||
return firstName || 'Attachment'
|
|
||||||
}
|
|
||||||
|
|
||||||
function appendComposerFileAttachments(attachments) {
|
function appendComposerFileAttachments(attachments) {
|
||||||
if (!Array.isArray(attachments) || attachments.length === 0) {
|
if (!Array.isArray(attachments) || attachments.length === 0) {
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user