|
|
@@ -23,10 +23,14 @@ export async function sendChatMessageStream (
|
|
|
onError,
|
|
|
onClose
|
|
|
) {
|
|
|
+ // 获取 token
|
|
|
+ const token = localStorage.getItem('token');
|
|
|
return fetchEventSource(import.meta.env.VITE_BASE_URL + `/bjdxWeb/ai/dialogue-send-stream`, {
|
|
|
method: 'post',
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json',
|
|
|
+ // 添加 token 到请求头
|
|
|
+ ...(token ? { 'Authorization': `Bearer ${token}` } : {})
|
|
|
// Authorization: `Bearer b55bd67fba3e4bb49608168f078fde63`
|
|
|
},
|
|
|
openWhenHidden: true,
|