Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: show checklist errors for inline agents without models (#41146)

Joel693e1b0fc54b
diff --git a/web/app/components/workflow/hooks/__tests__/use-checklist.spec.ts b/web/app/components/workflow/hooks/__tests__/use-checklist.spec.ts
index e771d4281dc..8fa549fbb85 100644
--- a/web/app/components/workflow/hooks/__tests__/use-checklist.spec.ts
+++ b/web/app/components/workflow/hooks/__tests__/use-checklist.spec.ts
@@ -225,10 +225,12 @@ function buildConnectedGraph() {
function buildInlineAgentGraph({
difyTools = [],
+ hasModel = true,
hasMissingFile = false,
hasMissingSkill = false,
}: {
difyTools?: AgentSoulDifyToolConfig[]
+ hasModel?: boolean
hasMissingFile?: boolean
hasMissingSkill?: boolean
}) {
@@ -250,6 +252,13 @@ function buildInlineAgentGraph({
}),
zWorkflowAgentComposerResponse.parse({
agent_soul: {
+ model: hasModel
+ ? {
+ model_provider: 'langgenius/openai/openai',
+ model: 'gpt-4o-mini',
+ plugin_id: 'langgenius/openai',
+ }
+ : undefined,
config_files: [
{ file_kind: 'upload_file', name: 'available.pdf' },
...(hasMissingFile
@@ -418,6 +427,21 @@ describe('useChecklist', () => {
})
})
+ it('should report a missing model from inline agents and open their configuration panel', async () => {
+ const { edges, nodeId, nodes, options } = buildInlineAgentGraph({ hasModel: false })
+ const { result } = renderWorkflowHook(() => useChecklist(nodes, edges), options)
+
+ await waitFor(() => {
+ expect(result.current).toEqual([
+ expect.objectContaining({
+ id: nodeId,
+ errorMessages: ['workflow.nodes.agent.modelNotSelected'],
+ openInlineAgentPanel: true,
+ }),
+ ])
+ })
+ })
+
it('should not report available file and skill references from inline agents', () => {
const { edges, nodes, options } = buildInlineAgentGraph({
hasMissingFile: false,
diff --git a/web/app/components/workflow/hooks/use-checklist.ts b/web/app/components/workflow/hooks/use-checklist.ts
index 3ef5178a350..851076b5120 100644
--- a/web/app/components/workflow/hooks/use-checklist.ts
+++ b/web/app/components/workflow/hooks/use-checklist.ts
@@ -216,6 +216,7 @@ export const useChecklist = (nodes: Node[], edges: Edge[], options?: { flowType?
const issuesByNodeId: Record<
string,
{
+ hasMissingModel: boolean
hasMissingFiles: boolean
hasMissingSkills: boolean
toolIssues: AgentToolPublishIssue[]
@@ -227,15 +228,19 @@ export const useChecklist = (nodes: Node[], edges: Edge[], options?: { flowType?
const agentSoul = result.data?.agent_soul
if (!nodeId || !agentSoul) return
+ const agentSoulFormState = agentSoulConfigToFormState(agentSoul)
+ const hasMissingModel = !agentSoulFormState.model
const hasMissingFiles = agentSoul.config_files?.some((file) => file.is_missing === true)
const hasMissingSkills = agentSoul.config_skills?.some((skill) => skill.is_missing === true)
const toolIssues = getAgentToolPublishIssues(
- agentSoulConfigToFormState(agentSoul).tools,
+ agentSoulFormState.tools,
inlineAgentToolProviderCatalog,
)
- if (!hasMissingFiles && !hasMissingSkills && toolIssues.length === 0) return
+ if (!hasMissingModel && !hasMissingFiles && !hasMissingSkills && toolIssues.length === 0)
+ return
issuesByNodeId[nodeId] = {
+ hasMissingModel,
hasMissingFiles: !!hasMissingFiles,
hasMissingSkills: !!hasMissingSkills,
toolIssues,
@@ -429,6 +434,8 @@ export const useChecklist = (nodes: Node[], edges: Edge[], options?: { flowType?
if (validationError) errorMessages.push(validationError)
}
+ if (inlineAgentIssues?.hasMissingModel)
+ errorMessages.push(t(($) => $['nodes.agent.modelNotSelected'], { ns: 'workflow' }))
if (inlineAgentIssues?.hasMissingFiles)
errorMessages.push(
t(($) => $['agentDetail.configure.files.missing'], { ns: 'agentV2' }),