refactor: Business logic and dependencies updates
- 核心服务代码更新 (db, server, auth, proxy) - Agent 相关模块更新 (mindspace, experience) - 前端组件和 hooks 更新 - 数据库 schema 更新 - 依赖版本更新
This commit is contained in:
+30
-6
@@ -995,6 +995,26 @@ export async function publishMindSpacePage(
|
||||
return result.data;
|
||||
}
|
||||
|
||||
export async function updatePublicationStatus(
|
||||
publicationId: string,
|
||||
input: {
|
||||
accessMode: MindSpacePublishCheck['accessMode'];
|
||||
expiresAt?: number | null;
|
||||
},
|
||||
): Promise<MindSpacePublication> {
|
||||
const result = await apiFetch<{ data: MindSpacePublication }>(
|
||||
`/mindspace/v1/publications/${encodeURIComponent(publicationId)}/update-status`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
access_mode: input.accessMode,
|
||||
expires_at: input.expiresAt,
|
||||
}),
|
||||
},
|
||||
);
|
||||
return result.data;
|
||||
}
|
||||
|
||||
export async function redactMindSpacePage(
|
||||
pageId: string,
|
||||
input: {
|
||||
@@ -1967,12 +1987,16 @@ export async function listSessions(): Promise<Session[]> {
|
||||
return result.sessions ?? [];
|
||||
}
|
||||
|
||||
function sessionPath(sessionId: string, suffix = '') {
|
||||
return `/sessions/${encodeURIComponent(sessionId)}${suffix}`;
|
||||
}
|
||||
|
||||
export async function getSession(sessionId: string): Promise<Session> {
|
||||
return apiFetch<Session>(`/sessions/${sessionId}`);
|
||||
return apiFetch<Session>(sessionPath(sessionId));
|
||||
}
|
||||
|
||||
export async function deleteChatSession(sessionId: string): Promise<void> {
|
||||
await apiFetch(`/sessions/${sessionId}`, { method: 'DELETE' });
|
||||
await apiFetch(sessionPath(sessionId), { method: 'DELETE' });
|
||||
}
|
||||
|
||||
export async function loadSessionDetail(
|
||||
@@ -1986,7 +2010,7 @@ export async function loadSessionDetail(
|
||||
if (hints?.messageCount != null) params.set('hint_mc', String(hints.messageCount));
|
||||
if (hints?.updatedAt) params.set('hint_ua', hints.updatedAt);
|
||||
const qs = params.size ? `?${params.toString()}` : '';
|
||||
const detail = await apiFetch<Session>(`/sessions/${sessionId}${qs}`);
|
||||
const detail = await apiFetch<Session>(`${sessionPath(sessionId)}${qs}`);
|
||||
const messages = normalizeConversationMessages(
|
||||
(detail.conversation ?? []).filter((m) => m.metadata?.userVisible),
|
||||
);
|
||||
@@ -1998,7 +2022,7 @@ export async function sendReply(
|
||||
requestId: string,
|
||||
userMessage: Message,
|
||||
): Promise<void> {
|
||||
await apiFetch(`/sessions/${sessionId}/reply`, {
|
||||
await apiFetch(`${sessionPath(sessionId)}/reply`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
request_id: requestId,
|
||||
@@ -2008,7 +2032,7 @@ export async function sendReply(
|
||||
}
|
||||
|
||||
export async function cancelRequest(sessionId: string, requestId: string): Promise<void> {
|
||||
await apiFetch(`/sessions/${sessionId}/cancel`, {
|
||||
await apiFetch(`${sessionPath(sessionId)}/cancel`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ request_id: requestId }),
|
||||
});
|
||||
@@ -2053,7 +2077,7 @@ export function subscribeSessionEvents(
|
||||
const headers: Record<string, string> = { Accept: 'text/event-stream' };
|
||||
if (lastEventId) headers['Last-Event-ID'] = lastEventId;
|
||||
|
||||
const res = await fetch(`${API}/sessions/${sessionId}/events`, {
|
||||
const res = await fetch(`${API}${sessionPath(sessionId)}/events`, {
|
||||
headers,
|
||||
signal: controller.signal,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user