diff --git a/src/commands/servers.ts b/src/commands/servers.ts index 572cd2a8..9dd8fb74 100644 --- a/src/commands/servers.ts +++ b/src/commands/servers.ts @@ -28,12 +28,10 @@ async function invokeWithErrorHandler( if (result && typeof result === "object" && "failed" in result) { const failedResult = result as any; - if (failedResult.failed?.length > 0) { + if (failedResult.failed?.length > 0 && failedResult?.hits?.length == 0) { failedResult.failed.forEach((error: any) => { - if (result?.hits?.length == 0) { - addError(error.error, 'error'); - } - console.error(error.error); + addError(error.error, 'error'); + // console.error(error.error); }); } } diff --git a/src/components/Search/AutoResizeTextarea.tsx b/src/components/Search/AutoResizeTextarea.tsx index de8dc9d4..a2fcc0c5 100644 --- a/src/components/Search/AutoResizeTextarea.tsx +++ b/src/components/Search/AutoResizeTextarea.tsx @@ -14,69 +14,86 @@ interface AutoResizeTextareaProps { handleKeyDown?: (e: React.KeyboardEvent) => void; connected: boolean; chatPlaceholder?: string; + onLineCountChange?: (lineCount: number) => void; } // Forward ref to allow parent to interact with this component const AutoResizeTextarea = forwardRef< { reset: () => void; focus: () => void }, AutoResizeTextareaProps ->(({ input, setInput, handleKeyDown, connected, chatPlaceholder }, ref) => { - const { t } = useTranslation(); - const textareaRef = useRef(null); - const [isComposition, { setTrue, setFalse }] = useBoolean(); - - // Expose methods to the parent via ref - useImperativeHandle(ref, () => ({ - reset: () => { - setInput(""); +>( + ( + { + input, + setInput, + handleKeyDown, + connected, + chatPlaceholder, + onLineCountChange, }, - focus: () => { - textareaRef.current?.focus(); - }, - })); + ref + ) => { + const { t } = useTranslation(); + const textareaRef = useRef(null); + const [isComposition, { setTrue, setFalse }] = useBoolean(); - const handleKeyPress = (event: KeyboardEvent) => { - if (isComposition) return; + // Expose methods to the parent via ref + useImperativeHandle(ref, () => ({ + reset: () => { + setInput(""); + }, + focus: () => { + textareaRef.current?.focus(); + }, + })); - handleKeyDown?.(event); - }; + const handleKeyPress = (event: KeyboardEvent) => { + if (isComposition) return; - useEffect(() => { - if (textareaRef.current) { - textareaRef.current.style.height = "auto"; - const newHeight = Math.min(textareaRef.current.scrollHeight, 15 * 16); // 15rem ≈ 15 * 16px - textareaRef.current.style.height = `${newHeight}px`; - } - }, [input]); + handleKeyDown?.(event); + }; - return ( -