feat(webui): segment transcript storage
This commit is contained in:
+16
-1
@@ -124,12 +124,27 @@ export async function listSessions(
|
||||
}
|
||||
|
||||
/** Disk-backed WebUI display thread snapshot (separate from agent session). */
|
||||
export interface FetchWebuiThreadOptions {
|
||||
limit?: number;
|
||||
direction?: "latest";
|
||||
before?: string | null;
|
||||
}
|
||||
|
||||
export async function fetchWebuiThread(
|
||||
token: string,
|
||||
key: string,
|
||||
optionsOrBase?: FetchWebuiThreadOptions | string,
|
||||
base: string = "",
|
||||
): Promise<WebuiThreadPersistedPayload | null> {
|
||||
const url = `${base}/api/sessions/${encodeURIComponent(key)}/webui-thread`;
|
||||
const options = typeof optionsOrBase === "string" ? undefined : optionsOrBase;
|
||||
const resolvedBase = typeof optionsOrBase === "string" ? optionsOrBase : base;
|
||||
const params = new URLSearchParams();
|
||||
if (options?.limit !== undefined) params.set("limit", String(options.limit));
|
||||
if (options?.direction) params.set("direction", options.direction);
|
||||
if (options?.before) params.set("before", options.before);
|
||||
const query = params.toString();
|
||||
const suffix = query ? `?${query}` : "";
|
||||
const url = `${resolvedBase}/api/sessions/${encodeURIComponent(key)}/webui-thread${suffix}`;
|
||||
const res = await fetchWithTimeout(url, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
credentials: "same-origin",
|
||||
|
||||
Reference in New Issue
Block a user