diff --git a/apps/studio/src/components/ai-input.tsx b/apps/studio/src/components/ai-input.tsx index f9ccd05a00..3bdd9d4edf 100644 --- a/apps/studio/src/components/ai-input.tsx +++ b/apps/studio/src/components/ai-input.tsx @@ -4,7 +4,6 @@ import { Icon, moreVertical, keyboardReturn, reset } from '@wordpress/icons'; import React, { forwardRef, useRef, useEffect, useState } from 'react'; import { ArrowIcon } from 'src/components/arrow-icon'; import { TELEX_HOSTNAME, TELEX_UTM_PARAMS } from 'src/constants'; -import useAiIcon from 'src/hooks/use-ai-icon'; import { cx } from 'src/lib/cx'; import { getIpcApi } from 'src/lib/get-ipc-api'; import { addUrlParams } from 'src/lib/url-utils'; @@ -57,34 +56,17 @@ const UnforwardedAIInput = ( }: AIInputProps, inputRef: React.RefObject< HTMLTextAreaElement > | React.RefCallback< HTMLTextAreaElement > | null ) => { - const [ isTyping, setIsTyping ] = useState( false ); const [ thinkingDuration, setThinkingDuration ] = useState< 'short' | 'medium' | 'long' | 'veryLong' >( 'short' ); - const typingTimeout = useRef< NodeJS.Timeout >(); const thinkingTimeout = useRef< NodeJS.Timeout[] >( [] ); - const { RiveComponent } = useAiIcon( { - inactive: disabled, - thinking: isAssistantThinking, - typing: isTyping, - } ); - useEffect( () => { if ( ! disabled && inputRef && 'current' in inputRef && inputRef.current ) { inputRef.current?.focus(); } }, [ disabled, inputRef ] ); - useEffect( - () => () => { - if ( typingTimeout.current ) { - clearTimeout( typingTimeout.current ); - } - }, - [] - ); - const handleInput = ( e: React.ChangeEvent< HTMLTextAreaElement > ) => { setInput( e.target.value ); @@ -126,21 +108,10 @@ const UnforwardedAIInput = ( // Allow Shift + Enter to create a new line return; } else { - setIsTyping( true ); handleKeyDown( e ); } }; - const handleKeyUpWrapper = () => { - if ( typingTimeout.current ) { - clearTimeout( typingTimeout.current ); - } - - typingTimeout.current = setTimeout( () => { - setIsTyping( false ); - }, 400 ); - }; - useEffect( () => { function clearThinkingTimeouts() { thinkingTimeout.current.forEach( clearTimeout ); @@ -223,22 +194,18 @@ const UnforwardedAIInput = ( }` ) } > -
-