fix(perception): resolve UNKNOWN screen classification on explore grid and fix LLM fallback API
1. Added a robust structural heuristic for EXPLORE_GRID that looks for 'action_bar_search_edit_text' alongside 'search_tab', eliminating the reliance on the flaky 'selected' attribute. 2. Fixed a critical bug in the LLM semantic fallback where it was incorrectly querying the '/api/chat' endpoint using an '/api/generate' payload format, causing silent 400 Bad Request failures. 3. Corrected the fallback model assignment to use 'ai_model' (e.g. qwen3.5) instead of 'ai_embedding_model' (which incorrectly attempted to use nomic-embed-text or llama3 for chat completion).
This commit is contained in:
@@ -219,6 +219,8 @@ class ScreenIdentity:
|
||||
return ScreenType.REELS_FEED
|
||||
if selected_tab == "search_tab":
|
||||
return ScreenType.EXPLORE_GRID
|
||||
if "action_bar_search_edit_text" in ids and "search_tab" in ids:
|
||||
return ScreenType.EXPLORE_GRID
|
||||
if selected_tab == "profile_tab":
|
||||
return ScreenType.OWN_PROFILE
|
||||
if selected_tab == "direct_tab":
|
||||
@@ -232,11 +234,11 @@ class ScreenIdentity:
|
||||
|
||||
cfg = Config()
|
||||
url = (
|
||||
getattr(cfg.args, "ai_embedding_url", "http://localhost:11434/api/chat")
|
||||
getattr(cfg.args, "ai_model_url", "http://localhost:11434/api/generate")
|
||||
if hasattr(cfg, "args")
|
||||
else "http://localhost:11434/api/chat"
|
||||
else "http://localhost:11434/api/generate"
|
||||
)
|
||||
model = getattr(cfg.args, "ai_embedding_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"
|
||||
|
||||
layout_context = (
|
||||
f"Selected Tab: {selected_tab}\nResource IDs: {list(ids)}\nVisible Texts context: {texts[:10]}\n"
|
||||
|
||||
Reference in New Issue
Block a user