mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: update tool installation checks and refactor stdout JSON parsing in AI modules
This commit is contained in:
@@ -100,9 +100,7 @@ function startDispatcher(): ChildProcess | null {
|
||||
if (parsed.ready === true) {
|
||||
dispatcherReady = true;
|
||||
dispatcherGpuAvailable = parsed.gpu === true;
|
||||
console.log(
|
||||
`[bridge] Python dispatcher ready (GPU: ${parsed.gpu === true})`,
|
||||
);
|
||||
console.log(`[bridge] Python dispatcher ready (GPU: ${parsed.gpu === true})`);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -408,3 +406,10 @@ export function runPythonWithProgress(
|
||||
// Fall back to per-request spawning
|
||||
return runPythonPerRequest(scriptName, args, options);
|
||||
}
|
||||
|
||||
// biome-ignore lint/suspicious/noExplicitAny: matches JSON.parse return type
|
||||
export function parseStdoutJson(stdout: string): any {
|
||||
const match = stdout.match(/\{[\s\S]*\}$/);
|
||||
if (!match) throw new Error("No JSON response from Python script");
|
||||
return JSON.parse(match[0]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user