YET ANOTEHR BOTCHED TRACK.

This commit is contained in:
2026-03-05 16:14:58 -05:00
parent d04574aa8f
commit 3d5773fa63
5 changed files with 73 additions and 28 deletions

View File

@@ -732,12 +732,12 @@ class AppController:
self._set_status("fetching models...")
def do_fetch() -> None:
try:
models = ai_client.list_models(provider)
self.available_models = models
if self.current_model not in models and models:
self.current_model = models[0]
models_list = ai_client.list_models(provider)
self.available_models = models_list
if self.current_model not in models_list and models_list:
self.current_model = models_list[0]
ai_client.set_provider(self._current_provider, self.current_model)
self._set_status(f"models loaded: {len(models)}")
self._set_status(f"models loaded: {len(models_list)}")
except Exception as e:
self._set_status(f"model fetch error: {e}")
self.models_thread = threading.Thread(target=do_fetch, daemon=True)
@@ -843,6 +843,12 @@ class AppController:
with self._pending_gui_tasks_lock:
# These payloads already contain the 'action' field
self._pending_gui_tasks.append(payload)
elif event_name == "response":
with self._pending_gui_tasks_lock:
self._pending_gui_tasks.append({
"action": "handle_ai_response",
"payload": payload
})
def _handle_request_event(self, event: events.UserRequestEvent) -> None:
"""Processes a UserRequestEvent by calling the AI client."""