ok
This commit is contained in:
@@ -894,7 +894,6 @@ def _send_gemini(md_content: str, user_message: str, base_dir: str,
|
|||||||
if discussion_history and not old_history:
|
if discussion_history and not old_history:
|
||||||
_gemini_chat.send_message(f"[DISCUSSION HISTORY]\n\n{discussion_history}")
|
_gemini_chat.send_message(f"[DISCUSSION HISTORY]\n\n{discussion_history}")
|
||||||
_append_comms("OUT", "request", {"message": f"[HISTORY INJECTED] {len(discussion_history)} chars"})
|
_append_comms("OUT", "request", {"message": f"[HISTORY INJECTED] {len(discussion_history)} chars"})
|
||||||
_append_comms("OUT", "request", {"message": f"[ctx {len(md_content)} + msg {len(user_message)}]"})
|
|
||||||
payload: str | list[types.Part] = user_message
|
payload: str | list[types.Part] = user_message
|
||||||
all_text: list[str] = []
|
all_text: list[str] = []
|
||||||
_cumulative_tool_bytes = 0
|
_cumulative_tool_bytes = 0
|
||||||
@@ -1059,6 +1058,7 @@ def _send_gemini_cli(md_content: str, user_message: str, base_dir: str,
|
|||||||
if adapter is None:
|
if adapter is None:
|
||||||
break
|
break
|
||||||
events.emit("request_start", payload={"provider": "gemini_cli", "model": _model, "round": r_idx})
|
events.emit("request_start", payload={"provider": "gemini_cli", "model": _model, "round": r_idx})
|
||||||
|
if r_idx > 0:
|
||||||
_append_comms("OUT", "request", {"message": f"[CLI] [round {r_idx}] [msg {len(payload)}]"})
|
_append_comms("OUT", "request", {"message": f"[CLI] [round {r_idx}] [msg {len(payload)}]"})
|
||||||
send_payload = payload
|
send_payload = payload
|
||||||
if isinstance(payload, list):
|
if isinstance(payload, list):
|
||||||
@@ -1335,13 +1335,6 @@ def _send_anthropic(md_content: str, user_message: str, base_dir: str, file_item
|
|||||||
_repair_anthropic_history(_anthropic_history)
|
_repair_anthropic_history(_anthropic_history)
|
||||||
_anthropic_history.append({"role": "user", "content": user_content})
|
_anthropic_history.append({"role": "user", "content": user_content})
|
||||||
_add_history_cache_breakpoint(_anthropic_history)
|
_add_history_cache_breakpoint(_anthropic_history)
|
||||||
n_chunks = len(system_blocks)
|
|
||||||
_append_comms("OUT", "request", {
|
|
||||||
"message": (
|
|
||||||
f"[system {n_chunks} chunk(s), {len(md_content)} chars context] "
|
|
||||||
f"{user_message[:200]}{'...' if len(user_message) > 200 else ''}"
|
|
||||||
),
|
|
||||||
})
|
|
||||||
all_text_parts: list[str] = []
|
all_text_parts: list[str] = []
|
||||||
_cumulative_tool_bytes = 0
|
_cumulative_tool_bytes = 0
|
||||||
|
|
||||||
|
|||||||
@@ -1100,8 +1100,8 @@ class AppController:
|
|||||||
|
|
||||||
def _on_api_event(self, event_name: str = "generic_event", **kwargs: Any) -> None:
|
def _on_api_event(self, event_name: str = "generic_event", **kwargs: Any) -> None:
|
||||||
payload = kwargs.get("payload", {})
|
payload = kwargs.get("payload", {})
|
||||||
with self._pending_gui_tasks_lock:
|
# Push to background event queue, NOT GUI queue
|
||||||
self._pending_gui_tasks.append({"action": "refresh_api_metrics", "payload": payload})
|
self.event_queue.put("refresh_api_metrics", payload)
|
||||||
if self.test_hooks_enabled:
|
if self.test_hooks_enabled:
|
||||||
with self._api_event_queue_lock:
|
with self._api_event_queue_lock:
|
||||||
self._api_event_queue.append({"type": event_name, "payload": payload})
|
self._api_event_queue.append({"type": event_name, "payload": payload})
|
||||||
|
|||||||
@@ -1486,7 +1486,8 @@ class App:
|
|||||||
|
|
||||||
if self._token_stats_dirty:
|
if self._token_stats_dirty:
|
||||||
self._token_stats_dirty = False
|
self._token_stats_dirty = False
|
||||||
self._refresh_api_metrics({}, md_content=self._last_stable_md or None)
|
# Offload to background thread via event queue
|
||||||
|
self.controller.event_queue.put("refresh_api_metrics", {"md_content": self._last_stable_md or ""})
|
||||||
stats = self._token_stats
|
stats = self._token_stats
|
||||||
if not stats:
|
if not stats:
|
||||||
imgui.text_disabled("Token stats unavailable")
|
imgui.text_disabled("Token stats unavailable")
|
||||||
|
|||||||
Reference in New Issue
Block a user