Fixed Git integration
This commit is contained in:
@@ -36,14 +36,35 @@ def format_phase_completed_notice(
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def format_pomodoro_notice(tool_name: str, raw_result: str) -> str | None:
|
||||
POMODORO_TOOL_NAMES = frozenset({
|
||||
"get_pomodoro_status",
|
||||
"start_pomodoro",
|
||||
"start_short_break",
|
||||
"start_long_break",
|
||||
"stop_pomodoro",
|
||||
"skip_pomodoro_phase",
|
||||
"reset_pomodoro_cycle",
|
||||
"get_pomodoro_history",
|
||||
})
|
||||
|
||||
# Не засорять чат служебными ответами
|
||||
TOOLS_SKIP_CHAT_NOTICE = frozenset({
|
||||
"get_pomodoro_status",
|
||||
})
|
||||
|
||||
|
||||
def format_tool_notice(tool_name: str, raw_result: str) -> str | None:
|
||||
if tool_name in TOOLS_SKIP_CHAT_NOTICE:
|
||||
return None
|
||||
|
||||
try:
|
||||
data = json.loads(raw_result)
|
||||
except json.JSONDecodeError:
|
||||
return None
|
||||
|
||||
if isinstance(data, dict) and "error" in data:
|
||||
return f"⏱ Помидоро: {data['error']}"
|
||||
prefix = "⏱" if tool_name in POMODORO_TOOL_NAMES else "📋"
|
||||
return f"{prefix} {data['error']}"
|
||||
|
||||
if tool_name == "reset_pomodoro_cycle":
|
||||
cycle = data.get("cycle", data)
|
||||
|
||||
Reference in New Issue
Block a user