fix(stage-web|stage-ui): should not loading (#107)

This commit is contained in:
Neko Ayaka
2025-04-13 22:47:12 +08:00
parent e62f8aa47e
commit 6b3ec95d4b
2 changed files with 7 additions and 11 deletions
+5 -9
View File
@@ -94,15 +94,7 @@ export const useChatStore = defineStore('chat', () => {
await hook(sendingMessage)
}
const headersArray = options.providerConfig?.headers as { key: string, value: string }[] | undefined
const headers = headersArray
?.filter(h => h.key && h.value)
.reduce((acc, curr) => {
acc[curr.key] = curr.value
return acc
}, {} as Record<string, string>)
const headers = (options.providerConfig?.headers || {}) as Record<string, string>
const res = await stream(options.model, options.chatProvider, newMessages as Message[], { headers })
for (const hook of onAfterSendHooks.value) {
@@ -144,6 +136,10 @@ export const useChatStore = defineStore('chat', () => {
// eslint-disable-next-line no-console
console.debug('LLM output:', fullText)
}
catch (error) {
console.error('Error sending message:', error)
throw error
}
finally {
sending.value = false
}