Skip to content

Commit

Permalink
Merge pull request #961 from WolframResearch/bugfix/454728
Browse files Browse the repository at this point in the history
Bugfix: Show correct code block buttons while streaming
  • Loading branch information
rhennigan authored Nov 27, 2024
2 parents 9428d8b + 609b5f8 commit e33a804
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion PacletInfo.wl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PacletObject[ <|
"Name" -> "Wolfram/Chatbook",
"PublisherID" -> "Wolfram",
"Version" -> "1.5.2.12",
"Version" -> "1.5.2.13",
"WolframVersion" -> "14.1+",
"Description" -> "Wolfram Notebooks + LLMs",
"License" -> "MIT",
Expand Down
19 changes: 13 additions & 6 deletions Source/Chatbook/Formatting.wl
Original file line number Diff line number Diff line change
Expand Up @@ -685,17 +685,24 @@ evaluateLanguageLabel[ name_String, False ] :=
];

evaluateLanguageLabel[ name_String, True ] :=
With[ { icon = If[ name === "Wolfram", chatbookIcon[ "WorkspaceCodeBlockInsertAndEvaluate", False ], $languageIcons @ name ] },
Catch @ Module[ { wl, icon, labeled },

wl = wolframLanguageQ @ name;
icon = If[ wl, chatbookIcon[ "WorkspaceCodeBlockInsertAndEvaluate", False ], $languageIcons @ name ];
If[ ! MatchQ[ icon, _Graphics | _Dynamic | _Image ], Throw @ $insertEvaluateButtonLabel ];

labeled = labeledIcon[
If[ wl, { "WorkspaceCodeBlockInsertAndEvaluate", False }, name ],
"FormattingInsertContentAndEvaluateLabel"
];

fancyTooltip[
MouseAppearance[
buttonMouseover[
buttonFrameDefault[ labeledIcon[ If[ name === "Wolfram", { "WorkspaceCodeBlockInsertAndEvaluate", False }, name ], "FormattingInsertContentAndEvaluateLabel" ], True ],
buttonFrameActive[ labeledIcon[ If[ name === "Wolfram", { "WorkspaceCodeBlockInsertAndEvaluate", False }, name ], "FormattingInsertContentAndEvaluateLabel" ], True ]
],
buttonMouseover[ buttonFrameDefault[ labeled, True ], buttonFrameActive[ labeled, True ] ],
"LinkHand"
],
targetNotebookLabel @ EvaluationNotebook[ ]
] /; MatchQ[ icon, _Graphics | _Dynamic | _Image ]
]
];

evaluateLanguageLabel[ ___ ] := $insertEvaluateButtonLabel;
Expand Down

0 comments on commit e33a804

Please sign in to comment.