mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
change semantics
Update README deployment steps and add deploy:secrets script to package.json update local inference script and README update lockfile reconfigure package scripts for development update test execution pass server tests Update README with revised Bun commands and workspace details remove pnpm package manager designator create bun server
This commit is contained in:

committed by
Geoff Seemueller

parent
1055cda2f1
commit
497eb22ad8
@@ -0,0 +1,77 @@
|
||||
import React, {useEffect, useRef, useState} from "react";
|
||||
import {observer} from "mobx-react-lite";
|
||||
import {Box, chakra, InputGroup,} from "@chakra-ui/react";
|
||||
import AutoResize from "react-textarea-autosize";
|
||||
|
||||
const AutoResizeTextArea = chakra(AutoResize);
|
||||
|
||||
interface InputTextAreaProps {
|
||||
inputRef: React.RefObject<HTMLTextAreaElement>;
|
||||
value: string;
|
||||
onChange: (value: string) => void;
|
||||
onKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
||||
isLoading: boolean;
|
||||
}
|
||||
|
||||
const InputTextArea: React.FC<InputTextAreaProps> = observer(
|
||||
({ inputRef, value, onChange, onKeyDown, isLoading }) => {
|
||||
|
||||
const [heightConstraint, setHeightConstraint] = useState<
|
||||
number | undefined
|
||||
>(10);
|
||||
|
||||
useEffect(() => {
|
||||
if (value.length > 10) {
|
||||
setHeightConstraint();
|
||||
}
|
||||
}, [value]);
|
||||
|
||||
return (
|
||||
<Box
|
||||
position="relative"
|
||||
width="100%"
|
||||
height={heightConstraint}
|
||||
display="flex"
|
||||
flexDirection="column"
|
||||
>
|
||||
|
||||
{/* Input Area */}
|
||||
<InputGroup position="relative">
|
||||
<AutoResizeTextArea
|
||||
fontFamily="Arial, sans-serif"
|
||||
ref={inputRef}
|
||||
value={value}
|
||||
height={heightConstraint}
|
||||
autoFocus
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
onKeyDown={onKeyDown}
|
||||
p={2}
|
||||
pr="8px"
|
||||
pl="17px"
|
||||
bg="rgba(255, 255, 255, 0.15)"
|
||||
color="text.primary"
|
||||
borderRadius="20px"
|
||||
border="none"
|
||||
placeholder="Free my mind..."
|
||||
_placeholder={{ color: "gray.400" }}
|
||||
_focus={{
|
||||
outline: "none",
|
||||
}}
|
||||
disabled={isLoading}
|
||||
minRows={1}
|
||||
maxRows={12}
|
||||
style={{
|
||||
touchAction: "none",
|
||||
resize: "none",
|
||||
overflowY: "auto",
|
||||
width: "100%",
|
||||
transition: "height 0.2s ease-in-out",
|
||||
}}
|
||||
/>
|
||||
</InputGroup>
|
||||
</Box>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
export default InputTextArea;
|
Reference in New Issue
Block a user