Skip to content

Commit 7b2b366

Browse files
committed
Bugfix: Attempt a PacletDataRebuild[] if FrontEndResource["ChatbookStrings", name] fails
1 parent f9de227 commit 7b2b366

File tree

2 files changed

+36
-9
lines changed

2 files changed

+36
-9
lines changed

Source/Chatbook/Common.wl

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1340,9 +1340,33 @@ tr // endDefinition;
13401340
(*trRaw*)
13411341
trRaw // beginDefinition;
13421342
trRaw[ name_? StringQ ] /; $CloudEvaluation := cloudTextResource @ name;
1343-
trRaw[ name_? StringQ ] := FrontEndResource[ "ChatbookStrings", name ];
1343+
trRaw[ name_? StringQ ] := chatbookString @ name;
13441344
trRaw // endDefinition;
13451345

1346+
(* ::**************************************************************************************************************:: *)
1347+
(* ::Subsubsection::Closed:: *)
1348+
(*chatbookString*)
1349+
chatbookString // beginDefinition;
1350+
1351+
chatbookString[ name_String ] := Enclose[
1352+
Catch @ Module[ { string },
1353+
string = ConfirmMatch[ usingFrontEnd @ FrontEndResource[ "ChatbookStrings", name ], _String|$Failed, "String" ];
1354+
If[ StringQ @ string, Throw @ string ];
1355+
pacletDataRebuild[ ];
1356+
ConfirmBy[ usingFrontEnd @ FrontEndResource[ "ChatbookStrings", name ], StringQ, "Retry" ]
1357+
],
1358+
throwInternalFailure
1359+
];
1360+
1361+
chatbookString // endDefinition;
1362+
1363+
(* ::**************************************************************************************************************:: *)
1364+
(* ::Subsubsubsection::Closed:: *)
1365+
(*pacletDataRebuild*)
1366+
pacletDataRebuild // beginDefinition;
1367+
pacletDataRebuild[ ] := pacletDataRebuild[ ] = PacletDataRebuild[ ];
1368+
pacletDataRebuild // endDefinition;
1369+
13461370
(* ::**************************************************************************************************************:: *)
13471371
(* ::Subsection::Closed:: *)
13481372
(*trStringTemplate*)

Source/Chatbook/PromptGenerators/RelatedDocumentation.wl

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -919,14 +919,17 @@ fetchDocumentationSnippets[ uris: { __String } ] := Enclose[
919919
Module[ { count, text, $results, tasks },
920920
count = Length @ uris;
921921

922-
text = ConfirmBy[
923-
If[ count === 1,
924-
trStringTemplate[ "ProgressTextDownloadingSnippet" ][ count ],
925-
trStringTemplate[ "ProgressTextDownloadingSnippets" ][ count ]
926-
],
927-
StringQ,
928-
"Text"
929-
];
922+
text = If[ $EvaluationEnvironment === "Session",
923+
ConfirmBy[
924+
If[ count === 1,
925+
trStringTemplate[ "ProgressTextDownloadingSnippet" ][ count ],
926+
trStringTemplate[ "ProgressTextDownloadingSnippets" ][ count ]
927+
],
928+
StringQ,
929+
"Text"
930+
],
931+
""
932+
];
930933

931934
withApproximateProgress[
932935
$results = AssociationMap[ <| "URI" -> #1 |> &, uris ];

0 commit comments

Comments
 (0)