diff --git a/Assets/DisplayFunctions.wxf b/Assets/DisplayFunctions.wxf index 29f63245..2ed01ba1 100644 Binary files a/Assets/DisplayFunctions.wxf and b/Assets/DisplayFunctions.wxf differ diff --git a/Assets/Icons.wxf b/Assets/Icons.wxf index 5b19bec1..b4cc5fc1 100644 Binary files a/Assets/Icons.wxf and b/Assets/Icons.wxf differ diff --git a/Developer/Resources/Icons/SendChatButton.wl b/Developer/Resources/Icons/SendChatButton.wl index d0b6c068..be90b4a4 100644 --- a/Developer/Resources/Icons/SendChatButton.wl +++ b/Developer/Resources/Icons/SendChatButton.wl @@ -4,36 +4,29 @@ Function[ { False -> Button[ - RawBoxes @ TemplateBox[ { #1, #2 }, "SendChatButtonLabel" ], + RawBoxes @ TemplateBox[ { #1, #2, #3 }, "SendChatButtonLabel" ], Wolfram`Chatbook`$ChatEvaluationCell = cell; SelectionMove[ cell, All, Cell ]; FrontEndTokenExecute[ Notebooks @ cell, "EvaluateCells" ], + Appearance -> "Suppressed", FrameMargins -> 0, Method -> "Queued" ], True -> Button[ - Overlay[ - { - RawBoxes @ TemplateBox[ { #2 }, "ChatEvaluatingSpinner" ], - Graphics[ - { RGBColor[ 0.71373, 0.054902, 0.0 ], Rectangle[ { -0.5, -0.5 }, { 0.5, 0.5 } ] }, - ImageSize -> #2, - PlotRange -> 1.1 - ] - }, - Alignment -> { Center, Center } - ], + RawBoxes @ TemplateBox[ { #1, #2, #3 }, "StopChatButtonLabel" ], If[ Wolfram`Chatbook`$ChatEvaluationCell =!= cell, NotebookWrite[ cell, NotebookRead @ cell, None, AutoScroll -> False ], Needs[ "Wolfram`Chatbook`" -> None ]; Symbol[ "Wolfram`Chatbook`ChatbookAction" ][ "StopChat" ] ], + Appearance -> "Suppressed", FrameMargins -> 0 ] }, Dynamic[ Wolfram`Chatbook`$ChatEvaluationCell === cell ], - Alignment -> { Automatic, Baseline } + Alignment -> { Automatic, Baseline }, + ImageSize -> Automatic ], Initialization :> (cell = If[ $CloudEvaluation, x; EvaluationCell[ ], ParentCell @ EvaluationCell[ ] ]), DynamicModuleValues :> { }, diff --git a/Developer/Resources/Icons/SendChatButtonLabel.wl b/Developer/Resources/Icons/SendChatButtonLabel.wl index aa8ec88c..0b5da840 100644 --- a/Developer/Resources/Icons/SendChatButtonLabel.wl +++ b/Developer/Resources/Icons/SendChatButtonLabel.wl @@ -1,62 +1,139 @@ Function[ - Graphics[ - { - Thickness[ 0.055556 ], - FaceForm[ #1 ], - FilledCurve[ - { + MouseAppearance[ + Mouseover[ + Framed[ + Graphics[ { - { 0, 2, 0 }, - { 1, 3, 3 }, - { 0, 1, 0 }, - { 1, 3, 3 }, - { 0, 1, 0 }, - { 1, 3, 3 }, - { 1, 3, 3 }, - { 0, 1, 0 }, - { 1, 3, 3 }, - { 0, 1, 0 }, - { 1, 3, 3 }, - { 0, 1, 0 }, - { 1, 3, 3 } - } - }, - { + Thickness[ 0.055556 ], + FaceForm[ #1 ], + FilledCurve[ + { + { + { 0, 2, 0 }, + { 1, 3, 3 }, + { 0, 1, 0 }, + { 1, 3, 3 }, + { 0, 1, 0 }, + { 1, 3, 3 }, + { 1, 3, 3 }, + { 0, 1, 0 }, + { 1, 3, 3 }, + { 0, 1, 0 }, + { 1, 3, 3 }, + { 0, 1, 0 }, + { 1, 3, 3 } + } + }, + { + { + { 16.027, 14.999 }, + { 1.9266, 14.502 }, + { 1.0396, 14.472 }, + { 0.6156, 13.398 }, + { 1.2516, 12.793 }, + { 4.3856, 9.8123 }, + { 4.6816, 9.5303 }, + { 5.1256, 9.4603 }, + { 5.5026, 9.6363 }, + { 9.1226, 11.324 }, + { 9.3736, 11.441 }, + { 9.6716, 11.336 }, + { 9.7866, 11.088 }, + { 9.9026, 10.84 }, + { 9.7916, 10.545 }, + { 9.5406, 10.428 }, + { 5.9206, 8.7393 }, + { 5.5436, 8.5643 }, + { 5.3116, 8.1793 }, + { 5.3376, 7.7713 }, + { 5.6066, 3.4543 }, + { 5.6606, 2.5783 }, + { 6.7556, 2.2123 }, + { 7.3496, 2.8723 }, + { 16.794, 13.354 }, + { 17.382, 14.007 }, + { 16.905, 15.03 }, + { 16.027, 14.999 } + } + } + ] + }, + AspectRatio -> Automatic, + ImageSize -> #3, + PlotRange -> { { -0.5, 18.5 }, { -0.5, 18.5 } } + ], + FrameStyle -> GrayLevel[ 1 ], + Background -> GrayLevel[ 1 ], + RoundingRadius -> 3, + FrameMargins -> 1 + ], + Framed[ + Graphics[ { - { 16.027, 14.999 }, - { 1.9266, 14.502 }, - { 1.0396, 14.472 }, - { 0.6156, 13.398 }, - { 1.2516, 12.793 }, - { 4.3856, 9.8123 }, - { 4.6816, 9.5303 }, - { 5.1256, 9.4603 }, - { 5.5026, 9.6363 }, - { 9.1226, 11.324 }, - { 9.3736, 11.441 }, - { 9.6716, 11.336 }, - { 9.7866, 11.088 }, - { 9.9026, 10.84 }, - { 9.7916, 10.545 }, - { 9.5406, 10.428 }, - { 5.9206, 8.7393 }, - { 5.5436, 8.5643 }, - { 5.3116, 8.1793 }, - { 5.3376, 7.7713 }, - { 5.6066, 3.4543 }, - { 5.6606, 2.5783 }, - { 6.7556, 2.2123 }, - { 7.3496, 2.8723 }, - { 16.794, 13.354 }, - { 17.382, 14.007 }, - { 16.905, 15.03 }, - { 16.027, 14.999 } - } - } + Thickness[ 0.055556 ], + FaceForm[ #1 ], + FilledCurve[ + { + { + { 0, 2, 0 }, + { 1, 3, 3 }, + { 0, 1, 0 }, + { 1, 3, 3 }, + { 0, 1, 0 }, + { 1, 3, 3 }, + { 1, 3, 3 }, + { 0, 1, 0 }, + { 1, 3, 3 }, + { 0, 1, 0 }, + { 1, 3, 3 }, + { 0, 1, 0 }, + { 1, 3, 3 } + } + }, + { + { + { 16.027, 14.999 }, + { 1.9266, 14.502 }, + { 1.0396, 14.472 }, + { 0.6156, 13.398 }, + { 1.2516, 12.793 }, + { 4.3856, 9.8123 }, + { 4.6816, 9.5303 }, + { 5.1256, 9.4603 }, + { 5.5026, 9.6363 }, + { 9.1226, 11.324 }, + { 9.3736, 11.441 }, + { 9.6716, 11.336 }, + { 9.7866, 11.088 }, + { 9.9026, 10.84 }, + { 9.7916, 10.545 }, + { 9.5406, 10.428 }, + { 5.9206, 8.7393 }, + { 5.5436, 8.5643 }, + { 5.3116, 8.1793 }, + { 5.3376, 7.7713 }, + { 5.6066, 3.4543 }, + { 5.6606, 2.5783 }, + { 6.7556, 2.2123 }, + { 7.3496, 2.8723 }, + { 16.794, 13.354 }, + { 17.382, 14.007 }, + { 16.905, 15.03 }, + { 16.027, 14.999 } + } + } + ] + }, + AspectRatio -> Automatic, + ImageSize -> #3, + PlotRange -> { { -0.5, 18.5 }, { -0.5, 18.5 } } + ], + FrameStyle -> #1, + Background -> #2, + RoundingRadius -> 3, + FrameMargins -> 1 ] - }, - AspectRatio -> Automatic, - ImageSize -> #2, - PlotRange -> { { -0.5, 18.5 }, { -0.5, 18.5 } } + ], + "LinkHand" ] ] \ No newline at end of file diff --git a/Developer/Resources/Icons/StopChatButtonLabel.wl b/Developer/Resources/Icons/StopChatButtonLabel.wl new file mode 100644 index 00000000..6453a820 --- /dev/null +++ b/Developer/Resources/Icons/StopChatButtonLabel.wl @@ -0,0 +1,41 @@ +Function[ + MouseAppearance[ + Mouseover[ + Framed[ + Overlay[ + { + RawBoxes @ TemplateBox[ { #3 }, "ChatEvaluatingSpinner" ], + Graphics[ + { RGBColor[ 0.71373, 0.054902, 0.0 ], Rectangle[ { -0.5, -0.5 }, { 0.5, 0.5 } ] }, + ImageSize -> #3, + PlotRange -> 1.1 + ] + }, + Alignment -> { Center, Center } + ], + FrameStyle -> GrayLevel[ 1 ], + Background -> GrayLevel[ 1 ], + RoundingRadius -> 3, + FrameMargins -> 1 + ], + Framed[ + Overlay[ + { + RawBoxes @ TemplateBox[ { #3 }, "ChatEvaluatingSpinner" ], + Graphics[ + { RGBColor[ 0.71373, 0.054902, 0.0 ], Rectangle[ { -0.5, -0.5 }, { 0.5, 0.5 } ] }, + ImageSize -> #3, + PlotRange -> 1.1 + ] + }, + Alignment -> { Center, Center } + ], + FrameStyle -> #1, + Background -> #2, + RoundingRadius -> 3, + FrameMargins -> 1 + ] + ], + "LinkHand" + ] +] \ No newline at end of file diff --git a/Developer/Resources/Styles.wl b/Developer/Resources/Styles.wl index 09aac119..e0ec2ac8 100644 --- a/Developer/Resources/Styles.wl +++ b/Developer/Resources/Styles.wl @@ -147,7 +147,13 @@ Cell[ StyleKeyMapping -> { "~" -> "ChatDelimiter", "'" -> "SideChat", "=" -> "WolframAlphaShort", "*" -> "Item" }, TaggingRules -> <| "ChatNotebookSettings" -> <| |> |>, CellFrameLabels -> { - { None, Cell[ BoxData @ TemplateBox[ { RGBColor[ "#a3c9f2" ], 20 }, "SendChatButton" ], Background -> None ] }, + { + None, + Cell[ + BoxData @ TemplateBox[ { RGBColor[ "#a3c9f2" ], RGBColor[ "#f1f7fd" ], 20 }, "SendChatButton" ], + Background -> None + ] + }, { None, None } }, CellDingbat -> Cell[ @@ -1135,7 +1141,7 @@ Cell[ DisplayFunction -> ( NamespaceBox["ChatbookPersonaID", DynamicModuleBox[{}, - DynamicBox[ToBoxes @ Wolfram`Chatbook`InlineReferences`personaTemplateBoxes[1, #input, #state, #uuid]], + DynamicBox[ToBoxes @ Wolfram`Chatbook`Common`personaTemplateBoxes[1, #input, #state, #uuid]], Initialization :> ( Quiet @ Needs[ "Wolfram`Chatbook`" -> None ]; Wolfram`Chatbook`InlineReferences`Private`$lastInlineReferenceCell = EvaluationCell[ ] @@ -1157,7 +1163,7 @@ Cell[ DisplayFunction -> ( NamespaceBox["ChatbookModifierID", DynamicModuleBox[{}, - DynamicBox[ToBoxes @ Wolfram`Chatbook`InlineReferences`modifierTemplateBoxes[1, #input, #params, #state, #uuid]], + DynamicBox[ToBoxes @ Wolfram`Chatbook`Common`modifierTemplateBoxes[1, #input, #params, #state, #uuid]], Initialization :> ( Quiet @ Needs[ "Wolfram`Chatbook`" -> None ]; Wolfram`Chatbook`InlineReferences`Private`$lastInlineReferenceCell = EvaluationCell[ ] @@ -1179,7 +1185,7 @@ Cell[ DisplayFunction -> ( NamespaceBox["ChatbookFunctionID", DynamicModuleBox[{}, - DynamicBox[ToBoxes @ Wolfram`Chatbook`InlineReferences`functionTemplateBoxes[1, #input, #params, #state, #uuid]], + DynamicBox[ToBoxes @ Wolfram`Chatbook`Common`functionTemplateBoxes[1, #input, #params, #state, #uuid]], Initialization :> ( Quiet @ Needs[ "Wolfram`Chatbook`" -> None ]; Wolfram`Chatbook`InlineReferences`Private`$lastInlineReferenceCell = EvaluationCell[ ] @@ -1201,7 +1207,7 @@ Cell[ DisplayFunction -> ( NamespaceBox["ChatbookWLTemplateID", DynamicModuleBox[{}, - DynamicBox[ToBoxes @ Wolfram`Chatbook`InlineReferences`wlTemplateBoxes[1, #input, #state, #uuid]], + DynamicBox[ToBoxes @ Wolfram`Chatbook`Common`wlTemplateBoxes[1, #input, #state, #uuid]], Initialization :> ( Quiet @ Needs[ "Wolfram`Chatbook`" -> None ]; Wolfram`Chatbook`InlineReferences`Private`$lastInlineReferenceCell = EvaluationCell[ ] diff --git a/Developer/Resources/WorkspaceStyles.wl b/Developer/Resources/WorkspaceStyles.wl index d768b537..e1f6a546 100644 --- a/Developer/Resources/WorkspaceStyles.wl +++ b/Developer/Resources/WorkspaceStyles.wl @@ -134,32 +134,24 @@ Cell[ DisplayFunction -> Function @ Evaluate @ ToBoxes @ PaneSelector[ { None -> Button[ - RawBoxes @ TemplateBox[ { #1, #2 }, "SendChatButtonLabel" ], + RawBoxes @ TemplateBox[ { #1, #2, #3 }, "SendChatButtonLabel" ], Needs[ "Wolfram`Chatbook`" -> None ]; Symbol[ "Wolfram`Chatbook`ChatbookAction" ][ "EvaluateWorkspaceChat", - #3, - Dynamic @ CurrentValue[ #3, { TaggingRules, "ChatInputString" } ] + #4, + Dynamic @ CurrentValue[ #4, { TaggingRules, "ChatInputString" } ] ], + Appearance -> "Suppressed", FrameMargins -> 0, Method -> "Queued" ] }, Dynamic @ Wolfram`Chatbook`$ChatEvaluationCell, Button[ - Overlay[ - { - RawBoxes @ TemplateBox[ { #2 }, "ChatEvaluatingSpinner" ], - Graphics[ - { RGBColor[ 0.71373, 0.054902, 0.0 ], Rectangle[ { -0.5, -0.5 }, { 0.5, 0.5 } ] }, - ImageSize -> #2, - PlotRange -> 1.1 - ] - }, - Alignment -> { Center, Center } - ], + RawBoxes @ TemplateBox[ { #1, #2, #3 }, "StopChatButtonLabel" ], Needs[ "Wolfram`Chatbook`" -> None ]; Symbol[ "Wolfram`Chatbook`ChatbookAction" ][ "StopChat" ], + Appearance -> "Suppressed", FrameMargins -> 0 ], Alignment -> { Automatic, Baseline } diff --git a/FrontEnd/StyleSheets/Chatbook.nb b/FrontEnd/StyleSheets/Chatbook.nb index 30547ddb..6993e6e0 100644 --- a/FrontEnd/StyleSheets/Chatbook.nb +++ b/FrontEnd/StyleSheets/Chatbook.nb @@ -1177,7 +1177,7 @@ Notebook[ ], Cell[ StyleData["ChatStyleSheetInformation"], - TaggingRules -> <|"StyleSheetVersion" -> "1.4.6.3930718414"|> + TaggingRules -> <|"StyleSheetVersion" -> "1.4.8.3931491780"|> ], Cell[ StyleData["Text"], @@ -1675,7 +1675,11 @@ Notebook[ Cell[ BoxData[ TemplateBox[ - {RGBColor[0.639216, 0.788235, 0.94902], 20}, + { + RGBColor[0.639216, 0.788235, 0.94902], + RGBColor[0.945098, 0.968627, 0.992157], + 20 + }, "SendChatButton" ] ], @@ -12318,36 +12322,93 @@ Notebook[ TemplateBoxOptions -> { DisplayFunction -> (Function[ - GraphicsBox[ - { - Thickness[0.055556], - FaceForm[#1], - FilledCurveBox[ - { - { - {0, 2, 0}, - {1, 3, 3}, - {0, 1, 0}, - {1, 3, 3}, - {0, 1, 0}, - {1, 3, 3}, - {1, 3, 3}, - {0, 1, 0}, - {1, 3, 3}, - {0, 1, 0}, - {1, 3, 3}, - {0, 1, 0}, - {1, 3, 3} - } - }, - CompressedData[ - "\n1:eJxTTMoPSmVmYGBgBGIZIGYC4i9/r1S8ZDNwKM6Y+Lbmv67DvcntrVGX/9lL\n699VYWPUdXiwj2+O8aIP9t05z3+v/Kjj8Dsm9+i/TY/tN819v/zYaS0HweO7\ndvSyfbHfUzJZgmWapsOWyK87b3UJOjwRkT35dL6yQ+2FzUARIQcrZa/qZn5l\nh1VNgZ5zG0Qcpm3iKVzzWsnh/gPuySuZxBz2PgZqcFV2WPsLaIGdksPNc9+D\nHy9Vc7CadLreY7+SQ75Q84FTD9Ucdv5p/3I7XNmh8qWaIccaNQcTQTObvZOU\nHYC2h/HpqjnY7A2apnhO2WGd+8MqkXWqDt/Z4mf4TFV2uL64wJZLXNUhM/9D\n60kRZQenhKcXlG6rOEScMjqycZ24w4y7QI9XKToo5VRULdURc/jn/OvtawVF\nB6Y9rEIi9qIOlRErTM9GKzhsa6kB+kjUoWXe2VXnReUdNjA/79HIFXOQmHqF\nM2MRt4Pv577gkiViDo/NpA5EL2Bx0M9bzLiHVdrhUNvy8FObGB1AofM3VdaB\nKwNo0y82B1W2xqnOpw0cQMFvv1UL4s9EQwdg6DdOZdZx8AB547mBQ/+hrxox\n/HoO6PEFAPo2ybM=\n " - ] - ] - }, - AspectRatio -> Automatic, - ImageSize -> #2, - PlotRange -> {{-0.5, 18.5}, {-0.5, 18.5}} + TagBox[ + PaneSelectorBox[ + { + False -> + FrameBox[ + GraphicsBox[ + { + Thickness[0.055556], + FaceForm[#1], + FilledCurveBox[ + { + { + {0, 2, 0}, + {1, 3, 3}, + {0, 1, 0}, + {1, 3, 3}, + {0, 1, 0}, + {1, 3, 3}, + {1, 3, 3}, + {0, 1, 0}, + {1, 3, 3}, + {0, 1, 0}, + {1, 3, 3}, + {0, 1, 0}, + {1, 3, 3} + } + }, + CompressedData[ + "\n1:eJxTTMoPSmVmYGBgBGIZIGYC4i9/r1S8ZDNwKM6Y+Lbmv67DvcntrVGX/9lL\n699VYWPUdXiwj2+O8aIP9t05z3+v/Kjj8Dsm9+i/TY/tN819v/zYaS0HweO7\ndvSyfbHfUzJZgmWapsOWyK87b3UJOjwRkT35dL6yQ+2FzUARIQcrZa/qZn5l\nh1VNgZ5zG0Qcpm3iKVzzWsnh/gPuySuZxBz2PgZqcFV2WPsLaIGdksPNc9+D\nHy9Vc7CadLreY7+SQ75Q84FTD9Ucdv5p/3I7XNmh8qWaIccaNQcTQTObvZOU\nHYC2h/HpqjnY7A2apnhO2WGd+8MqkXWqDt/Z4mf4TFV2uL64wJZLXNUhM/9D\n60kRZQenhKcXlG6rOEScMjqycZ24w4y7QI9XKToo5VRULdURc/jn/OvtawVF\nB6Y9rEIi9qIOlRErTM9GKzhsa6kB+kjUoWXe2VXnReUdNjA/79HIFXOQmHqF\nM2MRt4Pv577gkiViDo/NpA5EL2Bx0M9bzLiHVdrhUNvy8FObGB1AofM3VdaB\nKwNo0y82B1W2xqnOpw0cQMFvv1UL4s9EQwdg6DdOZdZx8AB547mBQ/+hrxox\n/HoO6PEFAPo2ybM=\n " + ] + ] + }, + AspectRatio -> Automatic, + ImageSize -> #3, + PlotRange -> {{-0.5, 18.5}, {-0.5, 18.5}} + ], + FrameStyle -> GrayLevel[1], + Background -> GrayLevel[1], + RoundingRadius -> 3, + FrameMargins -> 1, + StripOnInput -> False + ], + True -> + FrameBox[ + GraphicsBox[ + { + Thickness[0.055556], + FaceForm[#1], + FilledCurveBox[ + { + { + {0, 2, 0}, + {1, 3, 3}, + {0, 1, 0}, + {1, 3, 3}, + {0, 1, 0}, + {1, 3, 3}, + {1, 3, 3}, + {0, 1, 0}, + {1, 3, 3}, + {0, 1, 0}, + {1, 3, 3}, + {0, 1, 0}, + {1, 3, 3} + } + }, + CompressedData[ + "\n1:eJxTTMoPSmVmYGBgBGIZIGYC4i9/r1S8ZDNwKM6Y+Lbmv67DvcntrVGX/9lL\n699VYWPUdXiwj2+O8aIP9t05z3+v/Kjj8Dsm9+i/TY/tN819v/zYaS0HweO7\ndvSyfbHfUzJZgmWapsOWyK87b3UJOjwRkT35dL6yQ+2FzUARIQcrZa/qZn5l\nh1VNgZ5zG0Qcpm3iKVzzWsnh/gPuySuZxBz2PgZqcFV2WPsLaIGdksPNc9+D\nHy9Vc7CadLreY7+SQ75Q84FTD9Ucdv5p/3I7XNmh8qWaIccaNQcTQTObvZOU\nHYC2h/HpqjnY7A2apnhO2WGd+8MqkXWqDt/Z4mf4TFV2uL64wJZLXNUhM/9D\n60kRZQenhKcXlG6rOEScMjqycZ24w4y7QI9XKToo5VRULdURc/jn/OvtawVF\nB6Y9rEIi9qIOlRErTM9GKzhsa6kB+kjUoWXe2VXnReUdNjA/79HIFXOQmHqF\nM2MRt4Pv577gkiViDo/NpA5EL2Bx0M9bzLiHVdrhUNvy8FObGB1AofM3VdaB\nKwNo0y82B1W2xqnOpw0cQMFvv1UL4s9EQwdg6DdOZdZx8AB547mBQ/+hrxox\n/HoO6PEFAPo2ybM=\n " + ] + ] + }, + AspectRatio -> Automatic, + ImageSize -> #3, + PlotRange -> {{-0.5, 18.5}, {-0.5, 18.5}} + ], + FrameStyle -> #1, + Background -> #2, + RoundingRadius -> 3, + FrameMargins -> 1, + StripOnInput -> False + ] + }, + Dynamic[CurrentValue["MouseOver"]], + ImageSize -> Automatic, + FrameMargins -> 0 + ], + MouseAppearanceTag["LinkHand"] ] ]) } @@ -12363,7 +12424,7 @@ Notebook[ { False -> ButtonBox[ - TemplateBox[{#1, #2}, "SendChatButtonLabel"], + TemplateBox[{#1, #2, #3}, "SendChatButtonLabel"], ButtonFunction :> ( Wolfram`Chatbook`$ChatEvaluationCell = @@ -12374,27 +12435,18 @@ Notebook[ Notebooks[Wolfram`ChatNB`cell$$], "EvaluateCells" ]), + Appearance -> + FEPrivate`FrontEndResource[ + "FEExpressions", + "SuppressMouseDownNinePatchAppearance" + ], FrameMargins -> 0, Method -> "Queued", - Appearance -> Automatic, Evaluator -> Automatic ], True -> ButtonBox[ - OverlayBox[ - { - TemplateBox[{#2}, "ChatEvaluatingSpinner"], - GraphicsBox[ - { - RGBColor[0.71373, 0.054902, 0.0], - RectangleBox[{-0.5, -0.5}, {0.5, 0.5}] - }, - ImageSize -> #2, - PlotRange -> 1.1 - ] - }, - Alignment -> {Center, Center} - ], + TemplateBox[{#1, #2, #3}, "StopChatButtonLabel"], ButtonFunction :> If[ UnsameQ[ Wolfram`Chatbook`$ChatEvaluationCell, @@ -12409,8 +12461,12 @@ Notebook[ Needs["Wolfram`Chatbook`" -> None]; Symbol["Wolfram`Chatbook`ChatbookAction"]["StopChat"] ], + Appearance -> + FEPrivate`FrontEndResource[ + "FEExpressions", + "SuppressMouseDownNinePatchAppearance" + ], FrameMargins -> 0, - Appearance -> Automatic, Evaluator -> Automatic, Method -> "Preemptive" ] @@ -12421,7 +12477,8 @@ Notebook[ Wolfram`ChatNB`cell$$ ] ], - Alignment -> {Automatic, Baseline} + Alignment -> {Automatic, Baseline}, + ImageSize -> Automatic ], Initialization :> (Wolfram`ChatNB`cell$$ = @@ -12955,6 +13012,68 @@ Notebook[ ]) } ], + Cell[ + StyleData["StopChatButtonLabel"], + TemplateBoxOptions -> { + DisplayFunction -> + (Function[ + TagBox[ + PaneSelectorBox[ + { + False -> + FrameBox[ + OverlayBox[ + { + TemplateBox[{#3}, "ChatEvaluatingSpinner"], + GraphicsBox[ + { + RGBColor[0.71373, 0.054902, 0.0], + RectangleBox[{-0.5, -0.5}, {0.5, 0.5}] + }, + ImageSize -> #3, + PlotRange -> 1.1 + ] + }, + Alignment -> {Center, Center} + ], + FrameStyle -> GrayLevel[1], + Background -> GrayLevel[1], + RoundingRadius -> 3, + FrameMargins -> 1, + StripOnInput -> False + ], + True -> + FrameBox[ + OverlayBox[ + { + TemplateBox[{#3}, "ChatEvaluatingSpinner"], + GraphicsBox[ + { + RGBColor[0.71373, 0.054902, 0.0], + RectangleBox[{-0.5, -0.5}, {0.5, 0.5}] + }, + ImageSize -> #3, + PlotRange -> 1.1 + ] + }, + Alignment -> {Center, Center} + ], + FrameStyle -> #1, + Background -> #2, + RoundingRadius -> 3, + FrameMargins -> 1, + StripOnInput -> False + ] + }, + Dynamic[CurrentValue["MouseOver"]], + ImageSize -> Automatic, + FrameMargins -> 0 + ], + MouseAppearanceTag["LinkHand"] + ] + ]) + } + ], Cell[ StyleData["ThumbsDownActive"], TemplateBoxOptions -> { @@ -18224,7 +18343,7 @@ Notebook[ { }, DynamicBox[ ToBoxes[ - Wolfram`Chatbook`InlineReferences`personaTemplateBoxes[ + Wolfram`Chatbook`Common`personaTemplateBoxes[ 1, #input, #state, @@ -18254,7 +18373,7 @@ Notebook[ { }, DynamicBox[ ToBoxes[ - Wolfram`Chatbook`InlineReferences`modifierTemplateBoxes[ + Wolfram`Chatbook`Common`modifierTemplateBoxes[ 1, #input, #params, @@ -18285,7 +18404,7 @@ Notebook[ { }, DynamicBox[ ToBoxes[ - Wolfram`Chatbook`InlineReferences`functionTemplateBoxes[ + Wolfram`Chatbook`Common`functionTemplateBoxes[ 1, #input, #params, @@ -18316,7 +18435,7 @@ Notebook[ { }, DynamicBox[ ToBoxes[ - Wolfram`Chatbook`InlineReferences`wlTemplateBoxes[ + Wolfram`Chatbook`Common`wlTemplateBoxes[ 1, #input, #state, diff --git a/FrontEnd/StyleSheets/Wolfram/WorkspaceChat.nb b/FrontEnd/StyleSheets/Wolfram/WorkspaceChat.nb index beeeaebc..2ec037ef 100644 --- a/FrontEnd/StyleSheets/Wolfram/WorkspaceChat.nb +++ b/FrontEnd/StyleSheets/Wolfram/WorkspaceChat.nb @@ -60,7 +60,7 @@ Notebook[ ], Cell[ StyleData["WorkspaceChatStyleSheetInformation"], - TaggingRules -> <|"WorkspaceChatStyleSheetVersion" -> "1.4.6.3930718414"|> + TaggingRules -> <|"WorkspaceChatStyleSheetVersion" -> "1.4.8.3931491780"|> ], Cell[ StyleData["ChatInput"], @@ -158,43 +158,38 @@ Notebook[ { None -> ButtonBox[ - TemplateBox[{#1, #2}, "SendChatButtonLabel"], + TemplateBox[{#1, #2, #3}, "SendChatButtonLabel"], ButtonFunction :> (Needs["Wolfram`Chatbook`" -> None]; Symbol["Wolfram`Chatbook`ChatbookAction"][ "EvaluateWorkspaceChat", - #3, + #4, Dynamic[ - CurrentValue[#3, {TaggingRules, "ChatInputString"}] + CurrentValue[#4, {TaggingRules, "ChatInputString"}] ] ]), + Appearance -> + FEPrivate`FrontEndResource[ + "FEExpressions", + "SuppressMouseDownNinePatchAppearance" + ], FrameMargins -> 0, Method -> "Queued", - Appearance -> Automatic, Evaluator -> Automatic ] }, Dynamic[Wolfram`Chatbook`$ChatEvaluationCell], ButtonBox[ - OverlayBox[ - { - TemplateBox[{#2}, "ChatEvaluatingSpinner"], - GraphicsBox[ - { - RGBColor[0.71373, 0.054902, 0.0], - RectangleBox[{-0.5, -0.5}, {0.5, 0.5}] - }, - ImageSize -> #2, - PlotRange -> 1.1 - ] - }, - Alignment -> {Center, Center} - ], + TemplateBox[{#1, #2, #3}, "StopChatButtonLabel"], ButtonFunction :> (Needs["Wolfram`Chatbook`" -> None]; Symbol["Wolfram`Chatbook`ChatbookAction"]["StopChat"]), + Appearance -> + FEPrivate`FrontEndResource[ + "FEExpressions", + "SuppressMouseDownNinePatchAppearance" + ], FrameMargins -> 0, - Appearance -> Automatic, Evaluator -> Automatic, Method -> "Preemptive" ], diff --git a/PacletInfo.wl b/PacletInfo.wl index 36ede23b..e67dabcd 100644 --- a/PacletInfo.wl +++ b/PacletInfo.wl @@ -1,7 +1,7 @@ PacletObject[ <| "Name" -> "Wolfram/Chatbook", "PublisherID" -> "Wolfram", - "Version" -> "1.4.7", + "Version" -> "1.4.8", "WolframVersion" -> "13.3+", "Description" -> "Wolfram Notebooks + LLMs", "License" -> "MIT", diff --git a/Source/Chatbook/ChatModes/ShowCodeAssistance.wl b/Source/Chatbook/ChatModes/ShowCodeAssistance.wl index 3899047d..19efe860 100644 --- a/Source/Chatbook/ChatModes/ShowCodeAssistance.wl +++ b/Source/Chatbook/ChatModes/ShowCodeAssistance.wl @@ -17,6 +17,51 @@ $workspaceChatNotebookOptions = Sequence[ StyleDefinitions -> FrontEnd`FileName[ { "Wolfram" }, "WorkspaceChat.nb", CharacterEncoding -> "UTF-8" ] ]; +(* ::**************************************************************************************************************:: *) +(* ::Section::Closed:: *) +(*EnableCodeAssistance*) +EnableCodeAssistance // beginDefinition; +EnableCodeAssistance[ ] := catchMine @ Once[ enableCodeAssistance[ ]; Null, "FrontEndSession" ]; +EnableCodeAssistance // endExportedDefinition; + +(* ::**************************************************************************************************************:: *) +(* ::Subsection::Closed:: *) +(*enableCodeAssistance*) +enableCodeAssistance // beginDefinition; + +enableCodeAssistance[ ] := FrontEndExecute @ { + FrontEnd`AddMenuCommands[ + "OpenHelpLink", + { + MenuItem[ + "Code Assistance Chat\[Ellipsis]", + FrontEnd`KernelExecute[ + Needs[ "Wolfram`Chatbook`" -> None ]; + Symbol[ "Wolfram`Chatbook`ShowCodeAssistance" ][ "Window" ] + ], + FrontEnd`MenuEvaluator -> Automatic, + Evaluate[ + If[ $OperatingSystem === "MacOSX", + FrontEnd`MenuKey[ "'", FrontEnd`Modifiers -> { FrontEnd`Control } ], + FrontEnd`MenuKey[ "'", FrontEnd`Modifiers -> { FrontEnd`Command } ] + ] + ] + ], + MenuItem[ + "Code Assistance for Selection", + FrontEnd`KernelExecute[ + Needs[ "Wolfram`Chatbook`" -> None ]; + Symbol[ "Wolfram`Chatbook`ShowCodeAssistance" ][ "Inline" ] + ], + FrontEnd`MenuEvaluator -> Automatic, + FrontEnd`MenuKey[ "'", FrontEnd`Modifiers -> { FrontEnd`Control, FrontEnd`Shift } ] + ] + } + ] +}; + +enableCodeAssistance // endDefinition; + (* ::**************************************************************************************************************:: *) (* ::Section::Closed:: *) (*ShowCodeAssistance*) diff --git a/Source/Chatbook/ChatModes/UI.wl b/Source/Chatbook/ChatModes/UI.wl index bdb141f4..d65fec21 100644 --- a/Source/Chatbook/ChatModes/UI.wl +++ b/Source/Chatbook/ChatModes/UI.wl @@ -117,7 +117,10 @@ $attachedWorkspaceChatInputCell := $attachedWorkspaceChatInputCell = Cell[ ], $inputFieldFrameOptions ], - RawBoxes @ TemplateBox[ { RGBColor[ "#a3c9f2" ], 27, thisNB }, "WorkspaceSendChatButton" ] + RawBoxes @ TemplateBox[ + { RGBColor[ "#a3c9f2" ], RGBColor[ "#f1f7fd" ], 27, thisNB }, + "WorkspaceSendChatButton" + ] } }, BaseStyle -> { Magnification -> $inputFieldGridMagnification } @@ -317,7 +320,10 @@ inlineChatInputField[ $inputFieldFrameOptions ], (* FIXME: this needs a custom button *) - RawBoxes @ inlineTemplateBox @ TemplateBox[ { RGBColor[ "#a3c9f2" ], 27 }, "SendChatButton" ], + RawBoxes @ inlineTemplateBox @ TemplateBox[ + { RGBColor[ "#a3c9f2" ], RGBColor[ "#f1f7fd" ], 27 }, + "SendChatButton" + ], Style[ ActionMenu[ "More", diff --git a/Source/Chatbook/ChatState.wl b/Source/Chatbook/ChatState.wl index b9aae92d..612ca939 100644 --- a/Source/Chatbook/ChatState.wl +++ b/Source/Chatbook/ChatState.wl @@ -86,11 +86,14 @@ withChatEvaluationCell[ cell_CellObject, eval_ ] := eval ] , - $ChatEvaluationCell = None; - If[ $CloudEvaluation, - (* Workaround for dynamic in send/stop button not updating in cloud: *) - NotebookWrite[ cell, NotebookRead @ cell, None, AutoScroll -> False ] - ] + (* CompoundExpression cannot be used here due to bug(450686): *) + { + $ChatEvaluationCell = None, + If[ $CloudEvaluation, + (* Workaround for dynamic in send/stop button not updating in cloud: *) + NotebookWrite[ cell, NotebookRead @ cell, None, AutoScroll -> False ] + ] + } ]; withChatEvaluationCell // endDefinition; @@ -117,7 +120,13 @@ forceRedrawCellFrameLabels // endDefinition; $defaultCellFrameLabels = { - { None, Cell[ BoxData @ TemplateBox[ { RGBColor[ "#a3c9f2" ], 20 }, "SendChatButton" ], Background -> None ] }, + { + None, + Cell[ + BoxData @ TemplateBox[ { RGBColor[ "#a3c9f2" ], RGBColor[ "#f1f7fd" ], 20 }, "SendChatButton" ], + Background -> None + ] + }, { None, None } }; diff --git a/Source/Chatbook/Common.wl b/Source/Chatbook/Common.wl index 0c474d1b..886fcfe8 100644 --- a/Source/Chatbook/Common.wl +++ b/Source/Chatbook/Common.wl @@ -1118,6 +1118,13 @@ chatbookIcon[ name_String, False ] := inlineTemplateBox @ chatbookIcon[ name, Tr chatbookIcon[ name_String, icon: Except[ _Missing ] ] := icon; chatbookIcon // endDefinition; +(* ::**************************************************************************************************************:: *) +(* ::Section::Closed:: *) +(*InlineTemplateBoxes*) +InlineTemplateBoxes // beginDefinition; +InlineTemplateBoxes[ expr_ ] := catchMine @ inlineTemplateBoxes @ expr; +InlineTemplateBoxes // endExportedDefinition; + (* ::**************************************************************************************************************:: *) (* ::Subsection::Closed:: *) (*inlineTemplateBox*) diff --git a/Source/Chatbook/Explode.wl b/Source/Chatbook/Explode.wl index 2ba6c867..79af0742 100644 --- a/Source/Chatbook/Explode.wl +++ b/Source/Chatbook/Explode.wl @@ -24,7 +24,10 @@ $$newCellStyle = Alternatives[ (* ::**************************************************************************************************************:: *) (* ::Section::Closed:: *) -(*Explode Cell*) +(*ExplodeCell*) +ExplodeCell // beginDefinition; +ExplodeCell[ cell_Cell ] := catchMine @ explodeCell @ cell; +ExplodeCell // endExportedDefinition; (* ::**************************************************************************************************************:: *) (* ::Subsection::Closed:: *) @@ -76,7 +79,7 @@ $preprocessingRules := $preprocessingRules = Dispatch @ { ] :> cell, (* Convert "ChatCodeInlineTemplate" to "InlineCode" cells: *) - Cell[ BoxData[ TemplateBox[ { boxes_ }, "ChatCodeInlineTemplate" ], ___ ], "ChatCode"|"ChatCodeActive", ___ ] :> + Cell[ BoxData[ TemplateBox[ { boxes_ }, "ChatCodeInlineTemplate", ___ ], ___ ], "ChatCode"|"ChatCodeActive", ___ ] :> Cell[ BoxData @ boxes, "InlineCode" ], (* Remove "ChatCode" styling: *) @@ -89,7 +92,7 @@ $preprocessingRules := $preprocessingRules = Dispatch @ { Cell[ text_, "ChatPreformatted", ___ ] :> Cell[ text, "Program" ], (* Remove "ChatCodeBlockTemplate" template boxes: *) - TemplateBox[ { cell_Cell }, "ChatCodeBlockTemplate" ] :> cell, + TemplateBox[ { cell_Cell }, "ChatCodeBlockTemplate", ___ ] :> cell, (* Remove nested cells: *) Cell @ BoxData[ cell_Cell, ___ ] :> cell, diff --git a/Source/Chatbook/Formatting.wl b/Source/Chatbook/Formatting.wl index 2934fb55..320575f6 100644 --- a/Source/Chatbook/Formatting.wl +++ b/Source/Chatbook/Formatting.wl @@ -2540,7 +2540,6 @@ stringToBoxes // endDefinition; stringToBoxes0 // beginDefinition; -stringToBoxes0[ RowBox @ { a___, b: "\n"|"\[IndentingNewLine]", c___ } ] := stringToBoxes0 @ { a, b, c }; stringToBoxes0[ boxes_? boxDataQ ] := boxes; stringToBoxes0 // endDefinition; diff --git a/Source/Chatbook/Main.wl b/Source/Chatbook/Main.wl index 13c89aa5..65f7a29a 100644 --- a/Source/Chatbook/Main.wl +++ b/Source/Chatbook/Main.wl @@ -39,6 +39,8 @@ BeginPackage[ "Wolfram`Chatbook`" ]; `CreateChatNotebook; `CurrentChatSettings; `DisplayBase64Boxes; +`EnableCodeAssistance; +`ExplodeCell; `FormatChatOutput; `FormatToolCall; `FormatToolResponse; @@ -46,6 +48,7 @@ BeginPackage[ "Wolfram`Chatbook`" ]; `GetChatHistory; `GetExpressionURI; `GetExpressionURIs; +`InlineTemplateBoxes; `InvalidateServiceCache; `MakeExpressionURI; `SandboxLinguisticAssistantData; @@ -157,6 +160,8 @@ Protect[ CreateChatNotebook, CurrentChatSettings, DisplayBase64Boxes, + EnableCodeAssistance, + ExplodeCell, FormatChatOutput, FormatToolCall, FormatToolResponse, @@ -164,6 +169,7 @@ Protect[ GetChatHistory, GetExpressionURI, GetExpressionURIs, + InlineTemplateBoxes, MakeExpressionURI, SandboxLinguisticAssistantData, SetModel, diff --git a/Source/Chatbook/Serialization.wl b/Source/Chatbook/Serialization.wl index e93fa08f..35262803 100644 --- a/Source/Chatbook/Serialization.wl +++ b/Source/Chatbook/Serialization.wl @@ -15,6 +15,12 @@ Needs[ "Wolfram`Chatbook`" ]; Needs[ "Wolfram`Chatbook`Common`" ]; Needs[ "Wolfram`Chatbook`ErrorUtils`" ]; + +(* FIXME: + Serialize strike-through: + StyleBox[..., FontVariations -> {"StrikeThrough" -> True}] +*) + (* TODO: There should be a way to pass custom serialization rules in chat settings, e.g. @@ -142,7 +148,7 @@ $conversionRules = None; (* Add spacing around these operators *) $$spacedInfixOperator = Alternatives[ - "^", "*", "+", "=", "|", "<", ">", "?", "/", ":", "!=", "@*", "^=", "&&", "*=", "-=", "->", "+=", "==", "~~", + "^", "*", "+", "-", "=", "|", "<", ">", "?", "/", ":", "!=", "@*", "^=", "&&", "*=", "-=", "->", "+=", "==", "~~", "||", "<=", "<>", ">=", ";;", "/@", "/*", "/=", "/.", "/;", ":=", ":>", "::", "^:=", "=!=", "===", "|->", "<->", "//@", "//.", "\[Equal]", "\[GreaterEqual]", "\[LessEqual]", "\[NotEqual]", "\[Function]", "\[Rule]", "\[RuleDelayed]", "\[TwoWayRule]" @@ -2268,6 +2274,7 @@ sowMessageData[ ___ ] := Null; (*showStringCharactersQ*) showStringCharactersQ[ Cell[ __, "TextTableForm", ___ ] ] := False; showStringCharactersQ[ Cell[ __, "MoreInfoText", ___ ] ] := False; +showStringCharactersQ[ Cell[ _, OptionsPattern[ ] ] ] := False; showStringCharactersQ[ ___ ] := True; (* ::**************************************************************************************************************:: *) diff --git a/Source/Chatbook/Settings.wl b/Source/Chatbook/Settings.wl index 2bb349a6..2e586699 100644 --- a/Source/Chatbook/Settings.wl +++ b/Source/Chatbook/Settings.wl @@ -710,7 +710,7 @@ setCurrentChatSettings1[ scope: $$feObj, Inherited ] := WithCleanup[ CurrentValue[ scope, { TaggingRules, "ChatNotebookSettings" } ] = Inherited ], (* Invalidate cache *) - $currentSettingsCache = <| |> + If[ AssociationQ @ $currentSettingsCache, $currentSettingsCache = <| |> ] (* Note: It may be more slightly more efficient to just invalidate for the given `scope`, but that would require also finding scopes that `scope` inherits from and invalidating those as well. This is much simpler. *) ]; @@ -723,7 +723,7 @@ setCurrentChatSettings1[ scope: $$feObj, value_ ] := CurrentValue[ scope, { TaggingRules, "ChatNotebookSettings" } ] = as ], (* Invalidate cache *) - $currentSettingsCache = <| |> + If[ AssociationQ @ $currentSettingsCache, $currentSettingsCache = <| |> ] ] /; AssociationQ @ as ]; @@ -733,7 +733,7 @@ setCurrentChatSettings1[ scope: $$feObj, key_String? StringQ, value_ ] := WithCl CurrentValue[ scope, { TaggingRules, "ChatNotebookSettings", key } ] = value ], (* Invalidate cache *) - $currentSettingsCache = <| |> + If[ AssociationQ @ $currentSettingsCache, $currentSettingsCache = <| |> ] ]; setCurrentChatSettings1 // endDefinition; diff --git a/Source/Chatbook/Tools/Common.wl b/Source/Chatbook/Tools/Common.wl index 7430800f..2e38bf13 100644 --- a/Source/Chatbook/Tools/Common.wl +++ b/Source/Chatbook/Tools/Common.wl @@ -180,7 +180,7 @@ addExtraToolData // endDefinition; (* ::Subsection::Closed:: *) (*getToolByName*) getToolByName // beginDefinition; -getToolByName[ name_String ] := Lookup[ $toolBox, toCanonicalToolName @ name ]; +getToolByName[ name_String ] := Lookup[ $AvailableTools, toCanonicalToolName @ name ]; getToolByName // endDefinition; (* ::**************************************************************************************************************:: *) @@ -896,7 +896,10 @@ toolShortName[ as_Association ] := toolShortName[ name_String ] := With[ { tool = getToolByName @ name }, - toolShortName @ tool /; MatchQ[ tool, $$llmTool ] + If[ MatchQ[ tool, $$llmTool ], + toolShortName @ tool, + name + ] ]; toolShortName // endDefinition; diff --git a/Source/Chatbook/Tools/DefaultTools.wl b/Source/Chatbook/Tools/DefaultTools.wl index 38dea119..c3f692a1 100644 --- a/Source/Chatbook/Tools/DefaultTools.wl +++ b/Source/Chatbook/Tools/DefaultTools.wl @@ -730,7 +730,7 @@ user // endDefinition; (* ::Subsubsubsection::Closed:: *) (*assistant*) assistant // beginDefinition; -assistant[ { a___, "tool" -> { name_String, as_Association }, b___ } ] := assistant @ { a, toolCall[ name, as ], b }; +assistant[ { a___, "tool"|"Tool" -> { name_, as_ }, b___ } ] := assistant @ { a, toolCall[ name, as ], b }; assistant[ a_List ] := TemplateApply[ messageTemplate[ "Assistant" ], StringRiffle[ TextString /@ Flatten @ a, "\n" ] ]; assistant[ a_String ] := assistant @ { a }; assistant // endDefinition; @@ -754,14 +754,15 @@ toolCall // endDefinition; (* ::Subsubsubsection::Closed:: *) (*toolExample*) toolExample // beginDefinition; -toolExample[ rules: (_Rule|_String).. ] := StringRiffle[ toolExample0 /@ { rules }, "\n\n" ]; +toolExample[ { rules: (_Rule|_String)... } ] := StringRiffle[ toolExample0 /@ { rules }, "\n\n" ]; +toolExample[ rules: (_Rule|_String)... ] := toolExample @ { rules }; toolExample // endDefinition; toolExample0 // beginDefinition; -toolExample0[ "user" -> message_ ] := user @ message; -toolExample0[ "assistant" -> message_ ] := assistant @ message; -toolExample0[ "system" -> message_ ] := system @ message; -toolExample0[ prompt_String ] := prompt; +toolExample0[ "user"|"User" -> message_ ] := user @ message; +toolExample0[ "assistant"|"Assistant" -> message_ ] := assistant @ message; +toolExample0[ "system"|"System" -> message_ ] := system @ message; +toolExample0[ prompt_String ] := prompt; toolExample0 // endDefinition; (* ::**************************************************************************************************************:: *) diff --git a/Source/Chatbook/Utils.wl b/Source/Chatbook/Utils.wl index 5436c386..38a663b8 100644 --- a/Source/Chatbook/Utils.wl +++ b/Source/Chatbook/Utils.wl @@ -370,17 +370,17 @@ uriData // endDefinition; (*exportDataURI*) exportDataURI // beginDefinition; -exportDataURI[ data_ ] := +exportDataURI[ data_, opts: OptionsPattern[ ] ] := With[ { mime = guessExpressionMimeType @ data }, - exportDataURI[ data, mimeTypeToFormat @ mime, mime ] + exportDataURI[ data, mimeTypeToFormat @ mime, mime, opts ] ]; -exportDataURI[ data_, fmt_String ] := - exportDataURI[ data, fmt, formatToMIMEType @ fmt ]; +exportDataURI[ data_, fmt_String, opts: OptionsPattern[ ] ] := + exportDataURI[ data, fmt, formatToMIMEType @ fmt, opts ]; -exportDataURI[ data_, fmt_String, mime_String ] := Enclose[ +exportDataURI[ data_, fmt_String, mime_String, opts: OptionsPattern[ ] ] := Enclose[ Module[ { base64 }, - base64 = ConfirmBy[ usingFrontEnd @ ExportString[ data, { "Base64", fmt } ], StringQ, "Base64" ]; + base64 = ConfirmBy[ usingFrontEnd @ ExportString[ data, { "Base64", fmt }, opts ], StringQ, "Base64" ]; "data:" <> mime <> ";base64," <> StringDelete[ base64, "\n" ] ], throwInternalFailure diff --git a/Source/Startup/Begin/BeginStartup.wl b/Source/Startup/Begin/BeginStartup.wl index dc3d999d..8972bce7 100644 --- a/Source/Startup/Begin/BeginStartup.wl +++ b/Source/Startup/Begin/BeginStartup.wl @@ -37,46 +37,6 @@ If[ ! PacletNewerQ[ Wolfram`ChatbookStartupDump`$versionString, "13.3.0" ], ] ] -(*--------------------------------*) -(* Adds Help > Code Assistance... *) -(*--------------------------------*) -(* Once code assistance is ready, this "14.1.0" can be changed to "14.0.0" to enable it for 14.1 users: *) -If[ PacletNewerQ[ Wolfram`ChatbookStartupDump`$versionString, "14.1.0" ], - Once[ - FrontEndExecute @ { - FrontEnd`AddMenuCommands[ - "OpenHelpLink", - { - MenuItem[ - "Code Assistance Chat\[Ellipsis]", - FrontEnd`KernelExecute[ - Needs[ "Wolfram`Chatbook`" -> None ]; - Symbol[ "Wolfram`Chatbook`ShowCodeAssistance" ][ "Window" ] - ], - FrontEnd`MenuEvaluator -> Automatic, - Evaluate[ - If[ $OperatingSystem === "MacOSX", - FrontEnd`MenuKey[ "'", FrontEnd`Modifiers -> { FrontEnd`Control } ], - FrontEnd`MenuKey[ "'", FrontEnd`Modifiers -> { FrontEnd`Command } ] - ] - ] - ], - MenuItem[ - "Code Assistance for Selection", - FrontEnd`KernelExecute[ - Needs[ "Wolfram`Chatbook`" -> None ]; - Symbol[ "Wolfram`Chatbook`ShowCodeAssistance" ][ "Inline" ] - ], - FrontEnd`MenuEvaluator -> Automatic, - FrontEnd`MenuKey[ "'", FrontEnd`Modifiers -> { FrontEnd`Control, FrontEnd`Shift } ] - ] - } - ] - }, - "FrontEndSession" - ] -] - (*----------------------------*) (* Add CreateNotebook["Chat"] *) (*----------------------------*) diff --git a/Source/Startup/End/EndStartup.wl b/Source/Startup/End/EndStartup.wl index 37bec369..4bc4c3e7 100644 --- a/Source/Startup/End/EndStartup.wl +++ b/Source/Startup/End/EndStartup.wl @@ -3,3 +3,11 @@ started running. *) {$Context, $ContextPath, $ContextAliases} = Wolfram`ChatbookStartupDump`$ContextInfo; + +(*--------------------------------*) +(* Adds Help > Code Assistance... *) +(*--------------------------------*) +(* Once code assistance is ready, this "14.1.0" can be changed to "14.0.0" to enable it for 14.1 users: *) +If[ PacletNewerQ[ Wolfram`ChatbookStartupDump`$versionString, "14.1.0" ], + Wolfram`Chatbook`EnableCodeAssistance[ ] +] \ No newline at end of file