feat(api): Add lightweight HTTP server for API hooks
This commit is contained in:
5
gui.py
5
gui.py
@@ -25,6 +25,7 @@ import shell_runner
|
||||
import session_logger
|
||||
import project_manager
|
||||
import theme
|
||||
import api_hooks
|
||||
|
||||
CONFIG_PATH = Path("config.toml")
|
||||
PROVIDERS = ["gemini", "anthropic"]
|
||||
@@ -396,6 +397,7 @@ class App:
|
||||
def __init__(self):
|
||||
self.config = load_config()
|
||||
self.test_hooks_enabled = '--enable-test-hooks' in sys.argv or os.environ.get('SLOP_TEST_HOOKS') == '1'
|
||||
self.hook_server = api_hooks.HookServer(self)
|
||||
|
||||
# ---- global settings from config.toml ----
|
||||
ai_cfg = self.config.get("ai", {})
|
||||
@@ -2057,6 +2059,8 @@ class App:
|
||||
self._rebuild_projects_list()
|
||||
self._rebuild_discussion_selector()
|
||||
self._fetch_models(self.current_provider)
|
||||
|
||||
self.hook_server.start()
|
||||
|
||||
while dpg.is_dearpygui_running():
|
||||
# Show any pending confirmation dialog on the main thread safely
|
||||
@@ -2184,6 +2188,7 @@ class App:
|
||||
dpg.save_init_file("dpg_layout.ini")
|
||||
session_logger.close_session()
|
||||
ai_client.cleanup() # Destroy active API caches to stop billing
|
||||
self.hook_server.stop()
|
||||
dpg.destroy_context()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user