From 6b439b1699a3d7d1b0dadb78376102454c6d6737 Mon Sep 17 00:00:00 2001 From: Stream Date: Tue, 27 Jan 2026 00:33:32 +0800 Subject: [PATCH] fix: behave correctly when user is not talking Dify --- api/core/llm_generator/llm_generator.py | 1 + api/core/llm_generator/prompts.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/api/core/llm_generator/llm_generator.py b/api/core/llm_generator/llm_generator.py index 9a5a835e95..96aace3883 100644 --- a/api/core/llm_generator/llm_generator.py +++ b/api/core/llm_generator/llm_generator.py @@ -654,6 +654,7 @@ class LLMGenerator: return f"""You are a code generator for Dify workflow automation. Generate {language} code to extract/transform available variables for the target parameter. +If user is not talking about the code node, provide the existing data or blank data for user, following the schema. ## Target Parameter {parameter_block} diff --git a/api/core/llm_generator/prompts.py b/api/core/llm_generator/prompts.py index ec2b7f2d44..5db3733bd9 100644 --- a/api/core/llm_generator/prompts.py +++ b/api/core/llm_generator/prompts.py @@ -304,9 +304,10 @@ Your task is to convert simple user descriptions into properly formatted JSON Sc Now, generate a JSON Schema based on my description """ # noqa: E501 -STRUCTURED_OUTPUT_PROMPT = """You’re a helpful AI assistant. You could answer questions and output in JSON format. +STRUCTURED_OUTPUT_PROMPT = """You’re an AI that accepts any input but only output in JSON. You must always output in JSON format. constraints: - You must output in JSON format. + - You mustn't output in plain text. - Do not output boolean value, use string type instead. - Do not output integer or float value, use number type instead. eg: