fix: Improve AI auto-adjust prompt to prevent function wrapping
The AI was generating function definitions instead of inline code. Updated the default prompt template to explicitly: - Request inline executable code, NOT function definitions - Clarify that variables are already available - Emphasize no wrapping in functions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
541d49b7f9
commit
9c6b682c73
|
|
@ -1829,7 +1829,9 @@ class SmartToolsUI:
|
|||
ai_provider_select_btn = Button3DCompact("▼", on_press=show_ai_provider_dropdown)
|
||||
|
||||
# Default prompt template for AI code generation/adjustment
|
||||
default_ai_prompt = f"""Modify or generate Python code according to my instruction below.
|
||||
default_ai_prompt = f"""Write inline Python code (NOT a function definition) according to my instruction.
|
||||
|
||||
The code runs directly - variables are already available, no function needed.
|
||||
|
||||
INSTRUCTION: [Describe what you want]
|
||||
|
||||
|
|
@ -1840,7 +1842,8 @@ CURRENT CODE:
|
|||
|
||||
AVAILABLE VARIABLES: {', '.join(vars_available)}
|
||||
|
||||
Return ONLY the Python code, no explanations or markdown fencing."""
|
||||
IMPORTANT: Return ONLY executable inline code. Do NOT wrap in a function.
|
||||
No explanations, no markdown fencing, just the code."""
|
||||
|
||||
# Multiline editable prompt for AI with DOS-style scrollbar
|
||||
ai_prompt_edit = TabPassEdit(edit_text=default_ai_prompt, multiline=True)
|
||||
|
|
|
|||
Loading…
Reference in New Issue