Skip to content

Commit b0a3f25

Browse files
committed
fix #7712 -- Shift-Enter when generating a cell is used twice
Also fixed some very minor style issues with the dialog. For example, it is disconcerting to have everything styled as an ERROR just because it is empty -- that's not standard behavior for a form and just confuses users.
1 parent 4a988bb commit b0a3f25

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/packages/frontend/jupyter/insert-cell/ai-cell-generator.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -513,14 +513,14 @@ export function AIGenerateCodeCell({
513513
<Text strong>Please wait until it is fully generated...</Text>
514514
) : (
515515
<Text strong>
516-
Cells are generated. You can now{" "}
516+
You can now{" "}
517517
<Button
518518
size="small"
519519
onClick={insert}
520520
type="primary"
521521
disabled={querying}
522522
>
523-
insert the {cellStr}
523+
<Icon name="plus" /> insert the {cellStr}
524524
</Button>
525525
.
526526
</Text>
@@ -555,7 +555,7 @@ export function AIGenerateCodeCell({
555555
</Flex>
556556
<Flex flex={1}>
557557
<Text type="secondary">
558-
Add a cell attributing the language model and the prompt.
558+
Include cell describing the language model and prompt.
559559
</Text>
560560
</Flex>
561561
</Flex>
@@ -570,7 +570,7 @@ export function AIGenerateCodeCell({
570570
setQuerying(false);
571571
}}
572572
>
573-
<Icon name="arrow-left" /> Discard
573+
Cancel
574574
</Button>
575575
<Button
576576
size="large"
@@ -626,22 +626,23 @@ export function AIGenerateCodeCell({
626626
const empty = prompt.trim() == "";
627627
return (
628628
<>
629-
<Paragraph type={empty ? "danger" : undefined}>
630-
Describe, what the new cell should do:
629+
<Paragraph>
630+
What do you want the new cell to do?
631631
</Paragraph>
632632
<Paragraph>
633633
<Input.TextArea
634634
ref={promptRef}
635635
allowClear
636636
autoFocus
637637
value={prompt}
638-
status={empty ? "error" : undefined}
639638
onChange={(e) => {
640639
setPrompt(e.target.value);
641640
}}
642641
placeholder="Describe the new cell..."
643642
onPressEnter={(e) => {
644643
if (!e.shiftKey) return;
644+
e.preventDefault(); // prevent the default action
645+
e.stopPropagation(); // stop event propagation
645646
doQuery(prevCodeContents);
646647
}}
647648
autoSize={{ minRows: 2, maxRows: 6 }}

0 commit comments

Comments
 (0)