feat(agent): 审美分析 - 接入费用确认与阶段任务恢复

This commit is contained in:
王志伟
2026-09-08 21:20:36 +08:00
parent 757d1dd2c7
commit d0024fbbc6
13 changed files with 432 additions and 27 deletions

View File

@@ -126,6 +126,8 @@ export type ArtCritiqueNodeStatus = "idle" | "running" | "completed" | "failed"
export type ArtCritiqueNodeState = {
stageTaskIds?: Record<string, string>;
billingRunId?: string;
lastRunModel?: string;
schemaVersion: typeof ART_CRITIQUE_SCHEMA_VERSION;
status: ArtCritiqueNodeStatus;
sourceNodeId?: string;

View File

@@ -1116,7 +1116,7 @@ function emitStage(options: ArtCritiquePipelineOptions, stage: ArtCritiquePipeli
}
function rethrowIfAborted(error: unknown, signal?: AbortSignal): asserts error is Error {
if (signal?.aborted) throw error;
if (signal?.aborted || (error instanceof Error && error.name === "AbortError")) throw error;
}
function throwIfAborted(signal?: AbortSignal) {

View File

@@ -9,7 +9,7 @@ const manifest: PluginManifest = {
id: ART_CRITIQUE_PLUGIN_ID,
name: "AI 审美批改",
version: "0.1.0",
description: "分析图片的构图、色彩、光线和比例问题,输出结构化批改报告与可视化标注。",
description: "分析图片的构图、色彩、光线和比例问题,输出结构化批改报告与可视化标注。prepare-input 准备节点;canvas_start_art_critique 打开分析并准备真实报价,用户确认费用后执行;canvas_read_plugin_node 读取结果。",
author: "内置工具",
surfaces: ["node", "fullscreen"],
permissions: ["canvas.read", "canvas.write", "media.read", "ai.text"],
@@ -38,7 +38,7 @@ export const artCritiquePlugin: RegisteredPlugin = {
const state = node.metadata?.artCritique;
const sources = snapshot.nodes.filter((item) => item.type === "image" && snapshot.connections.some((edge) => edge.fromNodeId === item.id && edge.toNodeId === node.id));
const currentReport = state?.report && sources.length === 1 && state.report.sourceFingerprint === artCritiqueSourceFingerprint(sources[0]) ? state.report : undefined;
return { status: state?.report && !currentReport ? "stale" : state?.status || "idle", stage: state?.analysisStage, stageTaskIds: state?.stageTaskIds, sourceNodeId: state?.sourceNodeId, summary: currentReport?.summary, strengths: currentReport?.strengths, issues: currentReport?.issues, options: currentReport?.options, error: state?.errorMessage, execution: "已有报告仅在输入指纹一致时返回;新分析请使用节点的分析入口,当前 Agent 动作仅准备输入。" };
return { status: state?.report && !currentReport ? "stale" : state?.status || "idle", stage: state?.analysisStage, stageTaskIds: state?.stageTaskIds, sourceNodeId: state?.sourceNodeId, summary: currentReport?.summary, strengths: currentReport?.strengths, issues: currentReport?.issues, options: currentReport?.options, error: state?.errorMessage, execution: "已有报告仅在输入指纹一致时返回;canvas_start_art_critique 准备分析报价,用户确认后执行。" };
},
};