Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix(agent): require model selection for templates (#20278)

Sbaaoui Idriss000dea231158
diff --git a/agent/templates/advanced_ingestion_pipeline.json b/agent/templates/advanced_ingestion_pipeline.json
index 1c666ac921..68ac23a2a8 100644
--- a/agent/templates/advanced_ingestion_pipeline.json
+++ b/agent/templates/advanced_ingestion_pipeline.json
@@ -44,7 +44,7 @@
"sys_prompt": "Extract important structured information from the given content. Output ONLY a valid JSON string with no additional text. If no important structured information is found, output an empty JSON object: {}.\n\nImportant structured information may include: names, dates, locations, events, key facts, numerical data, or other extractable entities.",
"temperature": 0.1,
"temperatureEnabled": true,
- "tenant_llm_id": 63,
+ "tenant_llm_id": null,
"topPEnabled": true,
"top_p": 0.3
}
@@ -83,7 +83,7 @@
"sys_prompt": "Act as a precise summarizer. Your task is to create a summary of the provided content that is both concise and faithful to the original.\n\nKey Instructions:\n1. Accuracy: Strictly base the summary on the information given. Do not introduce any new facts, conclusions, or interpretations that are not explicitly stated.\n2. Language: Write the summary in the same language as the source text.\n3. Objectivity: Present the key points without bias, preserving the original intent and tone of the content. Do not editorialize.\n4. Conciseness: Focus on the most important ideas, omitting minor details and fluff.",
"temperature": 0.1,
"temperatureEnabled": true,
- "tenant_llm_id": 63,
+ "tenant_llm_id": null,
"topPEnabled": true,
"top_p": 0.3
}
@@ -122,7 +122,7 @@
"sys_prompt": "Role\nYou are a text analyzer.\n\nTask\nExtract the most important keywords/phrases of a given piece of text content.\n\nRequirements\n- Summarize the text content, and give the top 5 important keywords/phrases.\n- The keywords MUST be in the same language as the given piece of text content.\n- The keywords are delimited by ENGLISH COMMA.\n- Output keywords ONLY.",
"temperature": 0.1,
"temperatureEnabled": true,
- "tenant_llm_id": 63,
+ "tenant_llm_id": null,
"topPEnabled": true,
"top_p": 0.3
}
@@ -161,7 +161,7 @@
"sys_prompt": "Role\nYou are a text analyzer.\n\nTask\nPropose 3 questions about a given piece of text content.\n\nRequirements\n- Understand and summarize the text content, and propose the top 3 important questions.\n- The questions SHOULD NOT have overlapping meanings.\n- The questions SHOULD cover the main content of the text as much as possible.\n- The questions MUST be in the same language as the given piece of text content.\n- One question per line.\n- Output questions ONLY.",
"temperature": 0.1,
"temperatureEnabled": true,
- "tenant_llm_id": 63,
+ "tenant_llm_id": null,
"topPEnabled": true,
"top_p": 0.3
}
@@ -629,7 +629,7 @@
"sys_prompt": "Act as a precise summarizer. Your task is to create a summary of the provided content that is both concise and faithful to the original.\n\nKey Instructions:\n1. Accuracy: Strictly base the summary on the information given. Do not introduce any new facts, conclusions, or interpretations that are not explicitly stated.\n2. Language: Write the summary in the same language as the source text.\n3. Objectivity: Present the key points without bias, preserving the original intent and tone of the content. Do not editorialize.\n4. Conciseness: Focus on the most important ideas, omitting minor details and fluff.",
"temperature": 0.1,
"temperatureEnabled": true,
- "tenant_llm_id": 63,
+ "tenant_llm_id": null,
"topPEnabled": true,
"top_p": 0.3
},
@@ -671,7 +671,7 @@
"sys_prompt": "Role\nYou are a text analyzer.\n\nTask\nExtract the most important keywords/phrases of a given piece of text content.\n\nRequirements\n- Summarize the text content, and give the top 5 important keywords/phrases.\n- The keywords MUST be in the same language as the given piece of text content.\n- The keywords are delimited by ENGLISH COMMA.\n- Output keywords ONLY.",
"temperature": 0.1,
"temperatureEnabled": true,
- "tenant_llm_id": 63,
+ "tenant_llm_id": null,
"topPEnabled": true,
"top_p": 0.3
},
@@ -714,7 +714,7 @@
"sys_prompt": "Role\nYou are a text analyzer.\n\nTask\nPropose 3 questions about a given piece of text content.\n\nRequirements\n- Understand and summarize the text content, and propose the top 3 important questions.\n- The questions SHOULD NOT have overlapping meanings.\n- The questions SHOULD cover the main content of the text as much as possible.\n- The questions MUST be in the same language as the given piece of text content.\n- One question per line.\n- Output questions ONLY.",
"temperature": 0.1,
"temperatureEnabled": true,
- "tenant_llm_id": 63,
+ "tenant_llm_id": null,
"topPEnabled": true,
"top_p": 0.3
},
@@ -757,7 +757,7 @@
"sys_prompt": "Extract important structured information from the given content. Output ONLY a valid JSON string with no additional text. If no important structured information is found, output an empty JSON object: {}.\n\nImportant structured information may include: names, dates, locations, events, key facts, numerical data, or other extractable entities.",
"temperature": 0.1,
"temperatureEnabled": true,
- "tenant_llm_id": 63,
+ "tenant_llm_id": null,
"topPEnabled": true,
"top_p": 0.3
},
diff --git a/agent/templates/cajal_scientific_paper_agent.json b/agent/templates/cajal_scientific_paper_agent.json
index 0e879a60b2..5a30ed82b0 100644
--- a/agent/templates/cajal_scientific_paper_agent.json
+++ b/agent/templates/cajal_scientific_paper_agent.json
@@ -32,7 +32,7 @@
"exception_method": null,
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.5,
- "llm_id": "agnuxo/cajal-4b-p2pclaw@Ollama",
+ "llm_id": "",
"maxTokensEnabled": true,
"max_retries": 3,
"max_rounds": 3,
@@ -222,7 +222,7 @@
"exception_method": null,
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.5,
- "llm_id": "agnuxo/cajal-4b-p2pclaw@Ollama",
+ "llm_id": "",
"maxTokensEnabled": true,
"max_retries": 3,
"max_rounds": 3,
diff --git a/agent/templates/chunk_summary.json b/agent/templates/chunk_summary.json
index 891cf3f686..7be45c4e80 100644
--- a/agent/templates/chunk_summary.json
+++ b/agent/templates/chunk_summary.json
@@ -44,7 +44,7 @@
"sys_prompt": "Act as a precise summarizer. Your task is to create a summary of the provided content that is both concise and faithful to the original.\n\nKey Instructions:\n1. Accuracy: Strictly base the summary on the information given. Do not introduce any new facts, conclusions, or interpretations that are not explicitly stated.\n2. Language: Write the summary in the same language as the source text.\n3. Objectivity: Present the key points without bias, preserving the original intent and tone of the content. Do not editorialize.\n4. Conciseness: Focus on the most important ideas, omitting minor details and fluff.",
"temperature": 0.1,
"temperatureEnabled": true,
- "tenant_llm_id": 63,
+ "tenant_llm_id": null,
"topPEnabled": true,
"top_p": 0.3
}
@@ -510,7 +510,7 @@
"sys_prompt": "Act as a precise summarizer. Your task is to create a summary of the provided content that is both concise and faithful to the original.\n\nKey Instructions:\n1. Accuracy: Strictly base the summary on the information given. Do not introduce any new facts, conclusions, or interpretations that are not explicitly stated.\n2. Language: Write the summary in the same language as the source text.\n3. Objectivity: Present the key points without bias, preserving the original intent and tone of the content. Do not editorialize.\n4. Conciseness: Focus on the most important ideas, omitting minor details and fluff.",
"temperature": 0.1,
"temperatureEnabled": true,
- "tenant_llm_id": 63,
+ "tenant_llm_id": null,
"topPEnabled": true,
"top_p": 0.3
},
diff --git a/agent/templates/customer_feedback_dispatcher.json b/agent/templates/customer_feedback_dispatcher.json
index b3d261b7f1..d05b99a7b7 100644
--- a/agent/templates/customer_feedback_dispatcher.json
+++ b/agent/templates/customer_feedback_dispatcher.json
@@ -50,7 +50,7 @@
},
"query": "begin@customer_review",
"temperature": 0,
- "tenant_llm_id": 90
+ "tenant_llm_id": null
}
},
"upstream": [
@@ -94,7 +94,7 @@
}
},
"query": "begin@customer_review",
- "tenant_llm_id": 90
+ "tenant_llm_id": null
}
},
"upstream": [
@@ -339,7 +339,7 @@
"query": "begin@customer_review",
"temperature": 0.2,
"temperatureEnabled": false,
- "tenant_llm_id": 90,
+ "tenant_llm_id": null,
"topPEnabled": false,
"top_p": 0.75
},
@@ -403,7 +403,7 @@
"query": "begin@customer_review",
"temperature": 0,
"temperatureEnabled": true,
- "tenant_llm_id": 90,
+ "tenant_llm_id": null,
"topPEnabled": false,
"top_p": 0.3
},
diff --git a/agent/templates/data_analysis_beginner_assistant.json b/agent/templates/data_analysis_beginner_assistant.json
index 64d958dbb8..5be884f3b1 100644
--- a/agent/templates/data_analysis_beginner_assistant.json
+++ b/agent/templates/data_analysis_beginner_assistant.json
@@ -28,7 +28,7 @@
"exception_method": "",
"frequencyPenaltyEnabled": true,
"frequency_penalty": 0.5,
- "llm_id": "kimi-k2.5@Moonshot",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 1,
@@ -54,7 +54,7 @@
"sys_prompt": "<role>\n You are an expert Data Analyst AI assistant, specialized in extracting insights from structured and unstructured data.\n Your core competencies include statistical analysis, data cleaning, exploratory data analysis (EDA), hypothesis testing, \n predictive modeling, and data visualization. You translate raw data into actionable business intelligence with rigorous \n methodological transparency.\n</role>\n\n<instructions>\n 1. **Understand**: Clarify the analytical objectives, data sources, and success metrics with the user.\n 2. **Data Assessment**: Evaluate data quality (completeness, consistency, outliers) and perform necessary cleaning/validation.\n 3. **Exploratory Analysis**: Decompose the dataset into logical segments; calculate descriptive statistics and identify patterns, correlations, or anomalies.\n 4. **Analytical Execution**: \n - Use `CodeExec` (Python) for all computational tasks—never rely on mental arithmetic for complex calculations.\n - Apply appropriate statistical methods (regression, clustering, time-series analysis, etc.) based on data type and business question.\n 5. **Visualization**: Generate clear, publication-ready charts and graphs using the coding environment to illustrate findings visually.\n 6. **Validation**: Verify statistical significance, check for biases, validate assumptions, and ensure reproducibility of results.\n 7. **Synthesis**: Summarize insights in business-friendly language, highlight limitations of the analysis, and provide data-driven recommendations.\n</instructions>\n\n<constraints>\n - Always execute data processing and calculations via code; never guess or approximate numerical results.\n - All visualizations must be generated programmatically and returned as renderable outputs.\n - Cite data sources and methodologies; flag any data quality issues that may affect interpretation.\n</constraints>",
"temperature": 0.2,
"temperatureEnabled": true,
- "tenant_llm_id": 598,
+ "tenant_llm_id": null,
"tools": [
{
"component_name": "CodeExec",
@@ -176,7 +176,7 @@
"exception_method": "",
"frequencyPenaltyEnabled": true,
"frequency_penalty": 0.5,
- "llm_id": "kimi-k2.5@Moonshot",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 1,
@@ -202,7 +202,7 @@
"sys_prompt": "<role>\n You are an expert Data Analyst AI assistant, specialized in extracting insights from structured and unstructured data.\n Your core competencies include statistical analysis, data cleaning, exploratory data analysis (EDA), hypothesis testing, \n predictive modeling, and data visualization. You translate raw data into actionable business intelligence with rigorous \n methodological transparency.\n</role>\n\n<instructions>\n 1. **Understand**: Clarify the analytical objectives, data sources, and success metrics with the user.\n 2. **Data Assessment**: Evaluate data quality (completeness, consistency, outliers) and perform necessary cleaning/validation.\n 3. **Exploratory Analysis**: Decompose the dataset into logical segments; calculate descriptive statistics and identify patterns, correlations, or anomalies.\n 4. **Analytical Execution**: \n - Use `CodeExec` (Python) for all computational tasks—never rely on mental arithmetic for complex calculations.\n - Apply appropriate statistical methods (regression, clustering, time-series analysis, etc.) based on data type and business question.\n 5. **Visualization**: Generate clear, publication-ready charts and graphs using the coding environment to illustrate findings visually.\n 6. **Validation**: Verify statistical significance, check for biases, validate assumptions, and ensure reproducibility of results.\n 7. **Synthesis**: Summarize insights in business-friendly language, highlight limitations of the analysis, and provide data-driven recommendations.\n</instructions>\n\n<constraints>\n - Always execute data processing and calculations via code; never guess or approximate numerical results.\n - All visualizations must be generated programmatically and returned as renderable outputs.\n - Cite data sources and methodologies; flag any data quality issues that may affect interpretation.\n</constraints>",
"temperature": 0.2,
"temperatureEnabled": true,
- "tenant_llm_id": 598,
+ "tenant_llm_id": null,
"tools": [
{
"component_name": "CodeExec",
diff --git a/agent/templates/deep_research.json b/agent/templates/deep_research.json
index d9cd33001d..1b76fe7b48 100644
--- a/agent/templates/deep_research.json
+++ b/agent/templates/deep_research.json
@@ -32,7 +32,7 @@
"exception_method": null,
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.5,
- "llm_id": "qwen-max@Tongyi-Qianwen",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 3,
@@ -71,7 +71,7 @@
"exception_method": null,
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.5,
- "llm_id": "qwen-plus@Tongyi-Qianwen",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 1,
@@ -146,7 +146,7 @@
"exception_method": null,
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.5,
- "llm_id": "moonshot-v1-auto@Moonshot",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 3,
@@ -200,7 +200,7 @@
"exception_method": null,
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.5,
- "llm_id": "moonshot-v1-128k@Moonshot",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 3,
@@ -410,7 +410,7 @@
"exception_method": null,
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.5,
- "llm_id": "qwen-max@Tongyi-Qianwen",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 3,
@@ -470,7 +470,7 @@
"exception_method": null,
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.5,
- "llm_id": "qwen-plus@Tongyi-Qianwen",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 1,
@@ -560,7 +560,7 @@
"exception_method": null,
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.5,
- "llm_id": "moonshot-v1-auto@Moonshot",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 3,
@@ -629,7 +629,7 @@
"exception_method": null,
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.5,
- "llm_id": "moonshot-v1-128k@Moonshot",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 3,
diff --git a/agent/templates/photo_text_translator.json b/agent/templates/photo_text_translator.json
index fcb6d71b30..148c819467 100644
--- a/agent/templates/photo_text_translator.json
+++ b/agent/templates/photo_text_translator.json
@@ -26,7 +26,7 @@
"frequency_penalty": 0.7,
"frequencyPenaltyEnabled": false,
"llm_filter": "image2text",
- "llm_id": "qwen-vl-plus@Tongyi-Qianwen",
+ "llm_id": "",
"max_retries": 3,
"max_rounds": 5,
"max_tokens": 256,
@@ -158,7 +158,7 @@
"frequency_penalty": 0.7,
"frequencyPenaltyEnabled": false,
"llm_filter": "image2text",
- "llm_id": "qwen-vl-plus@Tongyi-Qianwen",
+ "llm_id": "",
"max_retries": 3,
"max_rounds": 5,
"max_tokens": 256,
diff --git a/agent/templates/reflective_academic_paper_generator.json b/agent/templates/reflective_academic_paper_generator.json
index acede49fc2..acf2f9864a 100644
--- a/agent/templates/reflective_academic_paper_generator.json
+++ b/agent/templates/reflective_academic_paper_generator.json
@@ -32,7 +32,7 @@
"exception_method": null,
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.5,
- "llm_id": "qwen3-235b-a22b-instruct-2507@Tongyi-Qianwen",
+ "llm_id": "",
"maxTokensEnabled": true,
"max_retries": 3,
"max_rounds": 3,
@@ -233,7 +233,7 @@
"exception_method": null,
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.5,
- "llm_id": "qwen3-235b-a22b-instruct-2507@Tongyi-Qianwen",
+ "llm_id": "",
"maxTokensEnabled": true,
"max_retries": 3,
"max_rounds": 3,
diff --git a/agent/templates/smart_customer_service_specialist.json b/agent/templates/smart_customer_service_specialist.json
index 00ffb92c43..83ecde5964 100644
--- a/agent/templates/smart_customer_service_specialist.json
+++ b/agent/templates/smart_customer_service_specialist.json
@@ -28,7 +28,7 @@
"exception_method": "",
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.7,
- "llm_id": "deepseek-v4-pro@default@DeepSeek",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 1,
@@ -78,7 +78,7 @@
"exception_method": "",
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.7,
- "llm_id": "deepseek-v4-pro@default@DeepSeek",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 1,
@@ -128,7 +128,7 @@
"exception_method": "",
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.7,
- "llm_id": "deepseek-v4-pro@default@DeepSeek",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 1,
@@ -201,7 +201,7 @@
]
}
},
- "llm_id": "deepseek-v4-pro@default@DeepSeek",
+ "llm_id": "",
"message_history_window_size": 1,
"outputs": {
"category_name": {
@@ -547,7 +547,7 @@
"uuid": "81a65fca-a460-4a3b-a4d5-50e76da760bb"
}
],
- "llm_id": "deepseek-v4-pro@default@DeepSeek",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_tokens": 256,
"message_history_window_size": 1,
@@ -634,7 +634,7 @@
"exception_method": "",
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.7,
- "llm_id": "deepseek-v4-pro@default@DeepSeek",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 1,
@@ -732,7 +732,7 @@
"exception_method": "",
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.7,
- "llm_id": "deepseek-v4-pro@default@DeepSeek",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 1,
@@ -791,7 +791,7 @@
"exception_method": "",
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.7,
- "llm_id": "deepseek-v4-pro@default@DeepSeek",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 1,
diff --git a/agent/templates/stock_market_research_assistant.json b/agent/templates/stock_market_research_assistant.json
index 30a46ab0a4..8f0a934391 100644
--- a/agent/templates/stock_market_research_assistant.json
+++ b/agent/templates/stock_market_research_assistant.json
@@ -108,7 +108,7 @@
"exception_method": "",
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.7,
- "llm_id": "kimi-k2-turbo-preview@Moonshot",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 1,
@@ -151,7 +151,7 @@
"exception_method": "",
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.7,
- "llm_id": "kimi-k2-turbo-preview@Moonshot",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 1,
@@ -796,7 +796,7 @@
"exception_method": "",
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.7,
- "llm_id": "kimi-k2-turbo-preview@Moonshot",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 1,
@@ -976,7 +976,7 @@
"exception_method": "",
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.7,
- "llm_id": "kimi-k2-turbo-preview@Moonshot",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 1,
diff --git a/agent/templates/text2sql_data_expert.json b/agent/templates/text2sql_data_expert.json
index e4b3883334..e7174eb9d9 100644
--- a/agent/templates/text2sql_data_expert.json
+++ b/agent/templates/text2sql_data_expert.json
@@ -25,7 +25,7 @@
"exception_method": "",
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.7,
- "llm_id": "qwen-max@Tongyi-Qianwen",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 5,
@@ -468,7 +468,7 @@
"exception_method": "",
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.7,
- "llm_id": "qwen-max@Tongyi-Qianwen",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 5,
diff --git a/agent/templates/title_chunker.json b/agent/templates/title_chunker.json
index db865727ef..cc9bd7eb7c 100644
--- a/agent/templates/title_chunker.json
+++ b/agent/templates/title_chunker.json
@@ -44,7 +44,7 @@
"sys_prompt": "Act as a precise summarizer. Your task is to create a summary of the provided content that is both concise and faithful to the original.\n\nKey Instructions:\n1. Accuracy: Strictly base the summary on the information given. Do not introduce any new facts, conclusions, or interpretations that are not explicitly stated.\n2. Language: Write the summary in the same language as the source text.\n3. Objectivity: Present the key points without bias, preserving the original intent and tone of the content. Do not editorialize.\n4. Conciseness: Focus on the most important ideas, omitting minor details and fluff.",
"temperature": 0.1,
"temperatureEnabled": true,
- "tenant_llm_id": 63,
+ "tenant_llm_id": null,
"topPEnabled": true,
"top_p": 0.3
}
@@ -585,7 +585,7 @@
"sys_prompt": "Act as a precise summarizer. Your task is to create a summary of the provided content that is both concise and faithful to the original.\n\nKey Instructions:\n1. Accuracy: Strictly base the summary on the information given. Do not introduce any new facts, conclusions, or interpretations that are not explicitly stated.\n2. Language: Write the summary in the same language as the source text.\n3. Objectivity: Present the key points without bias, preserving the original intent and tone of the content. Do not editorialize.\n4. Conciseness: Focus on the most important ideas, omitting minor details and fluff.",
"temperature": 0.1,
"temperatureEnabled": true,
- "tenant_llm_id": 63,
+ "tenant_llm_id": null,
"topPEnabled": true,
"top_p": 0.3
},
diff --git a/agent/templates/user_interaction.json b/agent/templates/user_interaction.json
index 2328d84bf4..da94c6894b 100644
--- a/agent/templates/user_interaction.json
+++ b/agent/templates/user_interaction.json
@@ -28,7 +28,7 @@
"exception_method": "",
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.7,
- "llm_id": "qwen-turbo@Tongyi-Qianwen",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 1,
@@ -79,7 +79,7 @@
"exception_method": "",
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.7,
- "llm_id": "qwen-turbo@Tongyi-Qianwen",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 1,
@@ -290,7 +290,7 @@
"exception_method": "",
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.7,
- "llm_id": "qwen-turbo@Tongyi-Qianwen",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 1,
@@ -390,7 +390,7 @@
"exception_method": "",
"frequencyPenaltyEnabled": false,
"frequency_penalty": 0.7,
- "llm_id": "qwen-turbo@Tongyi-Qianwen",
+ "llm_id": "",
"maxTokensEnabled": false,
"max_retries": 3,
"max_rounds": 1,
diff --git a/web/src/pages/agents/agent-templates.tsx b/web/src/pages/agents/agent-templates.tsx
index df6206ae84..14d5c71fa3 100644
--- a/web/src/pages/agents/agent-templates.tsx
+++ b/web/src/pages/agents/agent-templates.tsx
@@ -11,6 +11,7 @@ import { TemplateCard } from './template-card';
import {
bindUnboundRetrieval,
collectUnboundRetrievalBindings,
+ bindUnboundModel,
} from './template-retrieval-binding';
import { MenuItemKey, SideBar } from './template-sidebar';
@@ -49,6 +50,7 @@ export default function AgentTemplates() {
const dsl = template?.dsl;
const canvasCategory = template?.canvas_category;
const memoryIds: string[] = payload?.memory_ids ?? [];
+ const modelId: string = payload?.llm_id ?? '';
const datasetBlocks = collectUnboundRetrievalBindings(dsl).datasetBlocks;
const datasetBindings = Object.fromEntries(
datasetBlocks.map((block, index) => [
@@ -58,12 +60,13 @@ export default function AgentTemplates() {
: (payload?.dataset_bindings?.[index] ?? []),
]),
);
- const boundDsl =
+ let boundDsl =
dsl &&
(Object.values(datasetBindings).some((ids) => ids.length > 0) ||
memoryIds.length > 0)
? bindUnboundRetrieval(dsl, datasetBindings, memoryIds)
: dsl;
+ boundDsl = bindUnboundModel(boundDsl, modelId);
const ret = await setAgent({
title: payload.name,
diff --git a/web/src/pages/agents/create-agent-dialog.tsx b/web/src/pages/agents/create-agent-dialog.tsx
index 13c97c2ca4..f99cbf8896 100644
--- a/web/src/pages/agents/create-agent-dialog.tsx
+++ b/web/src/pages/agents/create-agent-dialog.tsx
@@ -10,7 +10,10 @@ import { BrainCircuit, Route } from 'lucide-react';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { CreateAgentForm, CreateAgentFormProps } from './create-agent-form';
-import { collectUnboundRetrievalBindings } from './template-retrieval-binding';
+import {
+ collectUnboundRetrievalBindings,
+ countUnboundModel,
+} from './template-retrieval-binding';
type CreateAgentDialogProps = CreateAgentFormProps & {
canvasCategory?: AgentCategory;
@@ -31,6 +34,10 @@ export function CreateAgentDialog({
template ? collectUnboundRetrievalBindings(template.dsl) : undefined,
[template],
);
+ const modelBindings = useMemo(
+ () => (template ? countUnboundModel(template.dsl) : undefined),
+ [template],
+ );
const dialogTitle =
canvasCategory === AgentCategory.DataflowCanvas
@@ -61,6 +68,7 @@ export function CreateAgentDialog({
loading={loading}
showTypeCards={!canvasCategory}
retrievalBindings={retrievalBindings}
+ modelBindings={modelBindings}
></CreateAgentForm>
</DialogContent>
</Dialog>
diff --git a/web/src/pages/agents/create-agent-form.tsx b/web/src/pages/agents/create-agent-form.tsx
index 42f1851cb8..d78d0cd6cc 100644
--- a/web/src/pages/agents/create-agent-form.tsx
+++ b/web/src/pages/agents/create-agent-form.tsx
@@ -6,6 +6,7 @@ import { useForm, useWatch } from 'react-hook-form';
import { z } from 'zod';
import { KnowledgeBaseFormField } from '@/components/knowledge-base-item';
+import { ModelTreeSelectFormField } from '@/components/model-tree-select';
import { MemoriesFormField } from '@/components/memories-form-field';
import { RAGFlowFormItem } from '@/components/ragflow-form';
import { Button, ButtonLoading } from '@/components/ui/button';
@@ -22,7 +23,10 @@ import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router';
import { FlowType, FlowTypeConfig } from './constant';
import { NameFormField, NameFormSchema } from './name-form-field';
-import { RetrievalBindings } from './template-retrieval-binding';
+import {
+ ModelBindingCount,
+ RetrievalBindings,
+} from './template-retrieval-binding';
export type CreateAgentFormProps = IModalProps<any> & {
loading?: boolean;
@@ -31,6 +35,7 @@ export type CreateAgentFormProps = IModalProps<any> & {
// set, the form asks the user to bind them before creating the agent, so
// the canvas never ends up with a retrieval that fails at runtime.
retrievalBindings?: RetrievalBindings;
+ modelBindings?: ModelBindingCount;
};
type FlowTypeCardProps = {
@@ -91,6 +96,7 @@ export const FormSchema = z.object({
dataset_ids: z.array(z.string()).optional(),
dataset_bindings: z.array(z.array(z.string())).optional(),
memory_ids: z.array(z.string()).optional(),
+ llm_id: z.string().optional(),
});
export type FormSchemaType = z.infer<typeof FormSchema>;
@@ -101,6 +107,7 @@ export function CreateAgentForm({
loading,
showTypeCards = false,
retrievalBindings,
+ modelBindings,
}: CreateAgentFormProps) {
const { t } = useTranslation();
const navigate = useNavigate();
@@ -114,12 +121,20 @@ export function CreateAgentForm({
// Compilation operators are configured on the edit-next page, so the dialog
// skips the name field and turns the submit button into a navigation step.
const isCompiler = showTypeCards && selectedType === FlowType.Compiler;
+ const modelRequired = (modelBindings?.modelCount ?? 0) > 0;
const handleNext = useCallback(() => {
navigate(`${Routes.CompilationTemplatesEditNext}?source=agents`);
}, [navigate]);
async function onSubmit(data: FormSchemaType) {
+ if (modelRequired && !data.llm_id) {
+ form.setError('llm_id', {
+ type: 'manual',
+ message: t('common.pleaseSelect'),
+ });
+ return;
+ }
const datasetBlocks = retrievalBindings?.datasetBlocks ?? [];
if (datasetBlocks.length === 1 && isEmpty(data.dataset_ids)) {
form.setError('dataset_ids', {
@@ -183,6 +198,14 @@ export function CreateAgentForm({
</RAGFlowFormItem>
)}
{!isCompiler && <NameFormField></NameFormField>}
+ {!isCompiler && modelRequired && (
+ <ModelTreeSelectFormField
+ name="llm_id"
+ label={t('chat.model')}
+ modelTypes={modelBindings?.modelTypes}
+ required
+ />
+ )}
{!isCompiler && datasetBlocks.length === 1 && (
<section className="space-y-4">
<p className="text-sm text-text-secondary">{datasetHint}</p>
diff --git a/web/src/pages/agents/template-retrieval-binding.ts b/web/src/pages/agents/template-retrieval-binding.ts
index 7f0240c190..5c6bdb6431 100644
--- a/web/src/pages/agents/template-retrieval-binding.ts
+++ b/web/src/pages/agents/template-retrieval-binding.ts
@@ -34,6 +34,73 @@ export interface RetrievalBindings {
memoryCount: number;
}
+export interface ModelBindingCount {
+ modelCount: number;
+ modelTypes?: string[];
+}
+
+const modelComponents = new Set([
+ Operator.Agent,
+ Operator.Categorize,
+ Operator.Extractor,
+]);
+
+function walkModelParams(dsl: DSL | Record<string, any>) {
+ const locations: Array<{ params: Record<string, any> }> = [];
+ const add = (componentName: unknown, params: unknown) => {
+ if (
+ modelComponents.has(componentName as Operator) &&
+ params &&
+ typeof params === 'object'
+ ) {
+ locations.push({ params: params as Record<string, any> });
+ }
+ };
+ for (const node of (dsl as Record<string, any>)?.graph?.nodes ?? [])
+ add(node?.data?.label, node?.data?.form);
+ for (const component of Object.values(
+ (dsl as Record<string, any>)?.components ?? {},
+ )) {
+ const obj = (component as Record<string, any>)?.obj;
+ add(obj?.component_name, obj?.params);
+ }
+ return locations;
+}
+
+export function countUnboundModel(
+ dsl: DSL | Record<string, any> | undefined,
+): ModelBindingCount {
+ if (!dsl) return { modelCount: 0 };
+ const source = (dsl as Record<string, any>).components
+ ? walkModelParams({ components: (dsl as Record<string, any>).components })
+ : walkModelParams(dsl);
+ let modelCount = 0;
+ const modelTypes = new Set<string>();
+ for (const { params } of source) {
+ if (!(params.llm_id || params.model_id)) {
+ modelCount++;
+ if (params.llm_filter === 'image2text') modelTypes.add('vision');
+ if (params.llm_filter === 'chat') modelTypes.add('chat');
+ }
+ }
+ return {
+ modelCount,
+ modelTypes: modelTypes.size ? [...modelTypes] : undefined,
+ };
+}
+
+export function bindUnboundModel(
+ dsl: DSL | Record<string, any> | undefined,
+ modelId: string,
+) {
+ if (!dsl || !modelId) return dsl;
+ const next = cloneDeep(dsl) as Record<string, any>;
+ for (const { params } of walkModelParams(next)) {
+ if (!(params.llm_id || params.model_id)) params.llm_id = modelId;
+ }
+ return next as DSL;
+}
+
function findAgentParams(
components: Record<string, any>,
agentId: string,