@@ -53,25 +53,27 @@ def redisplay_results(execution: Execution) -> None:
53
53
"""
54
54
for result in execution .results :
55
55
if result .text is not None :
56
- display ({MimeType .TEXT_PLAIN : result .text })
56
+ display ({MimeType .TEXT_PLAIN : result .text }, raw = True )
57
57
if result .html is not None :
58
- display ({MimeType .TEXT_HTML : result .html })
58
+ display ({MimeType .TEXT_HTML : result .html }, raw = True )
59
59
if result .markdown is not None :
60
- display ({MimeType .TEXT_MARKDOWN : result .markdown })
60
+ display ({MimeType .TEXT_MARKDOWN : result .markdown }, raw = True )
61
61
if result .svg is not None :
62
- display ({MimeType .IMAGE_SVG : result .svg })
62
+ display ({MimeType .IMAGE_SVG : result .svg }, raw = True )
63
63
if result .png is not None :
64
- display ({MimeType .IMAGE_PNG : result .png })
64
+ display ({MimeType .IMAGE_PNG : result .png }, raw = True )
65
65
if result .jpeg is not None :
66
- display ({MimeType .IMAGE_JPEG : result .jpeg })
66
+ display ({MimeType .IMAGE_JPEG : result .jpeg }, raw = True )
67
67
if result .mp4 is not None :
68
- display ({MimeType .VIDEO_MP4_B64 : result .mp4 })
68
+ display ({MimeType .VIDEO_MP4_B64 : result .mp4 }, raw = True )
69
69
if result .latex is not None :
70
- display ({MimeType .TEXT_LATEX : result .latex })
70
+ display ({MimeType .TEXT_LATEX : result .latex }, raw = True )
71
71
if result .json is not None :
72
- display ({MimeType .APPLICATION_JSON : result .json })
72
+ display ({MimeType .APPLICATION_JSON : result .json }, raw = True )
73
+ if result .artifact_name is not None :
74
+ display ({MimeType .TEXT_ARTIFACT_NAME : result .artifact_name }, raw = True )
73
75
if result .extra is not None :
74
- display (result .extra )
76
+ display (result .extra , raw = True )
75
77
76
78
77
79
class Artifacts :
@@ -208,7 +210,7 @@ def create_code_artifact(artifacts: Artifacts, name: str) -> str:
208
210
return_str = f"[Artifact { name } created]"
209
211
print (return_str )
210
212
211
- display ({MimeType .APPLICATION_JSON : { "last_artifact" : name }} )
213
+ display ({MimeType .TEXT_ARTIFACT_NAME : name }, raw = True )
212
214
return return_str
213
215
214
216
@@ -292,7 +294,7 @@ def edit_code_artifact(
292
294
293
295
artifacts [name ] = "" .join (edited_lines )
294
296
295
- display ({MimeType .APPLICATION_JSON : { "last_artifact" : name }} )
297
+ display ({MimeType .TEXT_ARTIFACT_NAME : name }, raw = True )
296
298
return open_code_artifact (artifacts , name , cur_line )
297
299
298
300
@@ -348,7 +350,7 @@ def detect_dogs(image_path: str):
348
350
code_lines = code .splitlines (keepends = True )
349
351
total_lines = len (code_lines )
350
352
351
- display ({MimeType .APPLICATION_JSON : { "last_artifact" : name }} )
353
+ display ({MimeType .TEXT_ARTIFACT_NAME : name }, raw = True )
352
354
return view_lines (code_lines , 0 , total_lines , name , total_lines )
353
355
354
356
@@ -413,7 +415,7 @@ def detect_dogs(image_path: str):
413
415
code_lines = code .splitlines (keepends = True )
414
416
total_lines = len (code_lines )
415
417
416
- display ({MimeType .APPLICATION_JSON : { "last_artifact" : name }} )
418
+ display ({MimeType .TEXT_ARTIFACT_NAME : name }, raw = True )
417
419
return view_lines (code_lines , 0 , total_lines , name , total_lines )
418
420
419
421
@@ -427,6 +429,7 @@ def write_media_artifact(artifacts: Artifacts, local_path: str) -> str:
427
429
with open (local_path , "rb" ) as f :
428
430
media = f .read ()
429
431
artifacts [Path (local_path ).name ] = media
432
+ display ({MimeType .TEXT_ARTIFACT_NAME : Path (local_path ).name }, raw = True )
430
433
return f"[Media { Path (local_path ).name } saved]"
431
434
432
435
@@ -592,6 +595,8 @@ def replacer(match: re.Match) -> str:
592
595
593
596
diff = get_diff_with_prompts (name , code , new_code )
594
597
print (diff )
598
+
599
+ display ({MimeType .TEXT_ARTIFACT_NAME : name }, raw = True )
595
600
return diff
596
601
597
602
0 commit comments