@@ -44,7 +44,6 @@ import ModelStatusIndicator from '@/components/Experimental/ModelServeStatus/Mod
4444
4545// TODO: get nextjs app router server side render working with the patternfly chatbot component.
4646const MODEL_SERVER_URL = process . env . NEXT_PUBLIC_MODEL_SERVER_URL ;
47- // const MODEL_SERVER_IP = 'http://128.31.20.81';
4847
4948const ChatModelEval : React . FC = ( ) => {
5049 const [ isUnifiedInput , setIsUnifiedInput ] = useState ( false ) ;
@@ -115,8 +114,8 @@ const ChatModelEval: React.FC = () => {
115114 // Fetch models on component mount
116115 useEffect ( ( ) => {
117116 const fetchDefaultModels = async ( ) => {
118- const response = await fetch ( '/api/envConfig' ) ;
119- const envConfig = await response . json ( ) ;
117+ // const response = await fetch('/api/envConfig');
118+ // const envConfig = await response.json();
120119
121120 const storedEndpoints = localStorage . getItem ( 'endpoints' ) ;
122121 const cust : Model [ ] = storedEndpoints
@@ -210,7 +209,7 @@ const ChatModelEval: React.FC = () => {
210209 } else if ( endpoint . includes ( 'serve-latest' ) ) {
211210 const servedModel : Model = {
212211 name : 'Granite fine tune checkpoint (Serving)' ,
213- apiURL : `${ MODEL_SERVER_URL } :8001` , // endpoint for latest model
212+ apiURL : `${ MODEL_SERVER_URL } :8001` , // endpoint for latest checkpoint
214213 modelName : 'granite-latest-served'
215214 } ;
216215
@@ -334,22 +333,6 @@ const ChatModelEval: React.FC = () => {
334333 setAlertMessageRight ( undefined ) ;
335334 } ;
336335
337- // Common stream update handler
338- const handleStreamUpdate = ( id : string , newContent : string , setMessagesFn : React . Dispatch < React . SetStateAction < MessageProps [ ] > > ) => {
339- setMessagesFn ( ( msgs ) => {
340- if ( ! msgs ) {
341- console . error ( 'msgs is undefined in handleStreamUpdate' ) ;
342- return [ ] ;
343- }
344- const updated = [ ...msgs ] ;
345- const idx = updated . findIndex ( ( m ) => m . id === id ) ;
346- if ( idx !== - 1 ) {
347- updated [ idx ] . content = newContent ;
348- }
349- return updated ;
350- } ) ;
351- } ;
352-
353336 const handleSend = async ( side : 'left' | 'right' , message : string ) => {
354337 const trimmedMessage = message . trim ( ) ;
355338
@@ -393,7 +376,7 @@ const ChatModelEval: React.FC = () => {
393376
394377 if ( side === 'left' ) {
395378 setMessagesLeft ( ( msgs ) => [ ...msgs , userMessage ] ) ;
396- setQuestionLeft ( '' ) ; // Clear the input field
379+ setQuestionLeft ( '' ) ;
397380 } else {
398381 setMessagesRight ( ( msgs ) => [ ...msgs , userMessage ] ) ;
399382 setQuestionRight ( '' ) ;
@@ -640,7 +623,6 @@ const ChatModelEval: React.FC = () => {
640623 if ( shouldSendLeft ) {
641624 handleSend ( 'left' , trimmedMessage ) ;
642625 }
643-
644626 if ( shouldSendRight ) {
645627 handleSend ( 'right' , trimmedMessage ) ;
646628 }
@@ -681,12 +663,13 @@ const ChatModelEval: React.FC = () => {
681663 < div style = { { flex : '1 1 45%' , maxWidth : '45%' , marginBottom : '2rem' } } >
682664 < Chatbot isVisible = { true } className = "chatbot-ui-page" >
683665 < ChatbotHeader className = "pf-chatbot__header" >
684- < ChatbotHeaderMain / >
666+ < ChatbotHeaderMain > { '' } </ ChatbotHeaderMain >
685667 < ChatbotHeaderActions className = "pf-chatbot__header-actions" >
686668 < ModelStatusIndicator modelName = { selectedModelLeft ?. modelName || null } />
687669 { freeGpus < 1 && ! selectedModelLeft && < span style = { { color : 'red' , marginRight : '0.5rem' , padding : '0.5rem' } } > No GPUs free</ span > }
670+ { showModelLoadingLeft && < Spinner size = "sm" /> }
688671 < ChatbotHeaderSelectorDropdown
689- disabled = { freeGpus < 1 && ! selectedModelLeft }
672+ // disabled={( freeGpus < 1 && !selectedModelLeft) || showModelLoadingLeft }
690673 value = { selectedModelLeft ?. name || 'Select a model' }
691674 onSelect = { onSelectModelLeft }
692675 >
@@ -745,12 +728,12 @@ const ChatModelEval: React.FC = () => {
745728 handleSendLeft ( message ) ;
746729 } }
747730 hasAttachButton = { false }
748- onChange = { ( event , val ) => {
731+ onChange = { ( event : React . ChangeEvent < HTMLDivElement > , val : string ) => {
749732 console . debug ( `Left MessageBar onChange: "${ val } "` ) ;
750733 setQuestionLeft ( val ) ;
751734 } }
752- value = { questionLeft }
753- placeholder = "Type your prompt for the left model..."
735+ // value={questionLeft}
736+ // placeholder="Type your prompt for the left model..."
754737 // Disable send button if message is empty or no model is selected
755738 isSendButtonDisabled = { ! questionLeft . trim ( ) || ! selectedModelLeft }
756739 />
@@ -789,12 +772,13 @@ const ChatModelEval: React.FC = () => {
789772 < div style = { { flex : '1 1 45%' , maxWidth : '55%' , marginBottom : '2rem' } } >
790773 < Chatbot isVisible = { true } className = "chatbot-ui-page" >
791774 < ChatbotHeader className = "pf-chatbot__header" >
792- < ChatbotHeaderMain / >
775+ < ChatbotHeaderMain > { '' } </ ChatbotHeaderMain >
793776 < ChatbotHeaderActions className = "pf-chatbot__header-actions" >
794777 < ModelStatusIndicator modelName = { selectedModelRight ?. modelName || null } />
795778 { freeGpus < 1 && ! selectedModelRight && < span style = { { color : 'red' , marginRight : '0.5rem' , padding : '0.5rem' } } > No GPUs free</ span > }
779+ { showModelLoadingRight && < Spinner size = "sm" /> }
796780 < ChatbotHeaderSelectorDropdown
797- disabled = { freeGpus < 1 && ! selectedModelLeft }
781+ // disabled={( freeGpus < 1 && !selectedModelRight) || showModelLoadingRight }
798782 value = { selectedModelRight ?. name || 'Select a model' }
799783 onSelect = { onSelectModelRight }
800784 >
@@ -853,12 +837,12 @@ const ChatModelEval: React.FC = () => {
853837 handleSendRight ( message ) ;
854838 } }
855839 hasAttachButton = { false }
856- onChange = { ( event , val ) => {
840+ onChange = { ( event : React . ChangeEvent < HTMLDivElement > , val : string ) => {
857841 console . debug ( `Right MessageBar onChange: "${ val } "` ) ;
858842 setQuestionRight ( val ) ;
859843 } }
860- value = { questionRight }
861- placeholder = "Type your prompt for the right model..."
844+ // value={questionRight}
845+ // placeholder="Type your prompt for the right model..."
862846 // Disable send button if message is empty or no model is selected
863847 isSendButtonDisabled = { ! questionRight . trim ( ) || ! selectedModelRight }
864848 />
@@ -904,12 +888,12 @@ const ChatModelEval: React.FC = () => {
904888 handleUnifiedSend ( message ) ;
905889 } }
906890 hasAttachButton = { false }
907- onChange = { ( event , val ) => {
891+ onChange = { ( event : React . ChangeEvent < HTMLDivElement > , val : string ) => {
908892 console . debug ( `Unified MessageBar onChange: "${ val } "` ) ;
909893 setQuestionUnified ( val ) ;
910894 } }
911- value = { questionUnified }
912- placeholder = "Type your prompt here and send to both models..."
895+ // value={questionUnified}
896+ // placeholder="Type your prompt here and send to both models..."
913897 // Disable send button if message is empty or no models are selected
914898 isSendButtonDisabled = { ! questionUnified . trim ( ) || ! selectedModelLeft || ! selectedModelRight }
915899 />
0 commit comments