Skip to content

Commit dc741da

Browse files
authored
Merge pull request #1549 from mito-ds/bugfix/gh-1544-no-code-no-cell
Agent: No code, no cells
2 parents 5ee8aa2 + 880bbdb commit dc741da

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

mito-ai/src/Extensions/AiChat/ChatTaskpane.tsx

+10-4
Original file line numberDiff line numberDiff line change
@@ -587,11 +587,17 @@ const ChatTaskpane: React.FC<IChatTaskpaneProps> = ({
587587
break;
588588
}
589589

590-
// Insert a new cell for the next step
591-
await app.commands.execute("notebook:insert-cell-below")
590+
// Only create a new cell if the AI generated code in its response
591+
if (aiMessage?.message) {
592+
const aiGeneratedCode = getCodeBlockFromMessage(aiMessage.message);
593+
if (aiGeneratedCode) {
594+
// Insert a new cell for the next step
595+
await app.commands.execute("notebook:insert-cell-below")
592596

593-
// Wait for the new cell to be created
594-
await sleep(1000)
597+
// Wait for the new cell to be created
598+
await sleep(1000)
599+
}
600+
}
595601
}
596602

597603
setAgentExecutionStatus('idle')

0 commit comments

Comments
 (0)