Skip to content

Commit

Permalink
Merge branch 'main' into bugfix/PreferencesContentCloudAppearance
Browse files Browse the repository at this point in the history
  • Loading branch information
rhennigan committed Nov 28, 2024
2 parents cfbe0e9 + 3e422ba commit a0370c7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 48 deletions.
2 changes: 1 addition & 1 deletion FrontEnd/TextResources/ChatbookStrings.tr
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"PreferencesContentLLMKitNoSubscription" -> "No LLM Kit subscription found",
"PreferencesContentLLMKitSignInOr" -> "or",
"PreferencesContentLLMKitSignInButton" -> "Sign In to use an existing subscription \[RightGuillemet]",
"PreferencesContentLLMKitEnabledTitle" -> "Notebook Assistant + LLM Kit Essentials",
"PreferencesContentLLMKitEnabledTitle" -> "Notebook Assistant + LLM Kit Subscription",
"PreferencesContentLLMKitEnabledManage" -> "Manage your subscription \[RightGuillemet]",

"ResourceInstallerFromURLPrompt" -> "Enter a URL",
Expand Down
6 changes: 3 additions & 3 deletions FrontEnd/TextResources/French/ChatbookStrings.tr
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
"FormattingInsertContentAndEvaluateLabel" -> "Ins\[EAcute]rer et \[EAcute]valuer",
"FormattingCopyToClipboardLabel" -> "Copier",
"FormattingInsertContentLabel" -> "Ins\[EAcute]rer",
"FormattingInsertContentAndEvaluateTooltip" -> "Ins\[EAcute]rer le contenu en tant que nouvelle cellule d\[CloseCurlyQuote]entr\[EAcute]e ci-dessous et l\[CloseCurlyQuote]\[EAcute]valuer",
"FormattingInsertContentAndEvaluateWorkspaceChatTooltip" -> "Insert this into `1` and evaluate.",
"FormattingInsertContentAndEvaluateWorkspaceChatTooltipNew" -> "Insert this into a new notebook and evaluate.",
"FormattingInsertContentAndEvaluateTooltip" -> "Ins\[EAcute]rer le contenu en tant que nouvelle cellule d\[CloseCurlyQuote]entr\[EAcute]e ci-dessous et \[EAcute]valuer",
"FormattingInsertContentAndEvaluateWorkspaceChatTooltip" -> "Ins\[EAcute]rer ceci dans `1` et \[EAcute]valuer.",
"FormattingInsertContentAndEvaluateWorkspaceChatTooltipNew" -> "Ins\[EAcute]rer ceci dans un nouveau notebook et \[EAcute]valuer.",
"FormattingCopyToClipboardTooltip" -> "Copier dans le presse-papiers",
"FormattingInsertContentTooltip" -> "Ins\[EAcute]rer le contenu en tant que nouvelle cellule d\[CloseCurlyQuote]entr\[EAcute]e ci-dessous",
"FormattingToolUsing" -> "Utilisation de ",
Expand Down
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.10",
"Version" -> "1.5.2.14",
"WolframVersion" -> "14.1+",
"Description" -> "Wolfram Notebooks + LLMs",
"License" -> "MIT",
Expand Down
64 changes: 21 additions & 43 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 Expand Up @@ -1799,9 +1806,15 @@ makeToolCallOutputSection // beginDefinition;
makeToolCallOutputSection[ as: KeyValuePattern[ "Result" -> result_ ] ] := Enclose[
Module[ { formatter },
formatter = Confirm[ as[ "FormattingFunction" ], "FormattingFunction" ];
TextCell[ wideScrollPane @ formatter[ result, "Result" ], "Text", Background -> None ]
TextCell[
wideScrollPane @ formatter[ result, "Result" ],
"Text",
Background -> None,
FrameBoxOptions -> { BaselinePosition -> Automatic },
PaneBoxOptions -> { BaselinePosition -> Automatic }
]
],
throwInternalFailure[ makeToolCallOutputSection @ as, ## ] &
throwInternalFailure
];

makeToolCallOutputSection // endDefinition;
Expand Down Expand Up @@ -2159,48 +2172,13 @@ inlineInteractiveCodeCell // beginDefinition;

inlineInteractiveCodeCell[ display_, string_ ] /; $dynamicText := display;

(* TODO: make this switch dynamically depending on $cloudNotebooks (likely as a TemplateBox)*)
inlineInteractiveCodeCell[ display_, string_ ] :=
inlineInteractiveCodeCell[ display, string, contentLanguage @ string ];

inlineInteractiveCodeCell[ display_, string_, lang_ ] /; $cloudNotebooks :=
cloudInlineInteractiveCodeCell[ display, string, lang ];

inlineInteractiveCodeCell[ display_, string_, lang_ ] := display;

inlineInteractiveCodeCell // endDefinition;

(* ::**************************************************************************************************************:: *)
(* ::Subsubsection::Closed:: *)
(*cloudInlineInteractiveCodeCell*)
cloudInlineInteractiveCodeCell // beginDefinition;

cloudInlineInteractiveCodeCell[ display_, string_, lang_ ] :=
Module[ { padded, buttons },

padded = Pane[ display, ImageSize -> { { 100, Automatic }, { 30, Automatic } } ];

buttons = Framed[
floatingButtonGrid[ string, lang ],
Background -> White,
FrameMargins -> { { 1, 0 }, { 0, 1 } },
FrameStyle -> White,
ImageMargins -> 1,
RoundingRadius -> 3
];

Mouseover[
buttonOverlay[ padded, Invisible @ buttons ],
buttonOverlay[ padded, buttons ],
ContentPadding -> False,
FrameMargins -> 0,
ImageMargins -> 0,
ImageSize -> All
]
];

cloudInlineInteractiveCodeCell // endDefinition;

(* ::**************************************************************************************************************:: *)
(* ::Subsubsection::Closed:: *)
(*buttonOverlay*)
Expand Down

0 comments on commit a0370c7

Please sign in to comment.