소스 검색

Stop inviting markdown image syntax for local files

The hint said image markdown gets uploaded as an attachment without
saying that only applies to http(s). The model followed it for a local
file, and gateway's extract_images matches https?:// only — so
![alt](file:///…/squirrel.jpg) was never extracted and got posted as
literal text while the agent believed it had delivered the image.

Spell out that local files always go through MEDIA:, the way the built-in
WebUI hint already does for the same reason.
Paul Klumpp 1 주 전
부모
커밋
24537cc5c6
2개의 변경된 파일11개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 1
      adapter.py
  2. 10 1
      test_adapter.py

+ 1 - 1
adapter.py

@@ -2117,7 +2117,7 @@ def register(ctx) -> None:
             "To send a local file, include MEDIA:/absolute/path/to/file in your response: images "
             "(.png, .jpg, .gif, .webp) arrive as inline pictures, videos (.mp4, .mov, .webm) as "
             "video attachments, audio as a voice bubble, anything else as a downloadable document. "
-            "Image URLs in markdown format ![alt](url) are downloaded and uploaded as attachments too. "
+            "Do NOT use markdown image syntax for local files. Local files always go through MEDIA:. "
             "Several images in one response are bundled into a single message."
         ),
     )

+ 10 - 1
test_adapter.py

@@ -262,7 +262,16 @@ class TestRegistration:
         register(ctx)
         hint = ctx.registered_kwargs["platform_hint"]
         assert "MEDIA:/absolute/path/to/file" in hint
-        assert "![alt](url)" in hint
+        assert "![alt](https://...)" in hint
+
+    def test_platform_hint_rules_out_markdown_for_local_files(self):
+        """gateway's extract_images only matches https?:// — markdown pointing at
+        a local file is never extracted and lands in the chat as literal text."""
+        ctx = _MockPluginContext()
+        register(ctx)
+        hint = ctx.registered_kwargs["platform_hint"]
+        assert "file:///path" in hint
+        assert "MEDIA:" in hint
 
     def test_startup_logs_the_capabilities(self, caplog):
         with caplog.at_level("INFO"):