Skip to content

Commit dfe2760

Browse files
committed
fix #8553 -- generate using AI link got broken.
- this code is so confusing and I don't even understand how my fix works
1 parent 208a7f4 commit dfe2760

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

src/packages/frontend/jupyter/codemirror-editor.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,9 @@ export const CodeMirrorEditor: React.FC<CodeMirrorEditorProps> = ({
828828
opacity: 0.5,
829829
fontSize: "inherit",
830830
}}
831-
onClick={() => setShowAICellGen("replace")}
831+
onClick={() => {
832+
setShowAICellGen("replace");
833+
}}
832834
>
833835
generate using AI...
834836
</a>

src/packages/frontend/jupyter/insert-cell/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ export function InsertCell({
9898
classNames.push("cocalc-jupyter-insert-cell-below");
9999
}
100100

101-
const isActiveAIGenerator = !hide && showAICellGen === position;
101+
const isActiveAIGenerator =
102+
!hide &&
103+
(showAICellGen === position ||
104+
(position === "below" && showAICellGen === "replace"));
102105

103106
function renderControls() {
104107
return (

src/packages/frontend/jupyter/llm/cell-context-selector.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ export function LLMCellContextSelector({
143143
<Flex flex={0}>
144144
<Switch
145145
checked={cellTypes === "all"}
146-
onChange={(val) => onCellTypesChange(val ? "all" : "code")}
146+
onChange={(checked) => {
147+
onCellTypesChange(checked ? "all" : "code");
148+
}}
147149
unCheckedChildren="Code cells"
148150
checkedChildren="All Cells"
149151
/>

src/packages/frontend/jupyter/llm/cell-tool.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,8 +672,8 @@ export function LLMCellTool({ actions, id, style, llmTools, cellType }: Props) {
672672
mode === "translate_text"
673673
? getLanguageName(targetTextLanguage)
674674
: targetLanguage === OTHER_LANG
675-
? otherLanguage
676-
: targetLanguage,
675+
? otherLanguage
676+
: targetLanguage,
677677
stepByStep,
678678
});
679679

0 commit comments

Comments
 (0)