diff --git a/pages/search/[id].vue b/pages/search/[id].vue index ea9034265f6df73d1427c6759e34209dbbe76dad..ac3f94d73e4b4122ca984b39a24b8f948b976f2b 100644 --- a/pages/search/[id].vue +++ b/pages/search/[id].vue @@ -271,6 +271,7 @@ function initSearchRecords (records) { } async function init () { const { data:responseData, error } = await useRequest(`/v1/chat/${state.id}/history`) + console.log('responseData:', responseData.value) if (error.value) return const { info, records } = responseData.value && responseData.value.data initSearchItemInfo(info) diff --git a/utils/fetchEventSource.js b/utils/fetchEventSource.js index 423f85ee708554126100d2f670546727ff217df1..baf4d3f60e62c29b72c788f3d92bae0f4271e481 100644 --- a/utils/fetchEventSource.js +++ b/utils/fetchEventSource.js @@ -1,12 +1,13 @@ import { fetchEventSource } from '@microsoft/fetch-event-source' const BASE_URL = 'https://gpu-pod656e861afe3d944d6b3ce77e-7862.node.inscode.run' export default (url, { onmessage, onerror, controller, params }) => { + const token = useCookie('token') fetchEventSource(`${BASE_URL}${url}`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': '*/*', - 'Authorization': window && window.localStorage && window.localStorage.getItem('token') + 'Authorization': token.value }, body: JSON.stringify(params), onmessage,