From 32c6c0a422dc386b986c3485bb965ab0c259ad50 Mon Sep 17 00:00:00 2001 From: wuyiqunLu <132986242+wuyiqunLu@users.noreply.github.com> Date: Thu, 19 Sep 2024 12:14:29 +0800 Subject: [PATCH] feat: new artifact structure (#240) * feat: new artifact structure * address comment * adddress comment --- vision_agent/tools/meta_tools.py | 33 ++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/vision_agent/tools/meta_tools.py b/vision_agent/tools/meta_tools.py index bcdbefb6..9012e9d4 100644 --- a/vision_agent/tools/meta_tools.py +++ b/vision_agent/tools/meta_tools.py @@ -214,7 +214,11 @@ def create_code_artifact(artifacts: Artifacts, name: str) -> str: display( { MimeType.APPLICATION_ARTIFACT: json.dumps( - {"name": name, "content": artifacts[name]} + { + "name": name, + "content": artifacts[name], + "action": "create", + } ) }, raw=True, @@ -305,7 +309,11 @@ def edit_code_artifact( display( { MimeType.APPLICATION_ARTIFACT: json.dumps( - {"name": name, "content": artifacts[name]} + { + "name": name, + "content": artifacts[name], + "action": "edit", + } ) }, raw=True, @@ -366,7 +374,16 @@ def detect_dogs(image_path: str): total_lines = len(code_lines) display( - {MimeType.APPLICATION_ARTIFACT: json.dumps({"name": name, "content": code})}, + { + MimeType.APPLICATION_ARTIFACT: json.dumps( + { + "name": name, + "content": code, + "contentType": "vision_code", + "action": "create", + } + ) + }, raw=True, ) return view_lines(code_lines, 0, total_lines, name, total_lines) @@ -434,7 +451,15 @@ def detect_dogs(image_path: str): total_lines = len(code_lines) display( - {MimeType.APPLICATION_ARTIFACT: json.dumps({"name": name, "content": code})}, + { + MimeType.APPLICATION_ARTIFACT: json.dumps( + { + "name": name, + "content": code, + "action": "edit", + } + ) + }, raw=True, ) return view_lines(code_lines, 0, total_lines, name, total_lines)