mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-10 17:23:25 +08:00
feat(channel): unify deliverable outbound and WeChat attachments
Require deliverable:true for all channel attachments including images; extend save_deliverable_attachment with attachment_id; add WeChat proactive attachment delivery; inject channel file rules via system prompt instead of repeating on every user message. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
dc5da21f5a
commit
cbe68a54cd
14 changed files with 440 additions and 125 deletions
|
|
@ -28,3 +28,28 @@ def test_save_deliverable_attachment_registers_file(tmp_path, monkeypatch) -> No
|
|||
assert blob is not None
|
||||
assert blob.decode("utf-8").replace("\r\n", "\n") == "hello deliverable\n"
|
||||
assert meta is not None
|
||||
|
||||
|
||||
def test_save_deliverable_attachment_marks_existing_attachment_id(tmp_path, monkeypatch) -> None:
|
||||
from svc.files.attachment_assets import AttachmentAssetStore
|
||||
|
||||
store = AttachmentAssetStore(root_dir=tmp_path / "att")
|
||||
meta = store.save_bytes(b"png-bytes", filename="gen.png", mime="image/png")
|
||||
monkeypatch.setattr(
|
||||
"runtime.tools.public.save_deliverable_attachment_tool.AttachmentAssetStore",
|
||||
lambda root_dir=None: store if root_dir is None else AttachmentAssetStore(root_dir=root_dir),
|
||||
)
|
||||
|
||||
spec = save_deliverable_attachment_tool()
|
||||
out = spec.handler({"attachment_id": meta.attachment_id})
|
||||
assert out.get("ok") is True
|
||||
assert out.get("deliverable") is True
|
||||
assert out.get("attachment_id") == meta.attachment_id
|
||||
assert out.get("mime") == "image/png"
|
||||
|
||||
|
||||
def test_save_deliverable_attachment_requires_path_or_attachment_id() -> None:
|
||||
spec = save_deliverable_attachment_tool()
|
||||
out = spec.handler({})
|
||||
assert out.get("ok") is False
|
||||
assert out.get("error") == "path_or_attachment_id_required"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue