mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-05-28 20:50:16 +00:00
22 lines
885 B
Python
22 lines
885 B
Python
"""Regression coverage for WebUI chat upload path handoff."""
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
MESSAGES_JS = ROOT / "static" / "messages.js"
|
|
|
|
|
|
def test_image_uploads_use_server_path_in_attached_files_context():
|
|
"""The agent text context must include real uploaded paths for images.
|
|
|
|
/api/upload returns an absolute attachment path. The browser also sends the
|
|
structured attachment payload to /api/chat/start, but text/tool-mode agents
|
|
still rely on the literal ``[Attached files: ...]`` suffix. Images must not
|
|
be downgraded to bare filenames there, otherwise tools like vision_analyze
|
|
cannot open the uploaded file immediately.
|
|
"""
|
|
src = MESSAGES_JS.read_text(encoding="utf-8")
|
|
|
|
assert "uploadedPaths=uploaded.map(u=>u&&u.is_image?" not in src
|
|
assert "uploadedPaths=uploaded.map(u=>u&&u.path?u.path" in src
|