Skip to content

Commit

Permalink
Merge pull request #588 from WolframResearch/587-sidechat-cell-dingba…
Browse files Browse the repository at this point in the history
…t-menu-is-not-disabled-in-cloud

Bugfix: Disable SideChat cell dingbat menu in cloud
  • Loading branch information
rhennigan authored Feb 2, 2024
2 parents 4454325 + 13546bc commit 2bb8289
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 49 deletions.
14 changes: 12 additions & 2 deletions Developer/Resources/Styles.wl
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,19 @@ Cell[
StyleKeyMapping -> { "~" -> "ChatDelimiter", "'" -> "ChatSystemInput", "Backspace" -> "ChatInput" },
TaggingRules -> <| "ChatNotebookSettings" -> <| "IncludeHistory" -> False |> |>,
CellDingbat -> Cell[
BoxData @ RowBox @ { ToBoxes @ $chatInputCellDingbat, TemplateBox[ { 12 }, "Spacer1" ] },
BoxData @ RowBox @ {
DynamicBox @ ToBoxes[
If[ TrueQ @ CloudSystem`$CloudNotebooks,
RawBoxes @ TemplateBox[ { }, "ChatIconUser" ],
RawBoxes @ TemplateBox[ { }, "ChatInputActiveCellDingbat" ]
],
StandardForm
],
TemplateBox[ { 12 }, "Spacer1" ]
},
CellFrame -> { { 0, 0 }, { 0, 2 } },
CellFrameMargins -> 5
CellFrameColor -> RGBColor[ "#a3c9f2" ],
CellFrameMargins -> 6
]
]

Expand Down
62 changes: 17 additions & 45 deletions FrontEnd/StyleSheets/Chatbook.nb
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,11 @@ Notebook[
Magnification -> 1,
FontSize -> 0.1
],
PrivateCellOptions -> {
"AccentStyle" -> {
CellTrayWidgets -> <|"ChatIncluded" -> <|"Condition" -> True|>|>
}
},
TaggingRules -> <|"ChatNotebookSettings" -> <||>|>,
CellTrayWidgets -> <|
"GearMenu" -> <|"Condition" -> False|>,
Expand Down Expand Up @@ -1152,16 +1157,11 @@ Notebook[
}
]
}
|>,
PrivateCellOptions -> {
"AccentStyle" -> {
CellTrayWidgets -> <|"ChatIncluded" -> <|"Condition" -> True|>|>
}
}
|>
],
Cell[
StyleData["ChatStyleSheetInformation"],
TaggingRules -> <|"StyleSheetVersion" -> "1.4.2.3915594972"|>
TaggingRules -> <|"StyleSheetVersion" -> "1.4.2.3915874681"|>
],
Cell[
StyleData["Text"],
Expand Down Expand Up @@ -1737,50 +1737,22 @@ Notebook[
BoxData[
RowBox[
{
PaneSelectorBox[
{
True ->
DynamicModuleBox[
{Wolfram`Chatbook`UI`Private`cell$$},
DynamicBox[
ToBoxes[
Catch[
Wolfram`Chatbook`Dynamics`Private`$chatBlockTrigger;
Wolfram`Chatbook`UI`MakeChatInputActiveCellDingbat[
Wolfram`Chatbook`UI`Private`cell$$
],
Blank[]
],
StandardForm
],
TrackedSymbols :> {Wolfram`Chatbook`Dynamics`Private`$chatBlockTrigger}
],
Initialization :>
(Wolfram`Chatbook`UI`Private`cell$$ = EvaluationCell[];
Needs["Wolfram`Chatbook`" -> None]),
DynamicModuleValues :> { },
UnsavedVariables :> {Wolfram`Chatbook`UI`Private`cell$$}
],
False ->
FrameBox[
TemplateBox[{}, "ChatIconUser"],
RoundingRadius -> 3,
FrameMargins -> 2,
ImageMargins -> {{0, 3}, {0, 0}},
FrameStyle -> GrayLevel[0, 0],
FrameMargins -> 0,
StripOnInput -> False
]
},
Dynamic[CurrentValue["MouseOver"]],
ImageSize -> All
DynamicBox[
ToBoxes[
If[ TrueQ[CloudSystem`$CloudNotebooks],
RawBoxes[TemplateBox[{}, "ChatIconUser"]],
RawBoxes[TemplateBox[{}, "ChatInputActiveCellDingbat"]]
],
StandardForm
]
],
TemplateBox[{12}, "Spacer1"]
}
]
],
CellFrame -> {{0, 0}, {0, 2}},
CellFrameMargins -> 5
CellFrameColor -> RGBColor[0.639216, 0.788235, 0.94902],
CellFrameMargins -> 6
],
CellMargins -> {{79, 26}, {Inherited, Inherited}},
CellDingbatMargin -> 0,
Expand Down
10 changes: 8 additions & 2 deletions Source/Chatbook/SendChat.wl
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ sendChat[ evalCell_, nbo_, settings0_ ] /; $useLLMServices := catchTopAs[ Chatbo
If[ ! TrueQ @ $cloudNotebooks && chatInputCellQ @ evalCell,
SetOptions[
evalCell,
CellDingbat -> Cell[ BoxData @ TemplateBox[ { }, "ChatInputCellDingbat" ], Background -> None ]
CellDingbat -> ReplaceAll[
CurrentValue[ evalCell, CellDingbat ],
TemplateBox[ { }, "ChatInputActiveCellDingbat" ] -> TemplateBox[ { }, "ChatInputCellDingbat" ]
]
]
];

Expand Down Expand Up @@ -259,7 +262,10 @@ sendChat[ evalCell_, nbo_, settings0_ ] := catchTopAs[ ChatbookAction ] @ Enclos
If[ ! TrueQ @ $cloudNotebooks && chatInputCellQ @ evalCell,
SetOptions[
evalCell,
CellDingbat -> Cell[ BoxData @ TemplateBox[ { }, "ChatInputCellDingbat" ], Background -> None ]
CellDingbat -> ReplaceAll[
CurrentValue[ evalCell, CellDingbat ],
TemplateBox[ { }, "ChatInputActiveCellDingbat" ] -> TemplateBox[ { }, "ChatInputCellDingbat" ]
]
]
];

Expand Down

0 comments on commit 2bb8289

Please sign in to comment.