feat(image): 以插件声明统一图片参数、尺寸选择与定价合同 (#760)

* feat(image): 图片参数 - 统一插件声明配置与生成合同

* docs(image): 图片参数 - 说明声明合同与验证边界

* fix(plugins): 图片声明 - 保留内联素材支持并同步制品文档

* fix(image): 参数合同 - 对齐审批意图和尺寸预检调用方

* fix(image): 调用链 - 保留公开意图并接通独立分辨率

* fix(image): 图片参数 - 补齐分辨率接线与目录价格投影
This commit is contained in:
huiku authored and GitHub committed 2026-10-13 19:18:21 +08:00
1 parent 88de4ce422
commit 7466119867
104 files changed
+6013 -568

No files matched your search

@@ -45,6 +45,8 @@ export function agentImageApproval(detail: Record<string, unknown>): AgentImageA
channelId: typeof args.channelId === "string" ? args.channelId : "",
channelModelKey: typeof args.channelModelKey === "string" ? args.channelModelKey : "",
size: args.size,
...(typeof args.imageResolution === "string" ? { imageResolution: args.imageResolution } : {}),
...(typeof args.imageParameters === "string" ? { imageParameters: args.imageParameters } : {}),
quality: typeof args.quality === "string" ? args.quality : "",
prompt: args.prompt,
referenceNodeIds: Array.isArray(args.referenceNodeIds) ? args.referenceNodeIds.filter((id: unknown): id is string => typeof id === "string") : [],
@@ -439,6 +439,8 @@ export function buildGenerationConfig(config: AiConfig, node: CanvasNodeData | u
const requestedConfig: AiConfig = {
...config,
quality: node?.metadata?.quality ?? workflowParameterValue("quality") ?? config.quality ?? defaultConfig.quality,
imageResolution: node?.metadata?.imageResolution ?? workflowParameterValue("imageResolution") ?? config.imageResolution ?? defaultConfig.imageResolution,
imageParameters: node?.metadata?.imageParameters ?? workflowParameterValue("imageParameters") ?? config.imageParameters ?? "{}",
size: workflowProvider === "model" ? (node?.metadata?.size ?? config.size ?? defaultConfig.size) : workflowOutputSize || node?.metadata?.size || config.size || defaultConfig.size,
transparentBackground: node?.metadata?.transparentBackground ?? config.transparentBackground ?? defaultConfig.transparentBackground,
videoSeconds:
@@ -475,6 +477,8 @@ export function buildGenerationConfig(config: AiConfig, node: CanvasNodeData | u
mode === "image"
? {
size: node?.metadata?.size,
imageResolution: node?.metadata?.imageResolution,
imageParameters: node?.metadata?.imageParameters,
quality: node?.metadata?.quality,
transparentBackground: node?.metadata?.transparentBackground,
count: requestedConfig.count,
@@ -488,6 +492,8 @@ export function buildGenerationConfig(config: AiConfig, node: CanvasNodeData | u
},
{
size: requestedConfig.size,
imageResolution: requestedConfig.imageResolution,
imageParameters: requestedConfig.imageParameters,
quality: requestedConfig.quality,
transparentBackground: requestedConfig.transparentBackground,
count: requestedConfig.count,
@@ -521,6 +527,8 @@ export function buildGenerationConfig(config: AiConfig, node: CanvasNodeData | u
runningHub,
model,
quality: generationDefaults.quality || requestedConfig.quality,
imageResolution: generationDefaults.imageResolution || requestedConfig.imageResolution,
imageParameters: generationDefaults.imageParameters ?? requestedConfig.imageParameters,
size: generationDefaults.size ?? requestedConfig.size,
transparentBackground: generationDefaults.transparentBackground || (requestedConfig.transparentBackground === "true" ? "true" : "false"),
videoSeconds: generationDefaults.videoSeconds ?? requestedConfig.videoSeconds,
@@ -6,6 +6,8 @@ export type ModelSelection = { kind: "logical"; logicalModelId: string; channelI
export type Options = {
size?: string;
imageResolution?: string;
imageParameters?: string;
quality?: string;
count?: number;
transparentBackground?: boolean;
@@ -53,6 +55,24 @@ export const GENERATION_OPTION_FIELDS = [
"node": "size",
"task": "size"
},
{
"kind": "string",
"modes": [
"image"
],
"name": "imageResolution",
"node": "imageResolution",
"task": "imageResolution"
},
{
"kind": "string",
"modes": [
"image"
],
"name": "imageParameters",
"node": "imageParameters",
"task": "imageParameters"
},
{
"kind": "string",
"modes": [
@@ -199,6 +199,7 @@ export function synchronizeGenerationSpec(node: CanvasNodeData, patch: Partial<C
if (Object.prototype.hasOwnProperty.call(patch, "composerContent") && typeof patch.composerContent === "string") next.prompt = patch.composerContent;
else if (Object.prototype.hasOwnProperty.call(patch, "prompt") && typeof patch.prompt === "string") next.prompt = patch.prompt;
if (Object.prototype.hasOwnProperty.call(patch, "model")) {
if (patch.model !== node.metadata?.model && !Object.prototype.hasOwnProperty.call(patch, "imageParameters")) delete next.options.imageParameters;
const model = patch.model ? decodeChannelModel(patch.model) : null;
next.modelSelection = model ? { kind: "channel", channelId: model.channelId, modelKey: model.model } : undefined;
delete (metadata as Record<string, unknown>).logicalModelId;