@@ -16,6 +16,7 @@ import {
16
16
Zap ,
17
17
Split ,
18
18
MoreHorizontal ,
19
+ Braces ,
19
20
} from 'lucide-solid'
20
21
import {
21
22
Accessor ,
@@ -548,10 +549,6 @@ const MessageOptions: Component<{
548
549
onRemove : ( ) => void
549
550
showMore : Signal < boolean >
550
551
} > = ( props ) => {
551
- const showInner = createMemo ( ( ) =>
552
- Object . values ( props . ui . msgOptsInline || { } ) . some ( ( v ) => ! v ?. outer )
553
- )
554
-
555
552
const closer = ( action : ( ) => void ) => {
556
553
return ( ) => {
557
554
action ( )
@@ -617,6 +614,20 @@ const MessageOptions: Component<{
617
614
icon : RefreshCw ,
618
615
} ,
619
616
617
+ 'schema-regen' : {
618
+ key : 'schema-regen' ,
619
+ class : 'refresh-btn' ,
620
+ label : 'Schema Regen' ,
621
+ outer : props . ui . msgOptsInline [ 'schema-regen' ] ,
622
+ show :
623
+ window . flags . reschema &&
624
+ ( ( props . msg . json && props . last ) ||
625
+ ( props . msg . adapter === 'image' && ! ! props . msg . imagePrompt ) ) &&
626
+ ! ! props . msg . characterId ,
627
+ onClick : ( ) => ! props . partial && retryJsonSchema ( props . msg , props . msg ) ,
628
+ icon : Braces ,
629
+ } ,
630
+
620
631
trash : {
621
632
key : 'trash' ,
622
633
label : 'Delete' ,
@@ -632,6 +643,14 @@ const MessageOptions: Component<{
632
643
return items
633
644
} )
634
645
646
+ const showInner = createMemo ( ( ) => {
647
+ for ( const opt of Object . values ( logic ( ) ) ) {
648
+ if ( ! opt . outer && opt . show ) return true
649
+ }
650
+
651
+ return false
652
+ } )
653
+
635
654
const order = createMemo ( ( ) => {
636
655
open ( )
637
656
logic ( )
@@ -736,7 +755,7 @@ const MessageOption: Component<{
736
755
737
756
< Show when = { ! props . outer } >
738
757
< Button
739
- class = { `${ props . class || '' } w-full` }
758
+ class = { `${ props . class || '' } w-full min-w-max ` }
740
759
schema = { props . schema || 'secondary' }
741
760
onClick = { props . onClick }
742
761
size = "sm"
@@ -758,6 +777,10 @@ function retryMessage(original: AppSchema.ChatMessage, split: SplitMessage) {
758
777
}
759
778
}
760
779
780
+ function retryJsonSchema ( original : AppSchema . ChatMessage , split : SplitMessage ) {
781
+ msgStore . retrySchema ( split . chatId , original . _id )
782
+ }
783
+
761
784
function renderMessage ( ctx : ContextState , text : string , isUser : boolean , adapter ?: string ) {
762
785
// Address unfortunate Showdown bug where spaces in code blocks are replaced with nbsp, except
763
786
// it also encodes the ampersand, which results in them actually being rendered as `&nbsp;`
0 commit comments