File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed
examples/website-chatbot-window/app/window Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @openassistantgpt/ui ' : patch
3+ ---
4+
5+ Add new feature to disable chat inputs
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ export default function ChatPage() {
5252 extensions = { [ < SupportInquiry key = "first" /> ] }
5353 handleAfterChat = { ( ) => console . log ( 'after chat' ) }
5454 handleBeforeChat = { ( ) => console . log ( 'before chat' ) }
55+ disableInput = { true }
5556 annotationsFiles = { [
5657 {
5758 fileName : 'google' ,
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ interface ChatbotProps {
4242 onThreadIdChange ?: ( threadId : string | undefined ) => void ;
4343 handleBeforeChat ?: ( ) => Promise < void > | void ;
4444 handleAfterChat ?: ( ) => Promise < void > | void ;
45+ disableInput ?: boolean ; // New option to disable the input
4546}
4647
4748export function OpenAssistantGPTChat ( {
@@ -57,6 +58,7 @@ export function OpenAssistantGPTChat({
5758 handleBeforeChat,
5859 handleAfterChat,
5960 extensions,
61+ disableInput = false , // Default value for the new option
6062 ...props
6163} : ChatbotProps ) {
6264 let inputFileRef = useRef < HTMLInputElement > ( null ) ;
@@ -425,6 +427,7 @@ export function OpenAssistantGPTChat({
425427 multiple
426428 onChange = { handleFileChange }
427429 tabIndex = { - 1 }
430+ disabled = { disableInput }
428431 />
429432 </ div >
430433 ) }
@@ -449,6 +452,7 @@ export function OpenAssistantGPTChat({
449452 rows = { 1 }
450453 value = { input }
451454 onChange = { handleInputChange }
455+ disabled = { disableInput }
452456 />
453457 </ div >
454458 < div className = { `absolute top-[14px] right-0` } >
@@ -457,7 +461,7 @@ export function OpenAssistantGPTChat({
457461 { status === 'awaiting_message' ? (
458462 < Button
459463 id = "submit"
460- disabled = { input === '' }
464+ disabled = { input === '' || disableInput } // Disable the send button when disableInput is true
461465 type = "submit"
462466 size = "icon"
463467 >
You can’t perform that action at this time.
0 commit comments