Skip to content

Commit

Permalink
Merge pull request #603 from WolframResearch/main
Browse files Browse the repository at this point in the history
Release v1.4.4
  • Loading branch information
rhennigan authored Feb 16, 2024
2 parents 4abdb41 + c9dbbca commit ce7fb3b
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 18 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.4.3",
"Version" -> "1.4.4",
"WolframVersion" -> "13.3+",
"Description" -> "Wolfram Notebooks + LLMs",
"License" -> "MIT",
Expand Down
2 changes: 1 addition & 1 deletion Source/Chatbook/Formatting.wl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ makeResultCell0[ bulletCell[ whitespace_String, item_String ] ] := Flatten @ {

makeResultCell0[ sectionCell[ n_, section_String ] ] := Flatten @ {
"\n",
StyleBox[ formatTextString @ section, sectionStyle @ n, "InlineSection", FontSize -> .8*Inherited ],
styleBox[ formatTextString @ section, sectionStyle @ n, "InlineSection", FontSize -> .8*Inherited ],
$tinyLineBreak
};

Expand Down
7 changes: 7 additions & 0 deletions Source/Chatbook/PreferencesContent.wl
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,13 @@ makeModelNameSelector[
"ServiceModelList"
];

(* TODO:
If the underlying ServiceExecute in getServiceModelList fails (e.g. due to API issues), it currently
returns Missing["NoModelList"]. It might be better to have it return an appropriate Failure[...] instead.
In this case, we would want to indicate to the user that the service is not available, rather than
falling back to the input field method.
*)

If[ models === Missing[ "NotConnected" ],
Throw @ serviceConnectButton[
Dynamic @ service,
Expand Down
7 changes: 7 additions & 0 deletions Source/Chatbook/SendChat.wl
Original file line number Diff line number Diff line change
Expand Up @@ -1682,6 +1682,13 @@ prepareChatOutputPage[ target_CellObject, cell_Cell ] := Enclose[
Throw @ cellPrint @ cell
];

If[ MatchQ[ prevCellExpr, Cell[ BoxData[ TagBox[ _, "DynamicTextDisplay", ___ ], ___ ], ___ ] ],
(* The target cell is a left-over dynamic chat output that hasn't been cleaned up properly,
so delete it and create a new chat output. *)
NotebookDelete @ target;
Throw @ cellPrint @ cell
];

prevPage = ConfirmMatch[
Replace[ First @ prevCellExpr, text_String :> TextData @ { text } ],
_TextData,
Expand Down
3 changes: 3 additions & 0 deletions Source/Chatbook/Services.wl
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ getServiceModelList[ service_String, info_, models0_List ] := Enclose[
throwInternalFailure
];

getServiceModelList[ service_String, info_, Missing[ "NoModelList" ] ] :=
Missing[ "NoModelList" ];

getServiceModelList // endDefinition;

(* ::**************************************************************************************************************:: *)
Expand Down
2 changes: 1 addition & 1 deletion Source/Chatbook/Settings.wl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Needs[ "Wolfram`Chatbook`ResourceInstaller`" ];
(* ::**************************************************************************************************************:: *)
(* ::Section::Closed:: *)
(*Configuration*)
$cloudInheritanceFix := $cloudNotebooks && ! PacletNewerQ[ $CloudVersionNumber, "1.67.1" ];
$cloudInheritanceFix := $cloudNotebooks;

(* cSpell: ignore AIAPI *)
$defaultChatSettings = <|
Expand Down
24 changes: 9 additions & 15 deletions Source/Chatbook/UI.wl
Original file line number Diff line number Diff line change
Expand Up @@ -598,29 +598,23 @@ makeChatActionMenu[
RaiseConfirmMatch[personas, <| (_String -> _Association)... |>];

(* initialize PrivateFrontEndOptions if they aren't already present or somehow broke *)
If[!MatchQ[CurrentValue[$FrontEnd, {PrivateFrontEndOptions, "InterfaceSettings", "Chatbook", "VisiblePersonas"}], {___String}],
CurrentValue[
$FrontEnd,
{PrivateFrontEndOptions, "InterfaceSettings", "Chatbook", "VisiblePersonas"}
] = DeleteCases[Keys[personas], Alternatives["Birdnardo", "RawModel", "Wolfie"]]
If[!MatchQ[CurrentChatSettings[$FrontEnd, "VisiblePersonas"], {___String}],
CurrentChatSettings[$FrontEnd, "VisiblePersonas"] = DeleteCases[
Keys[personas],
Alternatives["Birdnardo", "RawModel", "Wolfie"]
]
];
If[!MatchQ[CurrentValue[$FrontEnd, {PrivateFrontEndOptions, "InterfaceSettings", "Chatbook", "PersonaFavorites"}], {___String}],
CurrentValue[
$FrontEnd,
{PrivateFrontEndOptions, "InterfaceSettings", "Chatbook", "PersonaFavorites"}
] = {"CodeAssistant", "CodeWriter", "PlainChat"}
If[!MatchQ[CurrentChatSettings[$FrontEnd, "PersonaFavorites"], {___String}],
CurrentChatSettings[$FrontEnd, "PersonaFavorites"] = {"CodeAssistant", "CodeWriter", "PlainChat"}
];

(* only show visible personas and sort visible personas based on favorites setting *)
personas = KeyTake[
personas,
CurrentValue[$FrontEnd, {PrivateFrontEndOptions, "InterfaceSettings", "Chatbook", "VisiblePersonas"}]
CurrentChatSettings[$FrontEnd, "VisiblePersonas"]
];
personas = With[{
favorites = CurrentValue[
$FrontEnd,
{PrivateFrontEndOptions, "InterfaceSettings", "Chatbook", "PersonaFavorites"}
]
favorites = CurrentChatSettings[$FrontEnd, "PersonaFavorites"]
},
Association[
(* favorites appear in the exact order provided in the CurrentValue *)
Expand Down

0 comments on commit ce7fb3b

Please sign in to comment.