@@ -37,11 +37,11 @@ import {
3737 IconName ,
3838 LLMNameLink ,
3939 Paragraph ,
40- RawPrompt ,
4140 Text ,
4241 Title ,
4342 VisibleMDLG ,
4443} from "@cocalc/frontend/components" ;
44+ import StaticMarkdown from "@cocalc/frontend/editors/slate/static-markdown" ;
4545import AIAvatar from "@cocalc/frontend/components/ai-avatar" ;
4646import { labels } from "@cocalc/frontend/i18n" ;
4747import { LLMCostEstimation } from "@cocalc/frontend/misc/llm-cost-estimation" ;
@@ -337,7 +337,9 @@ export default function LanguageModelTitleBarButton({
337337 const doIt = async ( ) => {
338338 setShowPreview ( false ) ;
339339 const options = getQueryLLMOptions ( ) ;
340- if ( options == null ) return ;
340+ if ( options == null ) {
341+ return ;
342+ }
341343 await queryLLM ( options ) ;
342344 setShowDialog ( false ) ;
343345 setError ( "" ) ;
@@ -410,7 +412,9 @@ export default function LanguageModelTitleBarButton({
410412 icon : < Icon name = { icon } /> ,
411413 label : (
412414 < >
413- < Text strong > { label } :</ Text > { " " }
415+ < Text strong style = { { marginRight : "5px" } } >
416+ { label } :
417+ </ Text > { " " }
414418 < Text type = "secondary" > { description } </ Text >
415419 </ >
416420 ) ,
@@ -442,7 +446,9 @@ export default function LanguageModelTitleBarButton({
442446 }
443447
444448 function renderShowOptions ( ) {
445- if ( ! showOptions ) return ;
449+ if ( ! showOptions || path . endsWith ( ".sage-chat" ) ) {
450+ return ;
451+ }
446452
447453 return (
448454 < Paragraph
@@ -504,6 +510,14 @@ export default function LanguageModelTitleBarButton({
504510 return (
505511 < Paragraph style = { { textAlign : "center" } } ref = { submitRef } >
506512 < Space size = "middle" >
513+ < Button
514+ size = "large"
515+ onClick = { ( ) => {
516+ setShowDialog ( false ) ;
517+ } }
518+ >
519+ Cancel
520+ </ Button >
507521 < Popover
508522 trigger = { [ "click" ] }
509523 title = {
@@ -517,7 +531,7 @@ export default function LanguageModelTitleBarButton({
517531 >
518532 < Icon name = "times" />
519533 </ Button >
520- Exactly this will be sent to the language model.
534+ This will be sent to the language model
521535 </ div >
522536 }
523537 open = { showPreview && visible && showDialog }
@@ -528,8 +542,8 @@ export default function LanguageModelTitleBarButton({
528542 } }
529543 content = { ( ) => (
530544 < Space direction = "vertical" style = { { maxWidth : "50vw" } } >
531- < RawPrompt
532- input = { message }
545+ < StaticMarkdown
546+ value = { message }
533547 style = { {
534548 maxHeight : "30vh" ,
535549 overflow : "auto" ,
@@ -598,10 +612,12 @@ export default function LanguageModelTitleBarButton({
598612 </ Paragraph >
599613 { renderOptions ( ) }
600614 { 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+ ) }
605621 { renderSubmit ( ) }
606622 { error ? (
607623 < Alert type = "error" message = { error } />
@@ -614,6 +630,9 @@ export default function LanguageModelTitleBarButton({
614630
615631 return (
616632 < Popover
633+ placement = {
634+ "right" /* Otherwise this thing gets stuck on the left side of the screen, which is very disconcerting*/
635+ }
617636 title = { renderTitle ( ) }
618637 open = { visible && showDialog }
619638 content = { renderContent }
0 commit comments