File tree 2 files changed +10
-4
lines changed
gui/src/components/StyledMarkdownPreview
2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ export interface StepContainerPreToolbarProps {
52
52
codeBlockContent : string ;
53
53
language : string | null ;
54
54
relativeFilepath ?: string ;
55
- isGeneratingCodeBlock : boolean ;
55
+ isFinalCodeblock : boolean ;
56
56
codeBlockIndex : number ; // To track which codeblock we are applying
57
57
codeBlockStreamId : string ;
58
58
range ?: string ;
@@ -65,7 +65,7 @@ export function StepContainerPreToolbar({
65
65
codeBlockContent,
66
66
language,
67
67
relativeFilepath,
68
- isGeneratingCodeBlock ,
68
+ isFinalCodeblock ,
69
69
codeBlockIndex,
70
70
codeBlockStreamId,
71
71
range,
@@ -115,6 +115,9 @@ export function StepContainerPreToolbar({
115
115
const hasFileExtension =
116
116
relativeFilepath && / \. [ 0 - 9 a - z ] + $ / i. test ( relativeFilepath ) ;
117
117
118
+ const isStreaming = useAppSelector ( ( store ) => store . session . isStreaming ) ;
119
+ const isGeneratingCodeBlock = isFinalCodeblock && isStreaming ;
120
+
118
121
// If we are creating a file, we already render that in the button
119
122
// so we don't want to dispaly it twice here
120
123
const displayFilepath = relativeFilepath ?? appliedFileUri ;
Original file line number Diff line number Diff line change @@ -310,6 +310,9 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview(
310
310
311
311
const language = getLanguageFromClassName ( className ) ;
312
312
313
+ const isFinalCodeblock =
314
+ preChildProps [ "data-islastcodeblock" ] && isLastItemRef . current ;
315
+
313
316
const isGeneratingCodeBlock =
314
317
preChildProps [ "data-islastcodeblock" ] &&
315
318
isLastItemRef . current &&
@@ -331,7 +334,7 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview(
331
334
codeBlockIndex = { codeBlockIndex }
332
335
language = { language }
333
336
relativeFilepath = { relativeFilePath }
334
- isGeneratingCodeBlock = { isGeneratingCodeBlock }
337
+ isFinalCodeblock = { isFinalCodeblock }
335
338
range = { range }
336
339
codeBlockStreamId = {
337
340
codeblockState . current [ codeBlockIndex ] . streamId
@@ -381,7 +384,7 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview(
381
384
const codeWrapState = uiConfig ?. codeWrap ? "pre-wrap" : "pre" ;
382
385
return (
383
386
< StyledMarkdown
384
- contentEditable = ' false'
387
+ contentEditable = " false"
385
388
fontSize = { getFontSize ( ) }
386
389
whiteSpace = { codeWrapState }
387
390
bgColor = { props . useParentBackgroundColor ? "" : vscBackground }
You can’t perform that action at this time.
0 commit comments