|
|
@ -18,13 +18,16 @@ |
|
|
import { |
|
|
import { |
|
|
danaApi, |
|
|
danaApi, |
|
|
fastgptApiTable, |
|
|
fastgptApiTable, |
|
|
superAgentServiceProxyMatch, |
|
|
|
|
|
superAgentServiceApiTable, |
|
|
superAgentServiceApiTable, |
|
|
basicAction, |
|
|
basicAction, |
|
|
} from "@u"; |
|
|
} from "@u"; |
|
|
import { getCompatibleToken, getCompatibleUserId } from "@u/authCompat"; |
|
|
import { |
|
|
|
|
|
buildSuperAgentHeaders, |
|
|
|
|
|
buildSuperAgentPath, |
|
|
|
|
|
buildSuperAgentServiceUrl, |
|
|
|
|
|
requestAgentJson, |
|
|
|
|
|
} from "../utils/agentApi"; |
|
|
import request from "superagent"; |
|
|
import request from "superagent"; |
|
|
import { v4 as uuidv4 } from "uuid"; |
|
|
|
|
|
import { |
|
|
import { |
|
|
createSuperAgentTraceId, |
|
|
createSuperAgentTraceId, |
|
|
summarizeSuperAgentPayload, |
|
|
summarizeSuperAgentPayload, |
|
|
@ -33,7 +36,7 @@ import { |
|
|
} from "../utils/debugLog"; |
|
|
} from "../utils/debugLog"; |
|
|
|
|
|
|
|
|
const createDirectJsonAction = ({ method, path, fallbackMessage }) => (options = {}) => async () => { |
|
|
const createDirectJsonAction = ({ method, path, fallbackMessage }) => (options = {}) => async () => { |
|
|
const data = await requestSuperAgentJson({ |
|
|
const data = await requestAgentJson({ |
|
|
method, |
|
|
method, |
|
|
path, |
|
|
path, |
|
|
params: options.params, |
|
|
params: options.params, |
|
|
@ -44,14 +47,10 @@ const createDirectJsonAction = ({ method, path, fallbackMessage }) => (options = |
|
|
return { payload: { data } }; |
|
|
return { payload: { data } }; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const createClientSessionId = () => { |
|
|
|
|
|
return uuidv4(); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// SuperAgent 前端业务接口使用同源路径,由 web/config.cjs 转发到 Agent 服务。
|
|
|
// SuperAgent 前端业务接口使用同源路径,由 web/config.cjs 转发到 Agent 服务。
|
|
|
export const listSuperAgentSessions = createDirectJsonAction({ |
|
|
export const listSuperAgentSessions = createDirectJsonAction({ |
|
|
method: "GET", |
|
|
method: "GET", |
|
|
path: superAgentServiceApiTable.sessions, |
|
|
path: superAgentServiceApiTable.conversations, |
|
|
fallbackMessage: "获取超级智能体会话失败", |
|
|
fallbackMessage: "获取超级智能体会话失败", |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
@ -60,23 +59,19 @@ export const createSuperAgentSession = (options = {}) => async () => { |
|
|
const sessionType = |
|
|
const sessionType = |
|
|
requestBody.type === "task" || requestBody.type === "conversation" |
|
|
requestBody.type === "task" || requestBody.type === "conversation" |
|
|
? requestBody.type |
|
|
? requestBody.type |
|
|
: undefined; |
|
|
: "conversation"; |
|
|
const taskType = requestBody.task_type || |
|
|
|
|
|
(sessionType === "conversation" ? "conversation" : "bid"); |
|
|
|
|
|
const body = { |
|
|
const body = { |
|
|
session_id: requestBody.session_id || requestBody.sessionId || createClientSessionId(), |
|
|
type: sessionType, |
|
|
task_type: taskType, |
|
|
name: String(requestBody.name || requestBody.title || (sessionType === "conversation" ? "新对话" : "新任务")), |
|
|
title: String(requestBody.title || (sessionType === "conversation" ? "新对话" : "新任务")), |
|
|
|
|
|
reuse_empty: requestBody.reuse_empty === true, |
|
|
|
|
|
}; |
|
|
}; |
|
|
const folderId = requestBody.folder_id ?? requestBody.folderId; |
|
|
const tasksetId = requestBody.taskset_id ?? requestBody.tasksetId ?? requestBody.folder_id ?? requestBody.folderId; |
|
|
if (folderId !== undefined && folderId !== null && folderId !== "") { |
|
|
if (sessionType === "task") { |
|
|
body.folder_id = folderId; |
|
|
body.taskset_id = tasksetId; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const data = await requestSuperAgentJson({ |
|
|
const data = await requestSuperAgentJson({ |
|
|
method: "POST", |
|
|
method: "POST", |
|
|
path: superAgentServiceApiTable.sessions, |
|
|
path: superAgentServiceApiTable.conversations, |
|
|
query: options.query, |
|
|
query: options.query, |
|
|
body, |
|
|
body, |
|
|
fallbackMessage: "创建超级智能体会话失败", |
|
|
fallbackMessage: "创建超级智能体会话失败", |
|
|
@ -86,43 +81,43 @@ export const createSuperAgentSession = (options = {}) => async () => { |
|
|
|
|
|
|
|
|
export const getSuperAgentSessionSections = createDirectJsonAction({ |
|
|
export const getSuperAgentSessionSections = createDirectJsonAction({ |
|
|
method: "GET", |
|
|
method: "GET", |
|
|
path: superAgentServiceApiTable.sessionSections, |
|
|
path: superAgentServiceApiTable.artifactChapters, |
|
|
fallbackMessage: "获取超级智能体章节列表失败", |
|
|
fallbackMessage: "获取超级智能体章节列表失败", |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
export const getSuperAgentSessionSection = createDirectJsonAction({ |
|
|
export const getSuperAgentSessionSection = createDirectJsonAction({ |
|
|
method: "GET", |
|
|
method: "GET", |
|
|
path: superAgentServiceApiTable.sessionSection, |
|
|
path: superAgentServiceApiTable.artifactChapter, |
|
|
fallbackMessage: "获取超级智能体章节内容失败", |
|
|
fallbackMessage: "获取超级智能体章节内容失败", |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
export const updateSuperAgentSessionSection = createDirectJsonAction({ |
|
|
export const updateSuperAgentSessionSection = createDirectJsonAction({ |
|
|
method: "PUT", |
|
|
method: "PUT", |
|
|
path: superAgentServiceApiTable.sessionSection, |
|
|
path: superAgentServiceApiTable.artifactChapter, |
|
|
fallbackMessage: "保存超级智能体章节内容失败", |
|
|
fallbackMessage: "保存超级智能体章节内容失败", |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
export const deleteSuperAgentSession = createDirectJsonAction({ |
|
|
export const deleteSuperAgentSession = createDirectJsonAction({ |
|
|
method: "DELETE", |
|
|
method: "DELETE", |
|
|
path: superAgentServiceApiTable.sessionDetail, |
|
|
path: superAgentServiceApiTable.conversationDetail, |
|
|
fallbackMessage: "删除超级智能体会话失败", |
|
|
fallbackMessage: "删除超级智能体会话失败", |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
export const getSuperAgentSidebar = createDirectJsonAction({ |
|
|
export const getSuperAgentSidebar = createDirectJsonAction({ |
|
|
method: "GET", |
|
|
method: "GET", |
|
|
path: superAgentServiceApiTable.sidebar, |
|
|
path: superAgentServiceApiTable.tasksets, |
|
|
fallbackMessage: "获取超级智能体侧栏失败", |
|
|
fallbackMessage: "获取超级智能体侧栏失败", |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
export const createSuperAgentFolder = createDirectJsonAction({ |
|
|
export const createSuperAgentFolder = createDirectJsonAction({ |
|
|
method: "POST", |
|
|
method: "POST", |
|
|
path: superAgentServiceApiTable.folders, |
|
|
path: superAgentServiceApiTable.tasksets, |
|
|
fallbackMessage: "创建文件夹失败", |
|
|
fallbackMessage: "创建文件夹失败", |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
export const deleteSuperAgentFolder = createDirectJsonAction({ |
|
|
export const deleteSuperAgentFolder = createDirectJsonAction({ |
|
|
method: "DELETE", |
|
|
method: "DELETE", |
|
|
path: superAgentServiceApiTable.folderDetail, |
|
|
path: superAgentServiceApiTable.tasksetDetail, |
|
|
fallbackMessage: "删除文件夹失败", |
|
|
fallbackMessage: "删除文件夹失败", |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
@ -131,7 +126,7 @@ export const respondSuperAgentCheckpoint = (options = {}) => async () => { |
|
|
const sessionId = body.session_id || body.sessionId; |
|
|
const sessionId = body.session_id || body.sessionId; |
|
|
const data = await requestSuperAgentJson({ |
|
|
const data = await requestSuperAgentJson({ |
|
|
method: "POST", |
|
|
method: "POST", |
|
|
path: superAgentServiceApiTable.checkpointRespond, |
|
|
path: superAgentServiceApiTable.threadCommands, |
|
|
params: { sessionId }, |
|
|
params: { sessionId }, |
|
|
query: options.query, |
|
|
query: options.query, |
|
|
body, |
|
|
body, |
|
|
@ -157,7 +152,7 @@ export const respondSuperAgentCheckpointStream = async ({ |
|
|
action: requestBody.action, |
|
|
action: requestBody.action, |
|
|
}); |
|
|
}); |
|
|
await requestSuperAgentStream({ |
|
|
await requestSuperAgentStream({ |
|
|
path: buildSuperAgentPath(superAgentServiceApiTable.checkpointRespond, { |
|
|
path: buildSuperAgentPath(superAgentServiceApiTable.threadCommands, { |
|
|
sessionId: requestSessionId, |
|
|
sessionId: requestSessionId, |
|
|
}), |
|
|
}), |
|
|
userId, |
|
|
userId, |
|
|
@ -175,40 +170,12 @@ export const respondSuperAgentCheckpointStream = async ({ |
|
|
}; |
|
|
}; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const requestSuperAgentJson = async ({ |
|
|
const requestSuperAgentJson = async (options) => requestAgentJson(options); |
|
|
method, |
|
|
|
|
|
path, |
|
|
|
|
|
params = {}, |
|
|
|
|
|
query = {}, |
|
|
|
|
|
body, |
|
|
|
|
|
fallbackMessage, |
|
|
|
|
|
keepalive = false, |
|
|
|
|
|
}) => { |
|
|
|
|
|
const resolvedPath = buildSuperAgentPath(path, params); |
|
|
|
|
|
const search = new URLSearchParams(); |
|
|
|
|
|
Object.entries(query || {}).forEach(([key, value]) => { |
|
|
|
|
|
if (value === undefined || value === null || value === "") return; |
|
|
|
|
|
search.set(key, String(value)); |
|
|
|
|
|
}); |
|
|
|
|
|
const queryString = search.toString(); |
|
|
|
|
|
const response = await fetch( |
|
|
|
|
|
buildSuperAgentServiceUrl(`${resolvedPath}${queryString ? `?${queryString}` : ""}`), |
|
|
|
|
|
{ |
|
|
|
|
|
method, |
|
|
|
|
|
headers: buildSuperAgentHeaders(query?.userId, { |
|
|
|
|
|
...(body !== undefined ? { "Content-Type": "application/json" } : {}), |
|
|
|
|
|
}), |
|
|
|
|
|
body: body !== undefined ? JSON.stringify(body) : undefined, |
|
|
|
|
|
keepalive, |
|
|
|
|
|
} |
|
|
|
|
|
); |
|
|
|
|
|
return parseJsonResponse(response, fallbackMessage); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export const updateSuperAgentFolder = async ({ folderId, userId, body }) => |
|
|
export const updateSuperAgentFolder = async ({ folderId, userId, body }) => |
|
|
requestSuperAgentJson({ |
|
|
requestSuperAgentJson({ |
|
|
method: "PATCH", |
|
|
method: "PATCH", |
|
|
path: superAgentServiceApiTable.folderDetail, |
|
|
path: superAgentServiceApiTable.tasksetDetail, |
|
|
params: { folderId }, |
|
|
params: { folderId }, |
|
|
query: { userId }, |
|
|
query: { userId }, |
|
|
body, |
|
|
body, |
|
|
@ -218,7 +185,7 @@ export const updateSuperAgentFolder = async ({ folderId, userId, body }) => |
|
|
export const patchSuperAgentSession = async ({ sessionId, userId, body }) => |
|
|
export const patchSuperAgentSession = async ({ sessionId, userId, body }) => |
|
|
requestSuperAgentJson({ |
|
|
requestSuperAgentJson({ |
|
|
method: "PATCH", |
|
|
method: "PATCH", |
|
|
path: superAgentServiceApiTable.sessionDetail, |
|
|
path: superAgentServiceApiTable.conversationDetail, |
|
|
params: { sessionId }, |
|
|
params: { sessionId }, |
|
|
query: { userId }, |
|
|
query: { userId }, |
|
|
body, |
|
|
body, |
|
|
@ -228,7 +195,7 @@ export const patchSuperAgentSession = async ({ sessionId, userId, body }) => |
|
|
export const cancelSuperAgentSession = async ({ sessionId, userId }) => |
|
|
export const cancelSuperAgentSession = async ({ sessionId, userId }) => |
|
|
requestSuperAgentJson({ |
|
|
requestSuperAgentJson({ |
|
|
method: "POST", |
|
|
method: "POST", |
|
|
path: superAgentServiceApiTable.sessionCancel, |
|
|
path: superAgentServiceApiTable.threadCancel, |
|
|
params: { sessionId }, |
|
|
params: { sessionId }, |
|
|
query: { userId }, |
|
|
query: { userId }, |
|
|
fallbackMessage: "取消任务失败", |
|
|
fallbackMessage: "取消任务失败", |
|
|
@ -240,7 +207,7 @@ export const getSuperAgentSessionSectionsDirect = async ({ |
|
|
userId, |
|
|
userId, |
|
|
includeContent = 1, |
|
|
includeContent = 1, |
|
|
}) => { |
|
|
}) => { |
|
|
const path = buildSuperAgentPath(superAgentServiceApiTable.sessionSections, { |
|
|
const path = buildSuperAgentPath(superAgentServiceApiTable.artifactChapters, { |
|
|
sessionId, |
|
|
sessionId, |
|
|
}); |
|
|
}); |
|
|
const query = new URLSearchParams(); |
|
|
const query = new URLSearchParams(); |
|
|
@ -251,7 +218,7 @@ export const getSuperAgentSessionSectionsDirect = async ({ |
|
|
buildSuperAgentServiceUrl(`${path}${query.toString() ? `?${query.toString()}` : ""}`), |
|
|
buildSuperAgentServiceUrl(`${path}${query.toString() ? `?${query.toString()}` : ""}`), |
|
|
{ |
|
|
{ |
|
|
method: "GET", |
|
|
method: "GET", |
|
|
headers: buildSuperAgentHeaders(userId), |
|
|
headers: await buildLegacyCompatibleHeaders(), |
|
|
cache: "no-store", |
|
|
cache: "no-store", |
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
@ -263,7 +230,7 @@ export const getSuperAgentSessionSectionDirect = async ({ |
|
|
sectionId, |
|
|
sectionId, |
|
|
userId, |
|
|
userId, |
|
|
}) => { |
|
|
}) => { |
|
|
const path = buildSuperAgentPath(superAgentServiceApiTable.sessionSection, { |
|
|
const path = buildSuperAgentPath(superAgentServiceApiTable.artifactChapter, { |
|
|
sessionId, |
|
|
sessionId, |
|
|
sectionId, |
|
|
sectionId, |
|
|
}); |
|
|
}); |
|
|
@ -274,7 +241,7 @@ export const getSuperAgentSessionSectionDirect = async ({ |
|
|
buildSuperAgentServiceUrl(`${path}${query.toString() ? `?${query.toString()}` : ""}`), |
|
|
buildSuperAgentServiceUrl(`${path}${query.toString() ? `?${query.toString()}` : ""}`), |
|
|
{ |
|
|
{ |
|
|
method: "GET", |
|
|
method: "GET", |
|
|
headers: buildSuperAgentHeaders(userId), |
|
|
headers: await buildLegacyCompatibleHeaders(), |
|
|
cache: "no-store", |
|
|
cache: "no-store", |
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
@ -639,19 +606,7 @@ export const getDatasetList = async (fastgptAppKey, parentId = null) => { |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
export const buildSuperAgentServiceUrl = (path) => { |
|
|
export { buildSuperAgentServiceUrl, buildSuperAgentPath } from "../utils/agentApi"; |
|
|
const servicePath = String(path || "").startsWith("/") ? path : `/${path}`; |
|
|
|
|
|
const origin = typeof window !== "undefined" ? window.location.origin : ""; |
|
|
|
|
|
return `${origin}${superAgentServiceProxyMatch}${servicePath}`; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const buildSuperAgentPath = (path, params = {}) => { |
|
|
|
|
|
let nextPath = path; |
|
|
|
|
|
Object.keys(params).forEach((key) => { |
|
|
|
|
|
nextPath = nextPath.replace(`:${key}`, encodeURIComponent(params[key])); |
|
|
|
|
|
}); |
|
|
|
|
|
return nextPath; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const parseJsonResponse = async (response, fallbackMessage) => { |
|
|
const parseJsonResponse = async (response, fallbackMessage) => { |
|
|
const text = await response.text(); |
|
|
const text = await response.text(); |
|
|
@ -681,18 +636,8 @@ const parseJsonResponse = async (response, fallbackMessage) => { |
|
|
return data; |
|
|
return data; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const buildSuperAgentHeaders = (userId, extraHeaders = {}) => { |
|
|
const buildLegacyCompatibleHeaders = async (extraHeaders = {}) => { |
|
|
const headers = { ...extraHeaders }; |
|
|
return buildSuperAgentHeaders(extraHeaders); |
|
|
const token = getCompatibleToken(); |
|
|
|
|
|
const requestUserId = userId || getCompatibleUserId(); |
|
|
|
|
|
if (token) { |
|
|
|
|
|
headers.Authorization = `Bearer ${token}`; |
|
|
|
|
|
headers["X-Search-Token"] = token; |
|
|
|
|
|
} |
|
|
|
|
|
if (requestUserId) { |
|
|
|
|
|
headers["X-User-Id"] = String(requestUserId); |
|
|
|
|
|
} |
|
|
|
|
|
return headers; |
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const requestSuperAgentStream = async ({ |
|
|
const requestSuperAgentStream = async ({ |
|
|
@ -708,7 +653,7 @@ const requestSuperAgentStream = async ({ |
|
|
}) => { |
|
|
}) => { |
|
|
const response = await fetch(buildSuperAgentServiceUrl(path), { |
|
|
const response = await fetch(buildSuperAgentServiceUrl(path), { |
|
|
method: "POST", |
|
|
method: "POST", |
|
|
headers: buildSuperAgentHeaders(userId, { |
|
|
headers: await buildLegacyCompatibleHeaders({ |
|
|
"Content-Type": "application/json", |
|
|
"Content-Type": "application/json", |
|
|
}), |
|
|
}), |
|
|
body: JSON.stringify(body), |
|
|
body: JSON.stringify(body), |
|
|
@ -823,7 +768,7 @@ export const sendSuperAgentChat = async ({ |
|
|
userId, |
|
|
userId, |
|
|
message, |
|
|
message, |
|
|
}); |
|
|
}); |
|
|
const chatPath = buildSuperAgentPath(superAgentServiceApiTable.chat, { |
|
|
const chatPath = buildSuperAgentPath(superAgentServiceApiTable.threadEvents, { |
|
|
sessionId, |
|
|
sessionId, |
|
|
}); |
|
|
}); |
|
|
await requestSuperAgentStream({ |
|
|
await requestSuperAgentStream({ |
|
|
@ -862,14 +807,15 @@ export const uploadSuperAgentFile = async ({ sessionId, userId, file, onProgress |
|
|
formData.append("session_id", sessionId); |
|
|
formData.append("session_id", sessionId); |
|
|
formData.append("file", file); |
|
|
formData.append("file", file); |
|
|
|
|
|
|
|
|
const uploadPath = buildSuperAgentPath(superAgentServiceApiTable.upload, { |
|
|
const uploadPath = buildSuperAgentPath(superAgentServiceApiTable.attachmentUploadIntents, { |
|
|
sessionId, |
|
|
conversationId: sessionId, |
|
|
}); |
|
|
}); |
|
|
|
|
|
const agentHeaders = await buildLegacyCompatibleHeaders(); |
|
|
const result = await new Promise((resolve, reject) => { |
|
|
const result = await new Promise((resolve, reject) => { |
|
|
const xhr = new XMLHttpRequest(); |
|
|
const xhr = new XMLHttpRequest(); |
|
|
xhr.open("POST", buildSuperAgentServiceUrl(uploadPath)); |
|
|
xhr.open("POST", buildSuperAgentServiceUrl(uploadPath)); |
|
|
|
|
|
|
|
|
Object.entries(buildSuperAgentHeaders(userId)).forEach(([key, value]) => { |
|
|
Object.entries(agentHeaders).forEach(([key, value]) => { |
|
|
if (value !== undefined && value !== null && value !== "") { |
|
|
if (value !== undefined && value !== null && value !== "") { |
|
|
xhr.setRequestHeader(key, value); |
|
|
xhr.setRequestHeader(key, value); |
|
|
} |
|
|
} |
|
|
@ -931,11 +877,11 @@ export const buildSuperAgentDownloadUrl = (filePath, sessionId = "") => { |
|
|
if (sessionId) { |
|
|
if (sessionId) { |
|
|
query.set("session_id", sessionId); |
|
|
query.set("session_id", sessionId); |
|
|
} |
|
|
} |
|
|
return buildSuperAgentServiceUrl(`${superAgentServiceApiTable.download}?${query.toString()}`); |
|
|
return buildSuperAgentServiceUrl(`${superAgentServiceApiTable.attachments}?${query.toString()}`); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
export const buildSuperAgentSessionDownloadUrl = (sessionId, userId = "", options = {}) => { |
|
|
export const buildSuperAgentSessionDownloadUrl = (sessionId, userId = "", options = {}) => { |
|
|
const path = buildSuperAgentPath(superAgentServiceApiTable.sessionDownload, { |
|
|
const path = buildSuperAgentPath(superAgentServiceApiTable.artifacts, { |
|
|
sessionId, |
|
|
sessionId, |
|
|
}); |
|
|
}); |
|
|
const query = new URLSearchParams(); |
|
|
const query = new URLSearchParams(); |
|
|
@ -959,7 +905,7 @@ export const updateSuperAgentSessionSectionDirect = async ({ |
|
|
order, |
|
|
order, |
|
|
}) => { |
|
|
}) => { |
|
|
const traceId = createSuperAgentTraceId("section_save"); |
|
|
const traceId = createSuperAgentTraceId("section_save"); |
|
|
const path = buildSuperAgentPath(superAgentServiceApiTable.sessionSection, { |
|
|
const path = buildSuperAgentPath(superAgentServiceApiTable.artifactChapter, { |
|
|
sessionId, |
|
|
sessionId, |
|
|
sectionId, |
|
|
sectionId, |
|
|
}); |
|
|
}); |
|
|
@ -979,7 +925,7 @@ export const updateSuperAgentSessionSectionDirect = async ({ |
|
|
}); |
|
|
}); |
|
|
const response = await fetch(buildSuperAgentServiceUrl(`${path}${query.toString() ? `?${query.toString()}` : ""}`), { |
|
|
const response = await fetch(buildSuperAgentServiceUrl(`${path}${query.toString() ? `?${query.toString()}` : ""}`), { |
|
|
method: "PUT", |
|
|
method: "PUT", |
|
|
headers: buildSuperAgentHeaders(userId, { |
|
|
headers: await buildLegacyCompatibleHeaders({ |
|
|
"Content-Type": "application/json", |
|
|
"Content-Type": "application/json", |
|
|
}), |
|
|
}), |
|
|
body: JSON.stringify({ |
|
|
body: JSON.stringify({ |
|
|
|