refactor: simplify agent workflow settings

This commit is contained in:
mlogclub
2026-06-22 16:33:30 +08:00
parent 082a036ce1
commit 44935d2141
@@ -147,8 +147,6 @@ export function AIAgentConfigWorkbench({
const [selectedSkillIds, setSelectedSkillIds] = useState<number[]>([]) const [selectedSkillIds, setSelectedSkillIds] = useState<number[]>([])
const [directTools, setDirectTools] = useState<DirectToolItem[]>([]) const [directTools, setDirectTools] = useState<DirectToolItem[]>([])
const [workflowName, setWorkflowName] = useState("")
const [workflowDescription, setWorkflowDescription] = useState("")
const [definition, setDefinition] = useState<AIWorkflowDefinition>(emptyDefinition) const [definition, setDefinition] = useState<AIWorkflowDefinition>(emptyDefinition)
const [aiConfigs, setAIConfigs] = useState<AIConfig[]>([]) const [aiConfigs, setAIConfigs] = useState<AIConfig[]>([])
@@ -214,8 +212,6 @@ export function AIAgentConfigWorkbench({
setSelectedTeamIds([]) setSelectedTeamIds([])
setSelectedSkillIds([]) setSelectedSkillIds([])
setDirectTools([]) setDirectTools([])
setWorkflowName("新建 Agent 会话流程")
setWorkflowDescription("")
setDefinition(emptyDefinition) setDefinition(emptyDefinition)
setValidation(null) setValidation(null)
return return
@@ -242,8 +238,6 @@ export function AIAgentConfigWorkbench({
setSelectedTeamIds((agentDetail.teams ?? []).map((team) => team.id)) setSelectedTeamIds((agentDetail.teams ?? []).map((team) => team.id))
setSelectedSkillIds(agentDetail.skillIds ?? []) setSelectedSkillIds(agentDetail.skillIds ?? [])
setDirectTools(agentDetail.directTools ?? []) setDirectTools(agentDetail.directTools ?? [])
setWorkflowName(workflowDetail.name || `${agentDetail.name} 会话流程`)
setWorkflowDescription(workflowDetail.description || "")
setDefinition(workflowDetail.draftDefinition ?? emptyDefinition) setDefinition(workflowDetail.draftDefinition ?? emptyDefinition)
setValidation(null) setValidation(null)
} catch (error) { } catch (error) {
@@ -420,8 +414,8 @@ export function AIAgentConfigWorkbench({
try { try {
const saved = await saveAIAgentWorkflow({ const saved = await saveAIAgentWorkflow({
agentId: currentAgentId, agentId: currentAgentId,
name: workflowName, name: "",
description: workflowDescription, description: "",
definition, definition,
}) })
setWorkflow(saved) setWorkflow(saved)
@@ -454,8 +448,8 @@ export function AIAgentConfigWorkbench({
try { try {
await saveAIAgentWorkflow({ await saveAIAgentWorkflow({
agentId: currentAgentId, agentId: currentAgentId,
name: workflowName, name: "",
description: workflowDescription, description: "",
definition, definition,
}) })
const version = await publishAIAgentWorkflow(currentAgentId, definition) const version = await publishAIAgentWorkflow(currentAgentId, definition)
@@ -725,9 +719,11 @@ export function AIAgentConfigWorkbench({
{activeSection === "workflow" ? ( {activeSection === "workflow" ? (
<div className="flex h-full min-h-0 flex-col"> <div className="flex h-full min-h-0 flex-col">
<div className="flex shrink-0 items-center justify-between border-b px-4 py-3"> <div className="flex shrink-0 items-center justify-between border-b px-4 py-3">
<div className="grid min-w-0 flex-1 grid-cols-2 gap-3"> <div className="min-w-0 flex-1">
<Input value={workflowName} onChange={(event) => setWorkflowName(event.target.value)} /> <div className="truncate text-sm font-medium"></div>
<Input value={workflowDescription} placeholder="流程描述" onChange={(event) => setWorkflowDescription(event.target.value)} /> <div className="mt-1 truncate text-xs text-muted-foreground">
Agent
</div>
</div> </div>
<div className="ml-3 flex items-center gap-2"> <div className="ml-3 flex items-center gap-2">
{validation ? ( {validation ? (