diff --git a/react/src/components/lablupTalkativotUI/ChatUIModal.tsx b/react/src/components/lablupTalkativotUI/ChatUIModal.tsx index 48d897b60..154aad9c6 100644 --- a/react/src/components/lablupTalkativotUI/ChatUIModal.tsx +++ b/react/src/components/lablupTalkativotUI/ChatUIModal.tsx @@ -71,6 +71,7 @@ const EndpointChatContent: React.FC = ({ graphql` fragment ChatUIModalFragment on Endpoint { endpoint_id + name url status } @@ -90,6 +91,7 @@ const EndpointChatContent: React.FC = ({ `, endpointTokenFrgmt, ); + const isTextToImageModel = _.includes(endpoint?.name, 'stable-diffusion'); const newestToken = _.maxBy( endpointTokenList?.items, @@ -124,7 +126,12 @@ const EndpointChatContent: React.FC = ({ ) : ( ({ id: m.id, name: m.id, @@ -133,6 +140,7 @@ const EndpointChatContent: React.FC = ({ style={{ flex: 1 }} allowCustomModel={_.isEmpty(modelsResult?.data)} alert={ + !isTextToImageModel && _.isEmpty(modelsResult?.data) && ( = ({ setLoadingImageGeneration(true); try { const response = await fetch( - 'https://stable-diffusion-3m.asia03.app.backend.ai/generate-image', + customModelFormRef.current?.getFieldValue('baseURL'), { method: 'POST', headers: { @@ -414,8 +414,8 @@ const LLMChatCard: React.FC = ({ }); if (isImageGeneration) { + const generationId = _.uniqueId(); try { - const imageBase64 = await generateImage(input, 'accessKey'); setMessages((prevMessages) => [ ...prevMessages, { @@ -424,7 +424,20 @@ const LLMChatCard: React.FC = ({ content: input, }, { - id: _.uniqueId(), + id: generationId, + role: 'assistant', + content: 'Processing...', + }, + ]); + setInput(''); + const imageBase64 = await generateImage(input, 'accessKey'); + setMessages((prevMessages) => [ + ..._.filter( + prevMessages, + (message) => message.id !== generationId, + ), + { + id: generationId, role: 'assistant', content: '', experimental_attachments: [ @@ -510,6 +523,7 @@ const LLMChatCard: React.FC = ({ required: true, }, ]} + hidden={isImageGeneration} >