MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / request

Function request

graph-ui/src/browser-ai/browser-ai-runtime.ts:73–86  ·  view source on GitHub ↗
(
        payload: Omit<BrowserWorkerRequest, 'id' | 'modelId'>,
        callbacks: { progress?: (value: BrowserAiProgress) => void; onToken?: (chunk: string) => void } = {},
    )

Source from the content-addressed store, hash-verified

71 failRuntime(event.message || 'Browser model worker failed.');
72 };
73 const request = (
74 payload: Omit<BrowserWorkerRequest, 'id' | 'modelId'>,
75 callbacks: { progress?: (value: BrowserAiProgress) => void; onToken?: (chunk: string) => void } = {},
76 ): Promise<BrowserWorkerResponse> => new Promise((resolve, reject) => {
77 if (disposed) { reject(fatalFailure ?? new Error('The browser model was unloaded. Load it again to continue.')); return; }
78 if (pending) { reject(new Error('The browser model is already busy.')); return; }
79 const id = ++sequence;
80 pending = { id, kind: payload.kind, resolve, reject, ...callbacks };
81 try { worker.postMessage({ ...payload, id, modelId } satisfies BrowserWorkerRequest); }
82 catch (error) {
83 if (isGpuRuntimeFailure(error)) failRuntime(error);
84 else { pending = undefined; reject(error instanceof Error ? error : new Error(runtimeErrorDetail(error))); }
85 }
86 });
87 return {
88 prepare: async (progress, options) => { await request({ kind: 'prepare', ...options?.cacheOnly ? { cacheOnly: true } : {} }, { progress }); },
89 countTokens: async messages => {

Callers 1

createBrowserChatRuntimeFunction · 0.70

Calls 4

isGpuRuntimeFailureFunction · 0.90
runtimeErrorDetailFunction · 0.90
failRuntimeFunction · 0.85
postMessageMethod · 0.45

Tested by

no test coverage detected