You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: improve template selection reliability and prompt clarity
- Added retry mechanism with configurable retry count to handle transient failures
- Enhanced prompt formatting with clearer template list presentation and validation rules
- Improved error handling to retry on failures before falling back to null selection
logger.info("No templates available for selection.");
26
26
return{selectedTemplateName: null,reasoning: "No templates were available to choose from.",useCase: null,complexity: null,styleSelection: null,projectName: ''};
27
27
}
28
28
29
29
try{
30
-
logger.info("Asking AI to select a template",{
30
+
logger.info(`Asking AI to select a template for the ${retryCount} time`,{
constsystemPrompt=`You are an Expert Software Architect at Cloudflare specializing in template selection for rapid development. Your task is to select the most suitable starting template based on user requirements.
@@ -81,13 +83,16 @@ Reasoning: "Social template provides user interactions, content sharing, and com
81
83
## RULES:
82
84
- ALWAYS select a template (never return null)
83
85
- Ignore misleading template names - analyze actual features
86
+
- **ONLY** Choose from the list of available templates
84
87
- Focus on functionality over naming conventions
85
88
- Provide clear, specific reasoning for selection`
86
89
87
90
constuserPrompt=`**User Request:** "${query}"
88
91
89
-
**Available Templates:**
90
-
${templateDescriptions}
92
+
## **Available Templates:**
93
+
**ONLY** These template names are available for selection: ${validTemplateNames.join(', ')}
94
+
95
+
Template detail: ${templateDescriptions}
91
96
92
97
**Task:** Select the most suitable template and provide:
0 commit comments