Refactor AI Agent configuration and workflow handling

- Removed runtime mode handling from AIAgentConfigWorkbench and related components.
- Updated tests to reflect changes in AI Agent policy copy and configuration.
- Changed terminology from "workflow" to "revision" in various components and API responses.
- Simplified agent binding logic in channel editing.
- Cleaned up unused variables and types related to runtime modes.
- Updated localization files for consistency with new terminology.
This commit is contained in:
mlogclub
2026-07-27 23:29:02 +08:00
parent 241f274927
commit 847f688398
97 changed files with 1666 additions and 5941 deletions
@@ -254,14 +254,7 @@ function buildPayload(form: EditForm, status: number, t: Translate): CreateAdmin
}
function isAgentChannelBindable(agent: AIAgent | undefined) {
if (!agent) return false
if (agent.runtimeMode === "autonomous") {
return agent.publishedRevisionId > 0
}
if (agent.runtimeMode === "hybrid") {
return agent.publishedRevisionId > 0 && agent.workflowVersionId > 0
}
return Boolean(agent.workflowPublished ?? agent.workflowVersionId > 0)
return Boolean(agent && agent.publishedRevisionId > 0)
}
type ChannelFormBodyProps = Omit<ChannelFormDialogProps, "open">
@@ -431,7 +424,7 @@ function ChannelFormBody({
const aiAgentOptions = availableAIAgents.map((item) => ({
value: String(item.id),
label: isAgentChannelBindable(item)
? `${item.name} · 当前生效 #${item.workflowVersionId}`
? `${item.name} · Revision #${item.publishedRevisionId}`
: `${item.name} · 未发布`,
}))
const wxWorkKFAccountOptions = wxWorkKFAccounts.map((item) => ({
@@ -557,15 +550,15 @@ function ChannelFormBody({
/>
{selectedAIAgent && !isAgentChannelBindable(selectedAIAgent) ? (
<div className="rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-900">
Agent AI Agent
Agent AI Agent Revision
</div>
) : null}
{selectedAIAgent && isAgentChannelBindable(selectedAIAgent) ? (
<div className="flex items-center gap-2 text-xs text-muted-foreground">
<Badge variant="secondary">
{selectedAIAgent.runtimeMode === "autonomous" ? "已发布" : selectedAIAgent.workflowStateText || "已发布"}
</Badge>
<span>{selectedAIAgent.runtimeMode === "autonomous" ? `当前版本 #${selectedAIAgent.publishedRevisionId}` : `当前生效版本 #${selectedAIAgent.workflowVersionId}`}</span>
<span>Revision #{selectedAIAgent.publishedRevisionId}</span>
</div>
) : null}
<FieldError errors={[errors.aiAgentId]} />