categorize: пустой run_id допустим, если операций нет
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,7 +31,7 @@ export const resultSchema = z.object({
|
|||||||
.optional(),
|
.optional(),
|
||||||
});
|
});
|
||||||
export const agentOutputSchema = z.object({
|
export const agentOutputSchema = z.object({
|
||||||
run_id: z.string().min(1).optional(),
|
run_id: z.string().optional(),
|
||||||
results: z.array(resultSchema),
|
results: z.array(resultSchema),
|
||||||
});
|
});
|
||||||
export type AgentOutput = z.infer<typeof agentOutputSchema>;
|
export type AgentOutput = z.infer<typeof agentOutputSchema>;
|
||||||
@@ -117,7 +117,7 @@ export async function runCategorization(deps: CategorizeDeps): Promise<Categoriz
|
|||||||
deps.log.error({ err: String(e), stdoutTail: r.stdout.slice(-500) }, "ответ агента категоризации не разобран");
|
deps.log.error({ err: String(e), stdoutTail: r.stdout.slice(-500) }, "ответ агента категоризации не разобран");
|
||||||
return { status: "bad_output", parsed: 0, inserted: 0, skipped: 0, message: String(e).slice(0, 300) };
|
return { status: "bad_output", parsed: 0, inserted: 0, skipped: 0, message: String(e).slice(0, 300) };
|
||||||
}
|
}
|
||||||
const runId = out.run_id ?? `run-${startedAt.toISOString()}`;
|
const runId = out.run_id || `run-${startedAt.toISOString()}`;
|
||||||
let inserted = 0;
|
let inserted = 0;
|
||||||
let skipped = 0;
|
let skipped = 0;
|
||||||
for (const x of out.results) {
|
for (const x of out.results) {
|
||||||
|
|||||||
Reference in New Issue
Block a user