feat: improve brain prompt to aggressively prioritize scrolling over backing out when trapped

This commit is contained in:
2026-04-27 22:46:48 +02:00
parent 097a5753f9
commit 12937cb2c1

View File

@@ -16,7 +16,7 @@ def ask_brain_for_action(
cfg = Config()
url = getattr(cfg.args, "ai_model_url", "http://localhost:11434/api/generate") if hasattr(cfg, "args") else "http://localhost:11434/api/generate"
model = getattr(cfg.args, "ai_model", "llama3") if hasattr(cfg, "args") else "llama3"
model = getattr(cfg.args, "ai_model", "qwen3.5:latest") if hasattr(cfg, "args") else "qwen3.5:latest"
prompt = (
f"You are an autonomous Instagram agent. Your ultimate goal is: '{goal}'.\n"
@@ -29,10 +29,11 @@ def ask_brain_for_action(
prompt += f"Context: {context}\n"
prompt += (
"Based on this, which of the available actions should you take next to make progress towards your goal? "
"If you need to find an element that is likely off-screen, choosing to scroll is a smart move. "
"If you are stuck, choosing to go back or to a main tab is acceptable to reset. "
"Reply ONLY with the exact string from the available actions list."
"CRITICAL INSTRUCTIONS:\n"
"1. If your goal requires an element (like 'following list') that you previously tried but failed to find, it is highly likely hidden off-screen.\n"
"2. If you haven't scrolled yet, you MUST choose to 'scroll down' or 'scroll up' to reveal more of the screen.\n"
"3. Only choose 'press back' or 'tap home tab' if you are completely trapped or in the wrong section entirely.\n"
"4. DO NOT hallucinate actions. Reply ONLY with the exact string from the available actions list."
)
try: