fix(ux): repair status/queue formatter strings
This commit is contained in:
@@ -135,10 +135,37 @@ def _chat_answer(text: str) -> str:
|
||||
pass
|
||||
return "Got it — I can help with that."
|
||||
|
||||
|
||||
|
||||
def _format_status_human(out: str) -> str:
|
||||
import json
|
||||
try:
|
||||
obj = json.loads(out)
|
||||
codex = obj.get('codex_login', {}).get('code', 1) == 0
|
||||
claude = obj.get('claude_login', {}).get('code', 1) == 0
|
||||
return ("Prime status: healthy.\n"
|
||||
f"OpenAI/Codex: {'connected' if codex else 'not connected'}\n"
|
||||
f"Claude: {'connected' if claude else 'not connected'}")
|
||||
except Exception:
|
||||
return out[:3000]
|
||||
|
||||
|
||||
def _format_queue_add_human(out: str) -> str:
|
||||
import json
|
||||
try:
|
||||
obj = json.loads(out)
|
||||
return ("Queued ✅\n"
|
||||
f"Task ID: {obj.get('id')}\n"
|
||||
f"Type: {obj.get('task_type')}\n"
|
||||
f"Task: {obj.get('task')}\n"
|
||||
"I’ll work on this and report back.")
|
||||
except Exception:
|
||||
return out[:3000]
|
||||
|
||||
def help_text() -> str:
|
||||
return (
|
||||
"Prime control commands:\n"
|
||||
"- status\n"
|
||||
"- status [raw]\n"
|
||||
"- queue list\n"
|
||||
"- blocked\n"
|
||||
"- queue add <task_type> <task text>\n"
|
||||
@@ -245,7 +272,9 @@ def parse_and_handle(chat_id: int, msg_id: int, text: str) -> str:
|
||||
|
||||
if norm[0] == 'status':
|
||||
code, out = run_prime(['status'])
|
||||
return f"status (code={code})\n{out[:3500]}"
|
||||
if len(norm) > 1 and norm[1] == 'raw':
|
||||
return f"status (code={code})\n{out[:3500]}"
|
||||
return _format_status_human(out)
|
||||
|
||||
if norm[:2] == ['queue', 'list']:
|
||||
code, out = run_prime(['queue', 'list'])
|
||||
@@ -257,7 +286,7 @@ def parse_and_handle(chat_id: int, msg_id: int, text: str) -> str:
|
||||
task_type = parts[2]
|
||||
task = ' '.join(parts[3:])
|
||||
code, out = run_prime(['queue', 'add', task_type, task])
|
||||
return f"queue add (code={code})\n{out[:3500]}"
|
||||
return _format_queue_add_human(out)
|
||||
|
||||
if norm[:2] == ['queue', 'approve']:
|
||||
if len(parts) != 3:
|
||||
|
||||
Reference in New Issue
Block a user