diff --git a/agent/chat/service.py b/agent/chat/service.py index 1afe1691..de7d345a 100644 --- a/agent/chat/service.py +++ b/agent/chat/service.py @@ -75,6 +75,23 @@ class ChatService: # a new segment; collect tool results until turn_end. state.pending_tool_results = [] + elif event_type == "file_to_send": + url = data.get("url") or "" + if url: + fname = data.get("file_name") or "file" + ft = data.get("file_type") or "file" + if ft == "image": + link = f"![{fname}]({url})" + else: + link = f"[{fname}]({url})" + send_chunk_fn({ + "chunk_type": "content", + "delta": "\n\n" + link + "\n\n", + "segment_id": state.segment_id, + }) + # Remove url so the model won't repeat it in its reply + data.pop("url", None) + elif event_type == "tool_execution_start": # Notify the client that a tool is about to run (with its input args) tool_name = data.get("tool_name", "") diff --git a/docker/Dockerfile.latest b/docker/Dockerfile.latest index 4fb5b587..f86bb555 100644 --- a/docker/Dockerfile.latest +++ b/docker/Dockerfile.latest @@ -30,7 +30,8 @@ RUN apt-get update \ && pip install --no-cache -r requirements-optional.txt \ && pip install --no-cache -e . \ && if [ "$INSTALL_BROWSER" = "true" ]; then \ - pip install --no-cache "playwright==1.52.0" \ + apt-get install -y --no-install-recommends fonts-wqy-zenhei \ + && pip install --no-cache "playwright==1.52.0" \ && python -m playwright install-deps chromium \ && mkdir -p /app/ms-playwright \ && if [ "$USE_CN_MIRROR" = "true" ]; then \