|
@@ -4,6 +4,7 @@
|
|
|
*/
|
|
*/
|
|
|
import request from './authRequest'
|
|
import request from './authRequest'
|
|
|
import { buildApiUrl, REPORT_API_PREFIX } from './apiConfig'
|
|
import { buildApiUrl, REPORT_API_PREFIX } from './apiConfig'
|
|
|
|
|
+import { getToken } from './auth'
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 用户登录
|
|
* 用户登录
|
|
@@ -80,11 +81,17 @@ export function getLoginLogs(params = {}) {
|
|
|
*/
|
|
*/
|
|
|
export async function stopSSEStream(userId, aiConversationId) {
|
|
export async function stopSSEStream(userId, aiConversationId) {
|
|
|
try {
|
|
try {
|
|
|
|
|
+ const token = getToken()
|
|
|
|
|
+ const headers = {
|
|
|
|
|
+ 'Content-Type': 'application/json'
|
|
|
|
|
+ }
|
|
|
|
|
+ if (token) {
|
|
|
|
|
+ headers['Authorization'] = `Bearer ${token}`
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const response = await fetch(buildApiUrl('/sse/stop', REPORT_API_PREFIX), {
|
|
const response = await fetch(buildApiUrl('/sse/stop', REPORT_API_PREFIX), {
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
- headers: {
|
|
|
|
|
- 'Content-Type': 'application/json'
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ headers,
|
|
|
body: JSON.stringify({
|
|
body: JSON.stringify({
|
|
|
// ===== 已删除:user_id - 后端从token解析 =====
|
|
// ===== 已删除:user_id - 后端从token解析 =====
|
|
|
ai_conversation_id: aiConversationId
|
|
ai_conversation_id: aiConversationId
|
|
@@ -139,11 +146,17 @@ export async function stopSSEStream(userId, aiConversationId) {
|
|
|
*/
|
|
*/
|
|
|
export async function updateAIMessageContent(aiMessageId, content) {
|
|
export async function updateAIMessageContent(aiMessageId, content) {
|
|
|
try {
|
|
try {
|
|
|
|
|
+ const token = getToken()
|
|
|
|
|
+ const headers = {
|
|
|
|
|
+ 'Content-Type': 'application/json'
|
|
|
|
|
+ }
|
|
|
|
|
+ if (token) {
|
|
|
|
|
+ headers['Authorization'] = `Bearer ${token}`
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const response = await fetch(buildApiUrl('/report/update-ai-message', REPORT_API_PREFIX), {
|
|
const response = await fetch(buildApiUrl('/report/update-ai-message', REPORT_API_PREFIX), {
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
- headers: {
|
|
|
|
|
- 'Content-Type': 'application/json'
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ headers,
|
|
|
body: JSON.stringify({
|
|
body: JSON.stringify({
|
|
|
ai_message_id: aiMessageId,
|
|
ai_message_id: aiMessageId,
|
|
|
content: content
|
|
content: content
|