chore: test deploy snapshot
This commit is contained in:
@@ -1901,6 +1901,54 @@ export async function fetchChatRuntimeSnapshot() {
|
||||
return response.item;
|
||||
}
|
||||
|
||||
export async function fetchChatShareRuntimeSnapshot(
|
||||
token: string,
|
||||
options?: {
|
||||
sessionId?: string | null;
|
||||
sharePin?: string | null;
|
||||
},
|
||||
) {
|
||||
const query = new URLSearchParams();
|
||||
const normalizedSessionId = options?.sessionId?.trim() || '';
|
||||
|
||||
if (normalizedSessionId) {
|
||||
query.set('sessionId', normalizedSessionId);
|
||||
}
|
||||
|
||||
const response = await requestChatApi<{ ok: boolean; item: ChatRuntimeSnapshot }>(
|
||||
`/shares/${encodeURIComponent(token)}/runtime${query.size > 0 ? `?${query.toString()}` : ''}`,
|
||||
undefined,
|
||||
{
|
||||
allowUnauthenticated: true,
|
||||
sharePin: options?.sharePin,
|
||||
timeoutMs: 20000,
|
||||
},
|
||||
);
|
||||
return response.item;
|
||||
}
|
||||
|
||||
export async function cancelChatShareRuntimeRequest(
|
||||
token: string,
|
||||
payload: {
|
||||
requestId: string;
|
||||
sessionId?: string | null;
|
||||
},
|
||||
) {
|
||||
const response = await requestChatApi<{ ok: boolean; action: 'cancelled' | 'removed' }>(
|
||||
`/shares/${encodeURIComponent(token)}/runtime-requests/${encodeURIComponent(payload.requestId)}/cancel`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
sessionId: payload.sessionId?.trim() || undefined,
|
||||
}),
|
||||
},
|
||||
{
|
||||
allowUnauthenticated: true,
|
||||
},
|
||||
);
|
||||
return response.action;
|
||||
}
|
||||
|
||||
export async function fetchChatSourceChanges(limit = 300) {
|
||||
const query = new URLSearchParams();
|
||||
query.set('limit', String(Math.max(1, Math.min(500, Math.round(limit)))));
|
||||
@@ -2268,11 +2316,14 @@ export async function clearChatConversationRoom(sessionId: string) {
|
||||
};
|
||||
}
|
||||
|
||||
export async function clearChatShareConversationRoom(token: string) {
|
||||
export async function clearChatShareConversationRoom(token: string, sessionId?: string | null) {
|
||||
const response = await requestChatApi<{ ok: boolean; item: ChatConversationSummary }>(
|
||||
`/shares/${encodeURIComponent(token)}/clear`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
sessionId: sessionId?.trim() || undefined,
|
||||
}),
|
||||
},
|
||||
{
|
||||
allowUnauthenticated: true,
|
||||
@@ -2282,6 +2333,44 @@ export async function clearChatShareConversationRoom(token: string) {
|
||||
return response.item;
|
||||
}
|
||||
|
||||
export async function createChatShareRoom(
|
||||
token: string,
|
||||
payload: {
|
||||
chatTypeId: string;
|
||||
chatTypeLabel: string;
|
||||
title: string;
|
||||
requestBadgeLabel?: string | null;
|
||||
seedMessage: string;
|
||||
},
|
||||
) {
|
||||
const response = await requestChatApi<{ ok: boolean; room: ChatShareRoomSummary }>(
|
||||
`/shares/${encodeURIComponent(token)}/rooms`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
},
|
||||
{
|
||||
allowUnauthenticated: true,
|
||||
},
|
||||
);
|
||||
|
||||
return {
|
||||
sessionId: normalizeRequiredText(response.room.sessionId),
|
||||
requestId: normalizeRequiredText(response.room.requestId),
|
||||
isDefault: response.room.isDefault === true,
|
||||
sortOrder: Number.isFinite(response.room.sortOrder) ? Number(response.room.sortOrder) : 0,
|
||||
title: normalizeRequiredText(response.room.title) || '공유 채팅방',
|
||||
requestBadgeLabel: normalizeOptionalText(response.room.requestBadgeLabel),
|
||||
chatTypeId: normalizeOptionalText(response.room.chatTypeId),
|
||||
lastChatTypeId: normalizeOptionalText(response.room.lastChatTypeId),
|
||||
contextLabel: normalizeOptionalText(response.room.contextLabel),
|
||||
contextDescription: normalizeOptionalText(response.room.contextDescription),
|
||||
notifyOffline: response.room.notifyOffline === true,
|
||||
createdAt: normalizeOptionalText(response.room.createdAt),
|
||||
updatedAt: normalizeOptionalText(response.room.updatedAt),
|
||||
} satisfies ChatShareRoomSummary;
|
||||
}
|
||||
|
||||
export async function deleteChatConversationRequest(sessionId: string, requestId: string) {
|
||||
const response = await requestChatApi<{ ok: boolean; deleted: boolean; sessionId: string; requestId: string }>(
|
||||
`/conversations/${encodeURIComponent(sessionId)}/requests/${encodeURIComponent(requestId)}`,
|
||||
@@ -2313,6 +2402,7 @@ export async function persistChatPromptSelection(
|
||||
sessionId: string,
|
||||
payload: {
|
||||
parentRequestId: string;
|
||||
sessionId?: string | null;
|
||||
promptIndex: number;
|
||||
promptTitle: string;
|
||||
promptSignature: string;
|
||||
@@ -2391,6 +2481,22 @@ export async function submitChatPromptSelection(
|
||||
|
||||
export type ChatShareKind = 'request-bundle' | 'inquiry-message' | 'prompt';
|
||||
|
||||
export type ChatShareRoomSummary = {
|
||||
sessionId: string;
|
||||
requestId: string;
|
||||
isDefault: boolean;
|
||||
sortOrder: number;
|
||||
title: string;
|
||||
requestBadgeLabel?: string | null;
|
||||
chatTypeId?: string | null;
|
||||
lastChatTypeId?: string | null;
|
||||
contextLabel?: string | null;
|
||||
contextDescription?: string | null;
|
||||
notifyOffline?: boolean;
|
||||
createdAt?: string | null;
|
||||
updatedAt?: string | null;
|
||||
};
|
||||
|
||||
export type ChatShareSnapshot = {
|
||||
share: {
|
||||
kind: ChatShareKind;
|
||||
@@ -2432,6 +2538,8 @@ export type ChatShareSnapshot = {
|
||||
requests: ChatConversationRequest[];
|
||||
messages: ChatMessage[];
|
||||
activityLogs: ChatConversationActivityLog[];
|
||||
rooms: ChatShareRoomSummary[];
|
||||
activeSessionId?: string | null;
|
||||
roomRequestCounts?: {
|
||||
processingCount: number;
|
||||
unansweredCount: number;
|
||||
@@ -2565,6 +2673,7 @@ export async function createManagedChatShareRoom(payload: ManagedChatShareRoomDr
|
||||
export async function saveChatShareRoomSettings(
|
||||
token: string,
|
||||
input: {
|
||||
sessionId?: string | null;
|
||||
accessPin?: string | null;
|
||||
accessPinPromptTtlMinutes?: number | null;
|
||||
chatTypeId?: string | null;
|
||||
@@ -2592,6 +2701,7 @@ export async function saveChatShareRoomSettings(
|
||||
{
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
sessionId: input.sessionId,
|
||||
accessPin: input.accessPin,
|
||||
accessPinPromptTtlMinutes: input.accessPinPromptTtlMinutes,
|
||||
chatTypeId: input.chatTypeId,
|
||||
@@ -2626,7 +2736,7 @@ export async function saveChatShareRoomSettings(
|
||||
};
|
||||
}
|
||||
|
||||
export async function fetchChatShareSnapshot(token: string, options?: { sharePin?: string | null }) {
|
||||
export async function fetchChatShareSnapshot(token: string, options?: { sharePin?: string | null; sessionId?: string | null }) {
|
||||
const response = await requestChatApi<{
|
||||
ok: boolean;
|
||||
share: ChatShareSnapshot['share'];
|
||||
@@ -2636,11 +2746,13 @@ export async function fetchChatShareSnapshot(token: string, options?: { sharePin
|
||||
requests: ChatConversationRequest[];
|
||||
messages: ChatMessage[];
|
||||
activityLogs: ChatConversationActivityLog[];
|
||||
rooms?: ChatShareRoomSummary[];
|
||||
activeSessionId?: string | null;
|
||||
roomRequestCounts?: ChatShareSnapshot['roomRequestCounts'];
|
||||
promptTarget?: ChatShareSnapshot['promptTarget'];
|
||||
refreshedAt: string;
|
||||
}>(
|
||||
`/shares/${encodeURIComponent(token)}`,
|
||||
`/shares/${encodeURIComponent(token)}${options?.sessionId?.trim() ? `?sessionId=${encodeURIComponent(options.sessionId.trim())}` : ''}`,
|
||||
undefined,
|
||||
{
|
||||
allowUnauthenticated: true,
|
||||
@@ -2707,6 +2819,24 @@ export async function fetchChatShareSnapshot(token: string, options?: { sharePin
|
||||
? response.messages.map((message, index) => normalizeChatMessage(message, index))
|
||||
: [],
|
||||
activityLogs: Array.isArray(response.activityLogs) ? response.activityLogs : [],
|
||||
rooms: Array.isArray(response.rooms)
|
||||
? response.rooms.map((item) => ({
|
||||
sessionId: normalizeRequiredText(item.sessionId),
|
||||
requestId: normalizeRequiredText(item.requestId),
|
||||
isDefault: item.isDefault === true,
|
||||
sortOrder: Number.isFinite(item.sortOrder) ? Number(item.sortOrder) : 0,
|
||||
title: normalizeRequiredText(item.title) || '공유 채팅방',
|
||||
requestBadgeLabel: normalizeOptionalText(item.requestBadgeLabel),
|
||||
chatTypeId: normalizeOptionalText(item.chatTypeId),
|
||||
lastChatTypeId: normalizeOptionalText(item.lastChatTypeId),
|
||||
contextLabel: normalizeOptionalText(item.contextLabel),
|
||||
contextDescription: normalizeOptionalText(item.contextDescription),
|
||||
notifyOffline: item.notifyOffline === true,
|
||||
createdAt: normalizeOptionalText(item.createdAt),
|
||||
updatedAt: normalizeOptionalText(item.updatedAt),
|
||||
}))
|
||||
: [],
|
||||
activeSessionId: normalizeOptionalText(response.activeSessionId),
|
||||
roomRequestCounts: response.roomRequestCounts
|
||||
? {
|
||||
processingCount: Number.isFinite(response.roomRequestCounts.processingCount) ? response.roomRequestCounts.processingCount : 0,
|
||||
@@ -2722,6 +2852,7 @@ export async function submitChatShareMessage(
|
||||
token: string,
|
||||
text: string,
|
||||
options?: {
|
||||
sessionId?: string | null;
|
||||
mode?: 'queue' | 'direct';
|
||||
parentRequestId?: string | null;
|
||||
},
|
||||
@@ -2732,6 +2863,7 @@ export async function submitChatShareMessage(
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
text,
|
||||
sessionId: options?.sessionId?.trim() || undefined,
|
||||
mode: options?.mode === 'direct' ? 'direct' : 'queue',
|
||||
parentRequestId: options?.parentRequestId?.trim() || undefined,
|
||||
}),
|
||||
@@ -2790,6 +2922,7 @@ export async function completeChatShareManualBadge(
|
||||
token: string,
|
||||
payload: {
|
||||
parentRequestId: string;
|
||||
sessionId?: string | null;
|
||||
type: 'prompt' | 'verification';
|
||||
},
|
||||
) {
|
||||
@@ -2811,6 +2944,7 @@ export async function cancelChatShareRequest(
|
||||
token: string,
|
||||
payload: {
|
||||
parentRequestId: string;
|
||||
sessionId?: string | null;
|
||||
},
|
||||
) {
|
||||
const response = await requestChatApi<{ ok: boolean; item: ChatConversationRequest }>(
|
||||
@@ -2831,6 +2965,7 @@ export async function retryChatShareRequest(
|
||||
token: string,
|
||||
payload: {
|
||||
parentRequestId: string;
|
||||
sessionId?: string | null;
|
||||
},
|
||||
) {
|
||||
return requestChatApi<{ ok: boolean; queuedRequestId: string }>(
|
||||
|
||||
Reference in New Issue
Block a user