Skip to content

Commit

Permalink
Merge pull request #936 from WolframResearch/bugfix/better-streaming-…
Browse files Browse the repository at this point in the history
…formatting

Better formatting of streaming output
  • Loading branch information
rhennigan authored Nov 19, 2024
2 parents 57f7f4a + 124bdd3 commit 8ff094e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 84 deletions.
30 changes: 2 additions & 28 deletions Developer/Resources/Styles.wl
Original file line number Diff line number Diff line change
Expand Up @@ -546,32 +546,6 @@ Cell[



(* ::Subsection::Closed:: *)
(*ChatCode*)


(*
14.2 CoreExtensions: most important parts of Input are defined in Core.nb. Only the CellEpliog is missing for chat functionality.
There is no impact on 14.1 chatbooks because Input already adds CellEpilog, so duplicating it here has no effect. *)
Cell[
StyleData[ "ChatCode", StyleDefinitions -> StyleData[ "Input" ] ],
Background -> GrayLevel[ 1 ],
FontSize -> 14,
FontWeight -> "Plain",
LanguageCategory -> "Input",
ShowAutoStyles -> True,
ShowStringCharacters -> True,
ShowSyntaxStyles -> True,

CellEpilog :> With[ { Wolfram`ChatNB`cell = (FinishDynamic[]; EvaluationCell[]) },
Quiet[ Needs[ "Wolfram`Chatbook`" -> None ] ];
Symbol[ "Wolfram`Chatbook`ChatbookAction" ][ "AIAutoAssist", Wolfram`ChatNB`cell ]
]

]



(* ::Subsection::Closed:: *)
(*ChatPreformatted*)

Expand Down Expand Up @@ -604,9 +578,9 @@ Cell[


Cell[
StyleData[ "ChatCodeActive", StyleDefinitions -> StyleData[ "ChatCode" ] ],
StyleData[ "ChatCodeActive", StyleDefinitions -> StyleData[ "Input" ] ],
CodeAssistOptions -> { "AutoDetectHyperlinks" -> False },
LanguageCategory -> None,
FontSize -> 13,
ShowAutoStyles -> False
]

Expand Down
27 changes: 3 additions & 24 deletions FrontEnd/Assets/Extensions/CoreExtensions.nb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Notebook[
Cell["Chatbook Core.nb Extensions", "Title"],
Cell[
StyleData["ChatStyleSheetInformation"],
TaggingRules -> <|"StyleSheetVersion" -> "1.5.2.3940599860"|>
TaggingRules -> <|"StyleSheetVersion" -> "1.5.2.3940955540"|>
],
Cell[
StyleData["NotebookAssistant`Text"],
Expand Down Expand Up @@ -1001,27 +1001,6 @@ Notebook[
Background -> GrayLevel[1]
],
Cell[StyleData["ChatCodeBlockButtonPanel"]],
Cell[
StyleData[
"ChatCode",
StyleDefinitions -> StyleData["Input"]
],
CellEpilog :>
With[ { Wolfram`ChatNB`cell = (FinishDynamic[]; EvaluationCell[]) },
Quiet[Needs["Wolfram`Chatbook`" -> None]];
Symbol["Wolfram`Chatbook`ChatbookAction"][
"AIAutoAssist",
Wolfram`ChatNB`cell
]
],
ShowAutoStyles -> True,
ShowSyntaxStyles -> True,
LanguageCategory -> "Input",
ShowStringCharacters -> True,
FontSize -> 14,
FontWeight -> "Plain",
Background -> GrayLevel[1]
],
Cell[
StyleData["ChatPreformatted"],
CellFrame -> None,
Expand All @@ -1043,11 +1022,11 @@ Notebook[
Cell[
StyleData[
"ChatCodeActive",
StyleDefinitions -> StyleData["ChatCode"]
StyleDefinitions -> StyleData["Input"]
],
ShowAutoStyles -> False,
CodeAssistOptions -> {"AutoDetectHyperlinks" -> False},
LanguageCategory -> None
FontSize -> 13
],
Cell[
StyleData["ChatCodeBlockTemplate"],
Expand Down
27 changes: 3 additions & 24 deletions FrontEnd/StyleSheets/Chatbook.nb
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ Notebook[
],
Cell[
StyleData["ChatStyleSheetInformation"],
TaggingRules -> <|"StyleSheetVersion" -> "1.5.2.3940939112"|>
TaggingRules -> <|"StyleSheetVersion" -> "1.5.2.3940955540"|>
],
Cell[
StyleData["NotebookAssistant`Text"],
Expand Down Expand Up @@ -1840,27 +1840,6 @@ Notebook[
Background -> GrayLevel[1]
],
Cell[StyleData["ChatCodeBlockButtonPanel"]],
Cell[
StyleData[
"ChatCode",
StyleDefinitions -> StyleData["Input"]
],
CellEpilog :>
With[ { Wolfram`ChatNB`cell = (FinishDynamic[]; EvaluationCell[]) },
Quiet[Needs["Wolfram`Chatbook`" -> None]];
Symbol["Wolfram`Chatbook`ChatbookAction"][
"AIAutoAssist",
Wolfram`ChatNB`cell
]
],
ShowAutoStyles -> True,
ShowSyntaxStyles -> True,
LanguageCategory -> "Input",
ShowStringCharacters -> True,
FontSize -> 14,
FontWeight -> "Plain",
Background -> GrayLevel[1]
],
Cell[
StyleData["ChatPreformatted"],
CellFrame -> None,
Expand All @@ -1882,11 +1861,11 @@ Notebook[
Cell[
StyleData[
"ChatCodeActive",
StyleDefinitions -> StyleData["ChatCode"]
StyleDefinitions -> StyleData["Input"]
],
ShowAutoStyles -> False,
CodeAssistOptions -> {"AutoDetectHyperlinks" -> False},
LanguageCategory -> None
FontSize -> 13
],
Cell[
StyleData["ChatCodeBlockTemplate"],
Expand Down
2 changes: 1 addition & 1 deletion FrontEnd/StyleSheets/Wolfram/WorkspaceChat.nb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Notebook[
Cell[StyleData["CellExpression"], Selectable -> True],
Cell[
StyleData["WorkspaceChatStyleSheetInformation"],
TaggingRules -> <|"WorkspaceChatStyleSheetVersion" -> "1.5.2.3940930109"|>
TaggingRules -> <|"WorkspaceChatStyleSheetVersion" -> "1.5.2.3940955540"|>
],
Cell[
StyleData[
Expand Down
8 changes: 1 addition & 7 deletions Source/Chatbook/SendChat.wl
Original file line number Diff line number Diff line change
Expand Up @@ -964,13 +964,7 @@ splitDynamicContent[ container_, { static__String, dynamic_String }, cell_, uuid
write,
None,
AutoScroll -> False
];
splitDynamicTaskFunction @ NotebookWrite[
System`NotebookLocationSpecifier[ boxObject, "Before" ],
Cell[ "\n", "None" ],
None,
AutoScroll -> False
];
]
];

$dynamicTrigger++;
Expand Down

0 comments on commit 8ff094e

Please sign in to comment.