File tree Expand file tree Collapse file tree 2 files changed +25
-7
lines changed
codewhispererChat/controllers/chat Expand file tree Collapse file tree 2 files changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ export class TabBarController {
9090 selectedTab . conversations . flatMap ( ( conv : Conversation ) =>
9191 conv . messages
9292 . filter ( ( message ) => message . shouldDisplayMessage !== false )
93- . map ( ( message ) => messageToChatItem ( message ) )
93+ . flatMap ( ( message ) => messageToChatItem ( message ) )
9494 ) ,
9595 exportTab
9696 )
Original file line number Diff line number Diff line change @@ -84,13 +84,31 @@ export function messageToChatMessage(msg: Message): ChatMessage {
8484/**
8585 * Converts Message to MynahUI Chat Item
8686 */
87- export function messageToChatItem ( msg : Message ) : ChatItem {
88- return {
89- body : msg . body ,
90- type : msg . type as ChatItemType ,
91- codeReference : msg . codeReference ,
92- relatedContent : msg . relatedContent && msg . relatedContent ?. content . length > 0 ? msg . relatedContent : undefined ,
87+ export function messageToChatItem ( msg : Message ) : ChatItem [ ] {
88+ const chatItems : ChatItem [ ] = [
89+ {
90+ body : msg . body ,
91+ type : msg . type as ChatItemType ,
92+ codeReference : msg . codeReference ,
93+ relatedContent :
94+ msg . relatedContent && msg . relatedContent ?. content . length > 0 ? msg . relatedContent : undefined ,
95+ } ,
96+ ]
97+ // Check if there are any toolUses with explanations that should be displayed as directive messages
98+ if ( msg . toolUses && msg . toolUses . length > 0 ) {
99+ for ( const toolUse of msg . toolUses ) {
100+ if ( toolUse . input && typeof toolUse . input === 'object' ) {
101+ const input = toolUse . input as any
102+ if ( input . explanation ) {
103+ chatItems . push ( {
104+ body : input . explanation ,
105+ type : 'directive' as ChatItemType ,
106+ } )
107+ }
108+ }
109+ }
93110 }
111+ return chatItems
94112}
95113
96114/**
You can’t perform that action at this time.
0 commit comments