@@ -21,21 +21,29 @@ export type MessageEntryProps = {
2121 message : MessageType < LightSpeedCoreAdditionalProperties > ;
2222 avatar : string ;
2323 onApiCall : typeof fetch ;
24+ conversationId : string | undefined ;
2425} ;
2526
26- const MessageEntry = ( { message, avatar, openClusterDetails, onApiCall } : MessageEntryProps ) => {
27+ const MessageEntry = ( {
28+ message,
29+ avatar,
30+ openClusterDetails,
31+ onApiCall,
32+ conversationId,
33+ } : MessageEntryProps ) => {
2734 const [ openFeedback , setOpenFeedback ] = React . useState ( false ) ;
35+
2836 const onFeedbackSubmit = React . useCallback (
2937 async ( req : FeedbackRequest ) : Promise < void > => {
3038 const resp = await onApiCall ( '/v1/feedback' , {
3139 method : 'POST' ,
3240 body : JSON . stringify ( {
33- conversation_id : message . additionalAttributes ?. conversationId ,
34- user_question : 'TODO ' ,
41+ conversation_id : conversationId ,
42+ user_question : '' ,
3543 user_feedback : req . userFeedback ,
3644 llm_response : message . answer ,
3745 sentiment : req . sentiment ,
38- category : req . category ,
46+ categories : req . category ? [ req . category ] : undefined ,
3947 } ) ,
4048 headers : {
4149 'Content-Type' : 'application/json' ,
@@ -45,7 +53,7 @@ const MessageEntry = ({ message, avatar, openClusterDetails, onApiCall }: Messag
4553 throw new Error ( `${ resp . status } ${ resp . statusText } ` ) ;
4654 }
4755 } ,
48- [ onApiCall , message ] ,
56+ [ onApiCall , message , conversationId ] ,
4957 ) ;
5058
5159 const messageDate = `${ message . date ?. toLocaleDateString ( ) } ${ message . date ?. toLocaleTimeString ( ) } ` ;
0 commit comments