MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / quickChat

Function quickChat

ui/src/components/workspace/api.ts:334–356  ·  view source on GitHub ↗
(
  prompt: string,
  agent?: string,
  credentialSlug?: string,
  targetWsId?: string,
  terminalTheme?: TerminalThemeVariant,
)

Source from the content-addressed store, hash-verified

332 * claude/codex, which carry their own CLI login.
333 */
334export async function quickChat(
335 prompt: string,
336 agent?: string,
337 credentialSlug?: string,
338 targetWsId?: string,
339 terminalTheme?: TerminalThemeVariant,
340): Promise<QuickChatResult> {
341 const body: Record<string, unknown> = { prompt };
342 if (agent !== undefined) body['agent'] = agent;
343 if (credentialSlug !== undefined) body['credentialSlug'] = credentialSlug;
344 if (targetWsId !== undefined) body['targetWsId'] = targetWsId;
345 if (terminalTheme !== undefined) body['terminalTheme'] = terminalTheme;
346 const res = await fetch('/api/workspaces/quick-chat', {
347 method: 'POST',
348 headers: { 'content-type': 'application/json' },
349 body: JSON.stringify(body),
350 });
351 if (!res.ok) {
352 const parsed = (await res.json().catch(() => null)) as { error?: string } | null;
353 throw new QuickChatError(`quick chat failed: ${res.status} ${parsed?.error ?? ''}`, parsed?.error);
354 }
355 return (await res.json()) as QuickChatResult;
356}
357
358/** Pause a session — kills its PTY but keeps the record so it can be resumed later. */
359export async function pauseSession(wsId: string, sessionId: string): Promise<boolean> {

Callers 1

submitFunction · 0.50

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected