From ee2c8de37298b859ea0726a2277770920d477e1f Mon Sep 17 00:00:00 2001 From: gleb Date: Fri, 5 Jun 2026 16:49:48 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D1=82=D1=8C=20=D0=BF=D0=BE=D0=B8=D1=81=D0=BA=20tasks=5Fl?= =?UTF-8?q?ist=20=E2=80=94=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D0=BF=D0=BE=D0=BB=D0=BD=D0=BE?= =?UTF-8?q?=D0=B5=20=D0=B8=D0=BC=D1=8F=20=D1=81=20=D0=BF=D1=80=D0=B5=D1=84?= =?UTF-8?q?=D0=B8=D0=BA=D1=81=D0=BE=D0=BC=20MCP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MCP-инструменты после загрузки получают префикс mcp__journal-bh-professor__. tools.get("tasks_list") всегда возвращал None → статус не загружался. Исправлено в ui.py (вкладка Статус) и cli.py (команда status). Co-Authored-By: Claude Sonnet 4.6 --- cli.py | 5 +++-- ui.py | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cli.py b/cli.py index dca9268..2f5097e 100644 --- a/cli.py +++ b/cli.py @@ -83,9 +83,10 @@ async def cmd_status() -> None: print("[cli] Получаю список заданий...") journal = load_journal_toolsets() tools = {t.name: t for t in journal.tasks_submissions_tools} - tool = tools.get("tasks_list") + tool = tools.get("mcp__journal-bh-professor__tasks_list") \ + or next((v for k, v in tools.items() if "tasks_list" in k), None) if not tool: - print("Ошибка: инструмент tasks_list не найден") + print(f"Ошибка: инструмент tasks_list не найден. Доступны: {list(tools.keys())}") return raw = await tool.ainvoke({"courseId": "698b49da77cb6d4d2e43ce78"}) diff --git a/ui.py b/ui.py index 736f331..bf31c71 100644 --- a/ui.py +++ b/ui.py @@ -464,9 +464,15 @@ with tab_status: async def _fetch(): j = load_journal_toolsets() + # Инструменты имеют префикс mcp__journal-bh-professor__ tools = {t.name: t for t in j.tasks_submissions_tools} - t = tools.get("tasks_list") + full_name = "mcp__journal-bh-professor__tasks_list" + t = tools.get(full_name) if not t: + # fallback: ищем по любому имени содержащему tasks_list + t = next((v for k, v in tools.items() if "tasks_list" in k), None) + if not t: + st.warning(f"Инструмент tasks_list не найден. Доступны: {list(tools.keys())}") return [] raw = await t.ainvoke({"courseId": "698b49da77cb6d4d2e43ce78"}) text = next((x["text"] for x in raw if x.get("type") == "text"), str(raw)) if isinstance(raw, list) else str(raw)