mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-25 02:14:28 +00:00
Add short artifact handle (A1) so the model can edit by reference
Give each produced artifact a short virtual handle - A1, A2, ... - the n-th artifact in the conversation or workflow run (case-insensitive, not stored). The tools return it in their results, and the edit, rewrite, and input parameters accept either the handle or the full id. A handle resolves only within the caller's own conversation or run, and the resolved id is still checked against that parent before any read, so it cannot reach another tenant's artifact. This fixes the model creating a duplicate instead of a new version when asked to edit an artifact.
This commit is contained in:
1 parent
a06b348c34
commit
e7f765b628
13 files changed
+655
-61
No files matched your search
@@ -153,11 +153,13 @@ def test_code_node_persists_artifact_reference_in_state(wired):
|
||||
list(engine._execute_code_node(node))
|
||||
|
||||
ref = engine.state["report"]
|
||||
# The state holds an artifact REFERENCE (JSON primitives), never bytes.
|
||||
assert set(ref) == {"artifact_id", "version", "filename", "mime_type", "size"}
|
||||
# The state holds an artifact REFERENCE (JSON primitives), never bytes. The
|
||||
# short handle ``ref`` (A1) lets a later node address the artifact by position.
|
||||
assert set(ref) == {"artifact_id", "version", "filename", "mime_type", "size", "ref"}
|
||||
assert ref["filename"] == "report.txt"
|
||||
assert ref["mime_type"] == "text/plain"
|
||||
assert ref["size"] == len(b"compliance ok")
|
||||
assert ref["ref"] == "A1"
|
||||
assert all(not isinstance(v, (bytes, bytearray)) for v in ref.values())
|
||||
assert engine.state["node_code_1_output"] == ref
|
||||
|
||||
|
||||
Reference in new issue
Block a user