refactor: rename default_model->model, add thinking_type support, fix pet urlopen error handling

This commit is contained in:
Liang Jiaqing
2026-04-14 21:14:05 +08:00
parent 0551967a7e
commit 74abb77a0b
5 changed files with 41 additions and 27 deletions

View File

@@ -48,7 +48,11 @@ def render_sidebar():
pet_script = os.path.join(os.path.dirname(__file__), 'desktop_pet_v2.pyw')
if not os.path.exists(pet_script): pet_script = os.path.join(os.path.dirname(__file__), 'desktop_pet.pyw')
subprocess.Popen([sys.executable, pet_script], **kwargs)
def _pet_req(q): threading.Thread(target=lambda: urlopen(f'http://127.0.0.1:51983/?{q}', timeout=2), daemon=True).start()
def _pet_req(q):
def _do():
try: urlopen(f'http://127.0.0.1:51983/?{q}', timeout=2)
except Exception: pass
threading.Thread(target=_do, daemon=True).start()
agent._pet_req = _pet_req
if not hasattr(agent, '_turn_end_hooks'): agent._turn_end_hooks = {}
def _pet_hook(ctx):