feat:回答流式输出
This commit is contained in:
parent
2c9da6bf6d
commit
b128b3c2ac
|
|
@ -92,8 +92,9 @@ export function useChat() {
|
|||
data_url: a.data_url,
|
||||
}))
|
||||
messages.value.push({ role: 'user', text: trimmed, attachments: localAttachments, created_at: now })
|
||||
const assistant = { role: 'assistant', text: '', references: [], created_at: now }
|
||||
messages.value.push(assistant)
|
||||
messages.value.push({ role: 'assistant', text: '', references: [], created_at: now })
|
||||
// 拿数组里的响应式代理,直接改原始对象绕过代理不会触发更新,SSE delta 会一直不动
|
||||
const assistant = messages.value[messages.value.length - 1]
|
||||
|
||||
streaming.value = true
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,13 @@ import { computed, ref } from 'vue'
|
|||
import { notify } from '@/utils/notify'
|
||||
|
||||
export const useAppStore = defineStore('app', () => {
|
||||
const defaultApiBase = import.meta.env.DEV ? 'http://127.0.0.1:8775' : window.location.origin
|
||||
const apiBase = ref(localStorage.getItem('financeAiApiBase') || defaultApiBase)
|
||||
const defaultApiBase = import.meta.env.DEV ? '' : window.location.origin
|
||||
const storedApiBase = localStorage.getItem('financeAiApiBase')
|
||||
const legacyDevBases = new Set(['http://127.0.0.1:8775', 'https://127.0.0.1:8775'])
|
||||
const initialApiBase = import.meta.env.DEV && legacyDevBases.has(storedApiBase)
|
||||
? defaultApiBase
|
||||
: (storedApiBase ?? defaultApiBase)
|
||||
const apiBase = ref(initialApiBase)
|
||||
const token = ref(localStorage.getItem('financeAiToken') || '')
|
||||
const currentUser = ref(null)
|
||||
const healthy = ref(false)
|
||||
|
|
|
|||
|
|
@ -14,9 +14,14 @@ export default defineConfig({
|
|||
port: 5173,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://127.0.0.1:8775',
|
||||
target: 'https://127.0.0.1:8775',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
secure: false,
|
||||
},
|
||||
'/health': {
|
||||
target: 'https://127.0.0.1:8775',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue