Skip to content

Commit b6efdcc

Browse files
authored
Merge pull request #1318 from WolframResearch/feature/minor-fixes
Miscellaneous Fixes
2 parents 53bd478 + ab89e02 commit b6efdcc

File tree

5 files changed

+39
-12
lines changed

5 files changed

+39
-12
lines changed

Source/Chatbook/Formatting.wl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,14 @@ makeResultCell0[ thoughtsOpener[ thoughts_String ] ] :=
340340
If[ $thinkingEnd === None, $thinkingEnd = AbsoluteTime[ ] ];
341341
seconds = If[ NumberQ @ $thinkingStart && NumberQ @ $thinkingEnd, Round[ $thinkingEnd - $thinkingStart ] ];
342342
label = If[ NumberQ @ seconds, trStringTemplate[ "FormattingThinkingComplete" ][ <| "time" -> ToString @ seconds |> ], tr @ "FormattingThinkingCompleteFallback" ];
343-
Cell[
344-
BoxData @ templateBox[ { StringTrim @ thoughts, label }, "ThoughtsOpener" ],
345-
"ThoughtsOpener",
346-
Background -> None
347-
]
343+
{
344+
Cell[
345+
BoxData @ templateBox[ { StringTrim @ thoughts, ToBoxes @ label }, "ThoughtsOpener" ],
346+
"ThoughtsOpener",
347+
Background -> None
348+
],
349+
"\n"
350+
}
348351
];
349352

350353
makeResultCell0[ speechCell[ speech_String ] ] :=

Source/Chatbook/PromptGenerators/RelatedDocumentation.wl

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Needs[ "Wolfram`Chatbook`Common`" ];
1212
(*Configuration*)
1313
$snippetType = "Text";
1414
$documentationSnippetVersion := $snippetVersion;
15+
$snippetFetchBatchSize = 25;
1516
$baseURL = "https://www.wolframcloud.com/obj/wolframai-content/DocumentationSnippets";
1617
$documentationSnippetBaseURL := URLBuild @ { $baseURL, $documentationSnippetVersion, $snippetType };
1718
$documentationMarkdownBaseURL := URLBuild @ { $baseURL, $documentationSnippetVersion, "Markdown" };
@@ -103,6 +104,7 @@ $RelatedDocumentationSources = Automatic;
103104
(*RelatedDocumentation*)
104105
RelatedDocumentation // beginDefinition;
105106
RelatedDocumentation // Options = {
107+
"DownloadBatchSize" -> $snippetFetchBatchSize,
106108
"FilteredCount" -> Automatic,
107109
"FilterResults" -> Automatic,
108110
"LLMEvaluator" -> Automatic,
@@ -173,10 +175,12 @@ RelatedDocumentation[ All, "URIs", Automatic, opts: OptionsPattern[ ] ] := catch
173175
RelatedDocumentation[ prompt: $$prompt, "Snippets", Automatic, opts: OptionsPattern[ ] ] := catchMine @ Enclose[
174176
ConfirmMatch[
175177
(* TODO: filter results *)
176-
DeleteMissing @ makeDocSnippets @ vectorDBSearch[
177-
getSources[ prompt, OptionValue[ "Sources" ], OptionValue[ "MaxSources" ] ],
178-
prompt,
179-
"Results"
178+
Block[ { $snippetFetchBatchSize = OptionValue[ "DownloadBatchSize" ] },
179+
DeleteMissing @ makeDocSnippets @ vectorDBSearch[
180+
getSources[ prompt, OptionValue[ "Sources" ], OptionValue[ "MaxSources" ] ],
181+
prompt,
182+
"Results"
183+
]
180184
],
181185
{ ___String },
182186
"Snippets"
@@ -252,7 +256,8 @@ RelatedDocumentation[ prompt_, "Prompt", n_Integer, opts: OptionsPattern[ ] ] :=
252256
OptionValue[ "PromptHeader" ],
253257
$$unspecified :> $usePromptHeader
254258
],
255-
$RelatedDocumentationSources = getSources[ prompt, OptionValue[ "Sources" ], OptionValue[ "MaxSources" ] ]
259+
$RelatedDocumentationSources = getSources[ prompt, OptionValue[ "Sources" ], OptionValue[ "MaxSources" ] ],
260+
$snippetFetchBatchSize = OptionValue[ "DownloadBatchSize" ]
256261
},
257262
relatedDocumentationPrompt[
258263
ensureChatMessages @ prompt,
@@ -1177,6 +1182,9 @@ fetchDocumentationSnippets // beginDefinition;
11771182

11781183
fetchDocumentationSnippets[ { } ] := { };
11791184

1185+
fetchDocumentationSnippets[ uris: { __String } ] /; Length @ uris > $snippetFetchBatchSize :=
1186+
Flatten[ fetchDocumentationSnippets /@ TakeDrop[ uris, $snippetFetchBatchSize ] ];
1187+
11801188
fetchDocumentationSnippets[ uris: { __String } ] := Enclose[
11811189
Module[ { count, text, $results, tasks },
11821190
count = Length @ uris;

Source/Chatbook/Sandbox.wl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,21 @@ $$outputForm := $$outputForm = Alternatives @@ $OutputForms;
8686

8787
$nlpData = <| |>;
8888

89-
$$simpleTemplateBoxName = "Entity"|"EntityClass"|"EntityProperty"|"DateObject"|"Quantity";
89+
$$simpleTemplateBoxName = Alternatives[
90+
"DateObject",
91+
"Entity",
92+
"EntityClass",
93+
"EntityProperty",
94+
"Quantity",
95+
"QuantityMixedUnit1",
96+
"QuantityMixedUnit2",
97+
"QuantityMixedUnit3",
98+
"QuantityMixedUnit4",
99+
"QuantityMixedUnit5",
100+
"QuantityMixedUnit6",
101+
"QuantityPostfix",
102+
"QuantityPrefix"
103+
];
90104

91105
(* ::**************************************************************************************************************:: *)
92106
(* ::Section::Closed:: *)

Source/Chatbook/SendChat.wl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,8 @@ $llmAutoCorrectRules := $llmAutoCorrectRules = Flatten @ {
13161316
"\n<|image_sentinel|>\n" :> "\n",
13171317
"<|image_sentinel|>" :> "",
13181318
"paclet:ref/ResourceFunction/" :> "https://resources.wolframcloud.com/FunctionRepository/resources/",
1319+
"paclet:ref/resource-function/" :> "https://resources.wolframcloud.com/FunctionRepository/resources/",
1320+
StartOfLine ~~ "/functions." -> "/",
13191321
$longNameCharacters
13201322
};
13211323

Source/Chatbook/Serialization.wl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1682,7 +1682,7 @@ boxToString[ TemplateBox[ KeyValuePattern[ "shortenedBoxes" -> boxes_ ], "Output
16821682
boxToString @ boxes;
16831683

16841684
boxToString[ TemplateBox[ { size_ }, "OutputSizeLimit`Skeleton", ___ ] ] :=
1685-
" \[LeftSkeleton]" <> boxToString @ size <> "\[RightSkeleton] ";
1685+
" <<" <> boxToString @ size <> ">> ";
16861686

16871687
(* Row *)
16881688
boxToString[ TemplateBox[ args_, "RowDefault", ___ ] ] := boxToString @ args;

0 commit comments

Comments
 (0)