Fix agent_id default value and connection closing

Ensure agent_id defaults to 0 and close connection safely.
This commit is contained in:
Rohit Kattimani 2026-04-24 08:04:08 +05:30 committed by GitHub
parent fa0f6519b1
commit 0f4533694e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -258,7 +258,7 @@ class IPCHandler:
agent_prompts = {} # 记录每个agent的prompt agent_prompts = {} # 记录每个agent的prompt
for interview in interviews: for interview in interviews:
agent_id = interview.get("agent_id") agent_id = interview.get("agent_id", 0)
prompt = interview.get("prompt", "") prompt = interview.get("prompt", "")
try: try:
@ -333,7 +333,9 @@ class IPCHandler:
except json.JSONDecodeError: except json.JSONDecodeError:
result["response"] = info_json result["response"] = info_json
conn.close() finally:
if conn:
conn.close()
except Exception as e: except Exception as e:
print(f" 读取Interview结果失败: {e}") print(f" 读取Interview结果失败: {e}")