mirror of
https://github.com/JimLiu/baoyu-skills.git
synced 2026-07-12 13:59:47 +08:00
chore: release v1.118.0
This commit is contained in:
@@ -62,20 +62,3 @@ function deriveToolName(item: any): string {
|
||||
export function hasImageGenInvocation(toolCalls: ToolCall[]): boolean {
|
||||
return toolCalls.some((tc) => tc.tool === "image_gen");
|
||||
}
|
||||
|
||||
export function parseFinalJson(agentMessage: string | null): { path?: string; bytes?: number } | null {
|
||||
if (!agentMessage) return null;
|
||||
const trimmed = agentMessage.trim();
|
||||
const candidates = [trimmed];
|
||||
const match = trimmed.match(/\{[^{}]*"status"\s*:\s*"ok"[^{}]*\}/);
|
||||
if (match) candidates.push(match[0]);
|
||||
for (const c of candidates) {
|
||||
try {
|
||||
const obj = JSON.parse(c);
|
||||
if (obj?.status === "ok") return { path: obj.path, bytes: obj.bytes };
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user