Fixed Git integration
This commit is contained in:
+1
-1
@@ -11,4 +11,4 @@ RUN mkdir -p /app/data
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"]
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080", "--no-access-log"]
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -6,7 +6,11 @@ from sqlalchemy import select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.character.service import CharacterService
|
||||
from app.chat.notices import format_pomodoro_context, format_pomodoro_notice
|
||||
from app.chat.notices import (
|
||||
POMODORO_TOOL_NAMES,
|
||||
format_pomodoro_context,
|
||||
format_tool_notice,
|
||||
)
|
||||
from app.projects.context import format_projects_context, get_projects_snapshot
|
||||
from app.db.models import ChatSession, Message
|
||||
from app.llm.client import LLMClient
|
||||
@@ -141,15 +145,16 @@ class ChatService:
|
||||
messages.append(tool_message)
|
||||
self._save_message(session_id, "tool", result, tool_call_id=tool_call["id"])
|
||||
|
||||
notice = format_pomodoro_notice(fn["name"], result)
|
||||
notice = format_tool_notice(fn["name"], result)
|
||||
if notice:
|
||||
self._save_message(session_id, "notice", notice)
|
||||
yield self._sse("notice", {"content": notice})
|
||||
|
||||
yield self._sse(
|
||||
"pomodoro",
|
||||
{"name": fn["name"], "result": json.loads(result)},
|
||||
)
|
||||
if fn["name"] in POMODORO_TOOL_NAMES:
|
||||
yield self._sse(
|
||||
"pomodoro",
|
||||
{"name": fn["name"], "result": json.loads(result)},
|
||||
)
|
||||
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user