@@ -75,7 +75,7 @@ makeSidebarChatDockedCell[ ] := With[ { nbo = EvaluationNotebook[ ], sidebarCell
7575 Item [ Spacer [ 0 ], ItemSize -> Fit ],
7676 LogChatTiming @ sidebarSourcesButton [ Dynamic @ nbo , Dynamic @ sidebarCell ],
7777 LogChatTiming @ sidebarHistoryButton [ Dynamic @ nbo , Dynamic @ sidebarCell ],
78- LogChatTiming @ sidebarOpenAsChatbookButton [ Dynamic @ nbo , Dynamic @ sidebarCell ],
78+ LogChatTiming @ sidebarOpenAsAssistantWindowButton [ Dynamic @ nbo , Dynamic @ sidebarCell ],
7979 sidebarHideButton [ Dynamic @ nbo ]
8080 } },
8181 Alignment -> { Automatic , Center },
@@ -305,28 +305,50 @@ sidebarNewChatButton // endDefinition;
305305
306306(* ::**************************************************************************************************************:: *)
307307(* ::Subsubsection::Closed:: *)
308- (*sidebarOpenAsChatbookButton*)
309- sidebarOpenAsChatbookButton // beginDefinition ;
310-
311- sidebarOpenAsChatbookButton [ Dynamic [ nbo_ ], Dynamic [ sidebarCell_ ] ] := Button [
312- Block [ { $AppType = "SidebarChat" }, toolbarButtonLabel [ "OpenAsChatbook" , None ] ],
313- NotebookPut @ cellsToChatNB [
314- ReplaceRepeated [
315- NotebookRead @ Cells [ First [ Cells [ sidebarCell , CellTags -> "SidebarScrollingContentCell" ], {} ], CellTags -> "SidebarTopCell" ], (* fail gracefully *)
316- (* so far there's only one TemplateBox that needs to be unconverted *)
317- TemplateBox [ a_ , b : Alternatives [ "NotebookAssistant`Sidebar`ChatCodeBlockTemplate" ], c___ ] :>
318- RuleCondition [ TemplateBox [ a , StringReplace [ b , StartOfString ~~ "NotebookAssistant`Sidebar`" -> "" , c ] ], True ]
319- ],
320- CurrentValue [ sidebarCell , { TaggingRules , "ChatNotebookSettings" } ] ],
308+ (*sidebarOpenAsAssistantWindowButton*)
309+ sidebarOpenAsAssistantWindowButton // beginDefinition ;
310+
311+ sidebarOpenAsAssistantWindowButton [ Dynamic [ nbo_ ], Dynamic [ sidebarCell_ ] ] := Button [
312+ Block [ { $AppType = "SidebarChat" }, toolbarButtonLabel [ "OpenAsChatbook" , None , "OpenAsWindowedAssistant" , False ] ],
313+ With [
314+ {
315+ newNB = ShowNotebookAssistance [ nbo , "Window" ,
316+ "ChatNotebookSettings" -> KeyDrop [ CurrentValue [ sidebarCell , { TaggingRules , "ChatNotebookSettings" } ], "SidebarChat" ] ]
317+ },
318+ If [ MatchQ [ newNB , _ NotebookObject ],
319+ SelectionMove [ newNB , Before , Notebook ];
320+ NotebookWrite [
321+ newNB ,
322+ ReplaceRepeated [
323+ NotebookRead @ Cells [ First [ Cells [ sidebarCell , CellTags -> "SidebarScrollingContentCell" ], {} ], CellTags -> "SidebarTopCell" ], (* fail gracefully *)
324+ (* so far there's only one TemplateBox that needs to be unconverted *)
325+ {
326+ Cell [ a_ , b___ String , c_ String /; StringStartsQ [ c , "NotebookAssistant`Sidebar`" ], d___ ] :>
327+ RuleCondition [ Cell [ a , b , StringReplace [ c , StartOfString ~~ "NotebookAssistant`Sidebar`" -> "" ], d ], True ],
328+ TemplateBox [ a_ , b_ String /; StringStartsQ [ b , "NotebookAssistant`Sidebar`" ], c___ ] :>
329+ RuleCondition [ TemplateBox [ a , StringReplace [ b , StartOfString ~~ "NotebookAssistant`Sidebar`" -> "" ], c ], True ]
330+ }
331+ ] ];
332+ attachWorkspaceChatInput @ newNB ;
333+
334+ (* remove sidebar and its content *)
335+ NotebookDelete @ Cells [ nbo , CellStyle -> "AttachedOverlayMenu" , AttachedCell -> True ];
336+ removeSidebarScrollingContentCell [ nbo , sidebarCell ];
337+ removeSidebarChatSubDockedCell [ nbo , sidebarCell ];
338+ CurrentChatSettings [ sidebarCell , "ConversationUUID" ] = CreateUUID [ ];
339+ CurrentValue [ sidebarCell , { TaggingRules , "ConversationTitle" } ] = "" ;
340+ FrontEndTokenExecute [ nbo , "HideSidebar" ];
341+ ]
342+ ],
321343 Appearance -> "Suppressed" ,
322344 Method -> "Queued"
323345];
324346
325- sidebarOpenAsChatbookButton // endDefinition ;
347+ sidebarOpenAsAssistantWindowButton // endDefinition ;
326348
327349(* ::**************************************************************************************************************:: *)
328350(* ::Subsubsection::Closed:: *)
329- (*sidebarOpenAsChatbookButton *)
351+ (*sidebarOpenAsAssistantWindowButton *)
330352
331353sidebarHideButton // beginDefinition ;
332354
@@ -594,7 +616,7 @@ $toolbarButtonLight = Sequence[ Background -> color @ "NA_ToolbarLightButtonBa
594616(*buttonTooltip*)
595617buttonTooltip // beginDefinition ;
596618buttonTooltip [ label_ , None ] := label ;
597- buttonTooltip [ label_ , name_ String ] := Tooltip [ label , tr [ "WorkspaceToolbarButtonTooltip" <> name ] ];
619+ buttonTooltip [ label_ , name_ String ] := Tooltip [ label , tr [ If [ $AppType === "SidebarChat" , "Sidebar" , "Workspace" ] <> "ToolbarButtonTooltip" <> name ] ];
598620buttonTooltip // endDefinition ;
599621
600622(* ::**************************************************************************************************************:: *)
@@ -1985,9 +2007,9 @@ attachOverlayMenu[ nbo_NotebookObject, appContainer:None, name_String ] := Enclo
19852007 CellTags -> name ,
19862008 Magnification -> Dynamic @ AbsoluteCurrentValue [ nbo , Magnification ]
19872009 ],
1988- { Center , Top },
2010+ { Left , Top },
19892011 0 ,
1990- { Center , Top }
2012+ { Left , Top }
19912013 ],
19922014 throwInternalFailure
19932015];
@@ -2007,9 +2029,9 @@ attachOverlayMenu[ nbo_NotebookObject, sidebarCell_CellObject, name_String ] :=
20072029 CellTags -> name ,
20082030 Magnification -> Dynamic [ 0.85 * AbsoluteCurrentValue [ nbo , Magnification ] ]
20092031 ],
2010- { Center , Bottom },
2032+ { Left , Bottom },
20112033 0 ,
2012- { Center , Top }
2034+ { Left , Top }
20132035 ]
20142036 ],
20152037 throwInternalFailure
@@ -2022,7 +2044,7 @@ attachedOverlayMenuFrame // beginDefinition;
20222044
20232045attachedOverlayMenuFrame [ nbo_ NotebookObject , appContainer_ , content_ ] := Framed [
20242046 content ,
2025- Alignment -> { Center , Top },
2047+ Alignment -> { Left , Top },
20262048 Background -> color @ "NA_NotebookBackground" ,
20272049 FrameMargins -> { { 5 , 5 }, { 5 , 5 } },
20282050 FrameStyle -> color @ "NA_NotebookBackground" ,
@@ -2448,7 +2470,7 @@ makeDefaultHistoryView[ nbo_NotebookObject, appContainer_, Dynamic[ page_ ], Dyn
24482470
24492471 Pane [
24502472 Dynamic [ display , TrackedSymbols :> { display } ],
2451- Alignment -> { Center , Top },
2473+ Alignment -> { Left , Top },
24522474 AppearanceElements -> { },
24532475 FrameMargins -> { { 0 , 0 }, { 5 , 5 } },
24542476 If [ MatchQ [ appContainer , _ CellObject ],
0 commit comments