feat(agent): 创作能力 - 接通专业节点发现与插件执行基础

This commit is contained in:
王志伟 committed 2026-09-09 13:01:30 +08:00
1 parent 88f4b9ccdf
commit f69535c93f
29 files changed
+617 -88

No files matched your search

+1
View File
@@ -125,6 +125,7 @@ export type ArtCritiqueReport = {
export type ArtCritiqueNodeStatus = "idle" | "running" | "completed" | "failed" | "stale";
export type ArtCritiqueNodeState = {
stageTaskIds?: Record<string, string>;
schemaVersion: typeof ART_CRITIQUE_SCHEMA_VERSION;
status: ArtCritiqueNodeStatus;
sourceNodeId?: string;
+5 -2
View File
@@ -1,4 +1,4 @@
import { requestToolResponse, type ResponseFunctionTool, type ResponseInputMessage } from "@/services/api/image";
import { requestToolResponse, type ResponseFunctionTool, type ResponseInputMessage, type ToolResponseResult } from "@/services/api/image";
import type { AiConfig } from "@/stores/use-config-store";
import {
@@ -31,6 +31,7 @@ const GROUNDING_CONFIDENCE_THRESHOLD = 0.65;
const VERIFICATION_REJECTION_THRESHOLD = 0.75;
export type ArtCritiquePipelineOptions = {
requestStage?: (input: { config: AiConfig; messages: ResponseInputMessage[]; tool: ResponseFunctionTool; toolName: string; signal?: AbortSignal }) => Promise<ToolResponseResult>;
signal?: AbortSignal;
onStage?: (stage: ArtCritiquePipelineStage) => void;
onDraftReport?: (report: ArtCritiqueReport) => void;
@@ -557,7 +558,9 @@ export function applyEditPrompts(issues: readonly ArtCritiqueIssue[], prompts: r
async function requestPipelineStage<T>(config: AiConfig, messages: ResponseInputMessage[], tool: ResponseFunctionTool, toolName: string, parse: (value: unknown) => T, options: ArtCritiquePipelineOptions) {
throwIfAborted(options.signal);
const response = await requestToolResponse(config, messages, [tool], { type: "function", name: toolName }, undefined, { signal: options.signal });
const response = options.requestStage
? await options.requestStage({ config, messages, tool, toolName, signal: options.signal })
: await requestToolResponse(config, messages, [tool], { type: "function", name: toolName }, undefined, { signal: options.signal });
const raw = response.toolCalls.find((candidate) => candidate.function.name === toolName)?.function.arguments || response.content;
if (!raw?.trim()) throw new Error(`${toolName}_missing`);
let value: unknown;