放宽插件 routing 摘要校验

main
sp mac bookpro 2605 2026-07-22 21:55:08 +08:00
parent a03cc82dd0
commit 9c41dbbada
1 changed files with 2 additions and 11 deletions

View File

@ -121,18 +121,13 @@ function normalizeRouting(value: ToolApiRoutingFormValue | undefined, apiName: s
throw new Error(`API ${apiName} 的路由规则不能为空`);
}
const summary = value.summary?.trim();
if (!summary) {
throw new Error(`API ${apiName} 的路由摘要不能为空`);
}
const useWhen = normalizeStringList(value.useWhen);
if (useWhen.length < 1) {
throw new Error(`API ${apiName} 的 useWhen 至少保留一项`);
}
return {
summary,
summary: value.summary?.trim() || '',
useWhen,
doNotUseWhen: normalizeStringList(value.doNotUseWhen),
};
@ -344,11 +339,7 @@ export default function ExternalToolEditor({ open, agentId, plugin, onClose, onS
</Form.Item>
</div>
<Card size="small" title="routing路由规则">
<Form.Item
label="summary"
name={[field.name, 'routing', 'summary']}
rules={[{ validator: validateTrimmedText('请输入路由摘要') }]}
>
<Form.Item label="summary" name={[field.name, 'routing', 'summary']}>
<Input placeholder="查询商品维度数据" />
</Form.Item>
<Form.List name={[field.name, 'routing', 'useWhen']} rules={[{ validator: validateRoutingList('至少添加一条 useWhen', 1) }]}>