progress
This commit is contained in:
12
gui.py
12
gui.py
@@ -1,4 +1,4 @@
|
||||
# gui.py
|
||||
# gui.py
|
||||
import dearpygui.dearpygui as dpg
|
||||
import tomllib
|
||||
import tomli_w
|
||||
@@ -9,6 +9,7 @@ import aggregate
|
||||
import ai_client
|
||||
from ai_client import ProviderError
|
||||
import shell_runner
|
||||
import session_logger
|
||||
|
||||
CONFIG_PATH = Path("config.toml")
|
||||
PROVIDERS = ["gemini", "anthropic"]
|
||||
@@ -206,17 +207,24 @@ class App:
|
||||
self._pending_comms_lock = threading.Lock()
|
||||
self._comms_entry_count = 0
|
||||
|
||||
session_logger.open_session()
|
||||
ai_client.set_provider(self.current_provider, self.current_model)
|
||||
ai_client.confirm_and_run_callback = self._confirm_and_run
|
||||
ai_client.comms_log_callback = self._on_comms_entry
|
||||
ai_client.tool_log_callback = self._on_tool_log
|
||||
|
||||
# ---------------------------------------------------------------- comms log
|
||||
|
||||
def _on_comms_entry(self, entry: dict):
|
||||
"""Called from background thread; queue for main thread."""
|
||||
session_logger.log_comms(entry)
|
||||
with self._pending_comms_lock:
|
||||
self._pending_comms.append(entry)
|
||||
|
||||
def _on_tool_log(self, script: str, result: str):
|
||||
"""Called from background thread when a tool call completes."""
|
||||
session_logger.log_tool_call(script, result, None)
|
||||
|
||||
def _flush_pending_comms(self):
|
||||
"""Called every frame from the main render loop."""
|
||||
with self._pending_comms_lock:
|
||||
@@ -772,6 +780,7 @@ class App:
|
||||
dpg.render_dearpygui_frame()
|
||||
|
||||
dpg.save_init_file("dpg_layout.ini")
|
||||
session_logger.close_session()
|
||||
dpg.destroy_context()
|
||||
|
||||
|
||||
@@ -782,3 +791,4 @@ def main():
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user