@@ -62,6 +62,8 @@ export type MxModel = {
6262 }
6363}
6464
65+ const useAppStore = getApp ( ) . useStore ( )
66+
6567const controller = getApp ( ) . actionController
6668export const getActionTaskLiteLabels = ( action : string ) => {
6769 const extraMapping : { [ key : string ] : string } = {
@@ -97,13 +99,21 @@ export const processModelToUIText = (text: string, origin: string, embedConfigs:
9799 . replace ( / \] \] / g, '`]' )
98100 }
99101 if ( text . includes ( "card_id:" ) && ( origin != '' ) ) {
102+ const cards = useAppStore ( ( state ) => state . toolContext ?. dbInfo ?. cards ) || [ ] ;
100103 //Replace [card_id:<id>] with link
101104 // Replace [card_id:<id>] with markdown link using embed URL logic
102105 text = text . replace ( / \[ c a r d _ i d : ( \d + ) \] / g, ( match , id ) => {
103106 const isEmbedded = getParsedIframeInfo ( ) . isEmbedded as unknown === 'true' ;
104107 const embedHost = embedConfigs . embed_host ;
105108
106109 let questionUrl ;
110+ let cardText ;
111+ const selectedCardName = cards . find ( card => card . id === parseInt ( id ) ) ?. name || '' ;
112+ if ( selectedCardName ) {
113+ cardText = `Card ID ${ id } : ${ selectedCardName . slice ( 0 , 15 ) } ${ selectedCardName . length > 15 ? '... ' : ' ' } ` ;
114+ } else {
115+ cardText = `Card ID: ${ id } ` ;
116+ }
107117 if ( embedHost && isEmbedded ) {
108118 // Use embed host for embedded mode
109119 questionUrl = `${ embedHost } /question/${ id } ` ;
@@ -112,7 +122,7 @@ export const processModelToUIText = (text: string, origin: string, embedConfigs:
112122 questionUrl = `${ origin } /question/${ id } ` ;
113123 }
114124
115- return `[Card ID: ${ id } ](${ questionUrl } )` ;
125+ return `[${ cardText } ](${ questionUrl } )` ;
116126 } ) ;
117127 }
118128 if ( text . includes ( "<OUTPUT>" ) ) {
0 commit comments