Skip to content

Commit

Permalink
Merge pull request #937 from WolframResearch/bugfix/454373
Browse files Browse the repository at this point in the history
Bugfix: Handle expression URIs in formatted output cells
  • Loading branch information
rhennigan authored Nov 19, 2024
2 parents 8ff094e + 4c6e1e1 commit a4b2a77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Source/Chatbook/Formatting.wl
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@ makeResultCell0[ inlineCodeCell[ code_String ] ] := ReplaceAll[
makeResultCell0[ mathCell[ math_String ] ] /; StringMatchQ[ math, (DigitCharacter|"."|","|" ").. ] :=
math;

makeResultCell0[ mathCell[ name_String ] ] /; NameQ @ name && Context @ name === "System`" && StringLength @ name > 1 :=
makeResultCell0 @ inlineCodeCell @ name;

makeResultCell0[ mathCell[ math_String ] ] :=
With[ { boxes = makeTeXBoxes @ math },
If[ MatchQ[ boxes, _RawBoxes ],
Expand Down Expand Up @@ -1907,7 +1910,7 @@ makeLabeledBlockCell0[ code_String, "Input" ] :=
makeInteractiveCodeCell[ "Wolfram", code ];

makeLabeledBlockCell0[ code_String, style_String ] :=
Cell[ BoxData @ code, style ];
Cell[ BoxData @ StringToBoxes[ code, "WL" ], style ];

makeLabeledBlockCell0 // endDefinition;

Expand Down
3 changes: 2 additions & 1 deletion Source/Chatbook/Prompting.wl
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ $basePromptComponents[ "MarkdownImageBox" ] = "\
* If there are images embedded in the notebook, they will be replaced by a box representation in the form \
``MarkdownImageBox[\"![label](attachment://content-id)\"]``. You will also receive the original image immediately \
after this. You can use the markdown from this box ``![label](attachment://content-id)`` in your responses if you \
want to display the original image.";
want to display the original image. The user is not aware of the existence of MarkdownImageBoxes, since they just see \
an image, so avoid talking about these directly.";

$basePromptComponents[ "MarkdownImageBoxImporting" ] = "\
* Use the syntax <!attachment://content-id!> to inline one of these images in code you write for the evaluator \
Expand Down

0 comments on commit a4b2a77

Please sign in to comment.