@@ -37,11 +37,11 @@ import {
37
37
IconName ,
38
38
LLMNameLink ,
39
39
Paragraph ,
40
- RawPrompt ,
41
40
Text ,
42
41
Title ,
43
42
VisibleMDLG ,
44
43
} from "@cocalc/frontend/components" ;
44
+ import StaticMarkdown from "@cocalc/frontend/editors/slate/static-markdown" ;
45
45
import AIAvatar from "@cocalc/frontend/components/ai-avatar" ;
46
46
import { labels } from "@cocalc/frontend/i18n" ;
47
47
import { LLMCostEstimation } from "@cocalc/frontend/misc/llm-cost-estimation" ;
@@ -337,7 +337,9 @@ export default function LanguageModelTitleBarButton({
337
337
const doIt = async ( ) => {
338
338
setShowPreview ( false ) ;
339
339
const options = getQueryLLMOptions ( ) ;
340
- if ( options == null ) return ;
340
+ if ( options == null ) {
341
+ return ;
342
+ }
341
343
await queryLLM ( options ) ;
342
344
setShowDialog ( false ) ;
343
345
setError ( "" ) ;
@@ -410,7 +412,9 @@ export default function LanguageModelTitleBarButton({
410
412
icon : < Icon name = { icon } /> ,
411
413
label : (
412
414
< >
413
- < Text strong > { label } :</ Text > { " " }
415
+ < Text strong style = { { marginRight : "5px" } } >
416
+ { label } :
417
+ </ Text > { " " }
414
418
< Text type = "secondary" > { description } </ Text >
415
419
</ >
416
420
) ,
@@ -442,7 +446,9 @@ export default function LanguageModelTitleBarButton({
442
446
}
443
447
444
448
function renderShowOptions ( ) {
445
- if ( ! showOptions ) return ;
449
+ if ( ! showOptions || path . endsWith ( ".sage-chat" ) ) {
450
+ return ;
451
+ }
446
452
447
453
return (
448
454
< Paragraph
@@ -504,6 +510,14 @@ export default function LanguageModelTitleBarButton({
504
510
return (
505
511
< Paragraph style = { { textAlign : "center" } } ref = { submitRef } >
506
512
< Space size = "middle" >
513
+ < Button
514
+ size = "large"
515
+ onClick = { ( ) => {
516
+ setShowDialog ( false ) ;
517
+ } }
518
+ >
519
+ Cancel
520
+ </ Button >
507
521
< Popover
508
522
trigger = { [ "click" ] }
509
523
title = {
@@ -517,7 +531,7 @@ export default function LanguageModelTitleBarButton({
517
531
>
518
532
< Icon name = "times" />
519
533
</ Button >
520
- Exactly this will be sent to the language model.
534
+ This will be sent to the language model
521
535
</ div >
522
536
}
523
537
open = { showPreview && visible && showDialog }
@@ -528,8 +542,8 @@ export default function LanguageModelTitleBarButton({
528
542
} }
529
543
content = { ( ) => (
530
544
< Space direction = "vertical" style = { { maxWidth : "50vw" } } >
531
- < RawPrompt
532
- input = { message }
545
+ < StaticMarkdown
546
+ value = { message }
533
547
style = { {
534
548
maxHeight : "30vh" ,
535
549
overflow : "auto" ,
@@ -598,10 +612,12 @@ export default function LanguageModelTitleBarButton({
598
612
</ Paragraph >
599
613
{ renderOptions ( ) }
600
614
{ renderShowOptions ( ) }
601
- < Paragraph type = "secondary" >
602
- { description } The output will appear in side-chat, so your file isn't
603
- directly modified.
604
- </ Paragraph >
615
+ { ! path . endsWith ( ".sage-chat" ) && (
616
+ < Paragraph type = "secondary" >
617
+ { description } The output will appear in the side chat, so your file
618
+ isn't directly modified.
619
+ </ Paragraph >
620
+ ) }
605
621
{ renderSubmit ( ) }
606
622
{ error ? (
607
623
< Alert type = "error" message = { error } />
@@ -614,6 +630,9 @@ export default function LanguageModelTitleBarButton({
614
630
615
631
return (
616
632
< Popover
633
+ placement = {
634
+ "right" /* Otherwise this thing gets stuck on the left side of the screen, which is very disconcerting*/
635
+ }
617
636
title = { renderTitle ( ) }
618
637
open = { visible && showDialog }
619
638
content = { renderContent }
0 commit comments