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
@@ -50,7 +50,7 @@ onTokenLiteral(async () => {
</div>
<div i-solar:danger-triangle-bold-duotone text-violet-500 />
</div>
<div v-if="sending" i-eos-icons:three-dots-loading />
<div v-if="sending && index === messages.length - 1" i-eos-icons:three-dots-loading />
<div
v-else class="markdown-content break-words text-violet-500" text="base <sm:xs"
v-html="process(message.content as string)"
@@ -65,7 +65,7 @@ onTokenLiteral(async () => {
<div>
<span text-xs text="primary-400/90 dark:primary-600/90" font-semibold class="inline <sm:hidden">{{ t('stage.chat.message.character-name.airi') }}</span>
</div>
<div v-if="sending" i-eos-icons:three-dots-loading />
<div v-if="sending && index === messages.length - 1" i-eos-icons:three-dots-loading />
<div v-else class="markdown-content break-words" text="base <sm:xs" v-html="process(message.content as string)" />
</div>
</div>
+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
}