fix: GUI improvements, CROF gate, data dir consolidation, sticky proxy port
- GUI: add Clear Log, Restart Proxy, View Log (opens requests.log) buttons - CROF: skip entirely unless TARGET_URL contains crof.ai (no logs pollution) - Consolidate all data dirs into codex-proxy (remove codex-desktop, codex-launcher) - Proxy port persists across restarts via .last-proxy-port file - Adaptive compact budget raised from 60% to 80% context window - Startup config cleanup moved after _init_runtime() to avoid deleting active config
This commit is contained in:
@@ -2058,10 +2058,13 @@ class LauncherWin:
|
||||
# Bottom bar
|
||||
bb = ttk.Frame(main)
|
||||
bb.pack(fill="x", pady=(6, 0))
|
||||
ttk.Button(bb, text="AI Assistant", command=self._open_assistant).pack(side="left")
|
||||
ttk.Button(bb, text="Clear Log", command=self._clear_log).pack(side="left")
|
||||
self._restart_btn = ttk.Button(bb, text="Restart Proxy", command=self._restart_proxy, state="disabled")
|
||||
self._restart_btn.pack(side="left", padx=(4, 0))
|
||||
ttk.Button(bb, text="AI Assistant", command=self._open_assistant).pack(side="left", padx=(4, 0))
|
||||
self._kill_btn = ttk.Button(bb, text="Kill && Cleanup", command=self._kill, state="disabled")
|
||||
self._kill_btn.pack(side="left", fill="x", expand=True, padx=(8, 0))
|
||||
ttk.Button(bb, text="View Log", command=lambda: open_file(str(LAUNCH_LOG))).pack(side="left")
|
||||
ttk.Button(bb, text="View Log", command=self._open_proxy_log_dir).pack(side="left")
|
||||
ttk.Button(bb, text="Close", command=self._do_close).pack(side="left", padx=(8, 0))
|
||||
|
||||
self._rebuild_combo()
|
||||
@@ -2079,6 +2082,25 @@ class LauncherWin:
|
||||
self._log_text.see("end")
|
||||
self._log_text.configure(state="disabled")
|
||||
|
||||
def _clear_log(self):
|
||||
self._log_text.configure(state="normal")
|
||||
self._log_text.delete("1.0", "end")
|
||||
self._log_text.configure(state="disabled")
|
||||
|
||||
def _restart_proxy(self):
|
||||
self._kill()
|
||||
ep_name = load_endpoints().get("default")
|
||||
if not ep_name:
|
||||
self.log("No default endpoint set.")
|
||||
return
|
||||
for ep in load_endpoints().get("endpoints", []):
|
||||
if ep.get("name") == ep_name:
|
||||
time.sleep(0.3)
|
||||
start_proxy_for(ep, self.log)
|
||||
self.log(f"Proxy restarted for {ep_name}")
|
||||
return
|
||||
self.log(f"Endpoint '{ep_name}' not found.")
|
||||
|
||||
def _log_dependency_status(self):
|
||||
if self._cli_info:
|
||||
_, ver = self._cli_info
|
||||
@@ -2191,6 +2213,18 @@ class LauncherWin:
|
||||
def _open_benchmark(self):
|
||||
BenchmarkWindow(self._root)
|
||||
|
||||
def _open_proxy_log_dir(self):
|
||||
log_dir = str(PROXY_CONFIG_DIR)
|
||||
req_log = PROXY_CONFIG_DIR / "requests.log"
|
||||
if IS_WINDOWS:
|
||||
if req_log.exists():
|
||||
os.startfile(str(req_log))
|
||||
else:
|
||||
os.startfile(log_dir)
|
||||
else:
|
||||
import subprocess as _sp
|
||||
_sp.Popen(["xdg-open", log_dir])
|
||||
|
||||
def _open_assistant(self):
|
||||
assist_path = str(Path(__file__).resolve().parent / "flet-codex-assist.py")
|
||||
if Path(assist_path).exists():
|
||||
@@ -2452,6 +2486,7 @@ class LauncherWin:
|
||||
self._btn_codex_desktop.configure(state="disabled" if busy or not has_desk else "normal")
|
||||
self._btn_codex_cli.configure(state="disabled" if busy or not has_cli else "normal")
|
||||
self._kill_btn.configure(state="normal" if busy else "disabled")
|
||||
self._restart_btn.configure(state="normal" if busy else "disabled")
|
||||
self._root.after(0, _update)
|
||||
|
||||
def _launch(self, target):
|
||||
|
||||
Reference in New Issue
Block a user