提交 c2de8b24 编写于 作者: D DebugIsFalse

fix: token

上级 6a8bc852
...@@ -271,6 +271,7 @@ function initSearchRecords (records) { ...@@ -271,6 +271,7 @@ function initSearchRecords (records) {
} }
async function init () { async function init () {
const { data:responseData, error } = await useRequest(`/v1/chat/${state.id}/history`) const { data:responseData, error } = await useRequest(`/v1/chat/${state.id}/history`)
console.log('responseData:', responseData.value)
if (error.value) return if (error.value) return
const { info, records } = responseData.value && responseData.value.data const { info, records } = responseData.value && responseData.value.data
initSearchItemInfo(info) initSearchItemInfo(info)
......
import { fetchEventSource } from '@microsoft/fetch-event-source' import { fetchEventSource } from '@microsoft/fetch-event-source'
const BASE_URL = 'https://gpu-pod656e861afe3d944d6b3ce77e-7862.node.inscode.run' const BASE_URL = 'https://gpu-pod656e861afe3d944d6b3ce77e-7862.node.inscode.run'
export default (url, { onmessage, onerror, controller, params }) => { export default (url, { onmessage, onerror, controller, params }) => {
const token = useCookie('token')
fetchEventSource(`${BASE_URL}${url}`, { fetchEventSource(`${BASE_URL}${url}`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Accept': '*/*', 'Accept': '*/*',
'Authorization': window && window.localStorage && window.localStorage.getItem('token') 'Authorization': token.value
}, },
body: JSON.stringify(params), body: JSON.stringify(params),
onmessage, onmessage,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册