Skip to content

Commit

Permalink
Merge branch 'main' into feat-extra-security-host
Browse files Browse the repository at this point in the history
  • Loading branch information
tofarr authored Dec 26, 2024
2 parents 5d83ce2 + ad45f8d commit 2ae5017
Showing 1 changed file with 30 additions and 26 deletions.
56 changes: 30 additions & 26 deletions frontend/src/components/shared/task-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { cn } from "#/utils/utils";
import { AttachImageLabel } from "../features/images/attach-image-label";
import { ImageCarousel } from "../features/images/image-carousel";
import { UploadImageInput } from "../features/images/upload-image-input";
import { LoadingSpinner } from "./loading-spinner";

export const TaskForm = React.forwardRef<HTMLFormElement>((_, ref) => {
const dispatch = useDispatch();
Expand Down Expand Up @@ -110,32 +111,35 @@ export const TaskForm = React.forwardRef<HTMLFormElement>((_, ref) => {
"hover:border-neutral-500 focus-within:border-neutral-500",
)}
>
<ChatInput
name="q"
onSubmit={() => {
if (typeof ref !== "function") ref?.current?.requestSubmit();
}}
onChange={(message) => setText(message)}
onFocus={() => setInputIsFocused(true)}
onBlur={() => setInputIsFocused(false)}
onImagePaste={async (imageFiles) => {
const promises = imageFiles.map(convertImageToBase64);
const base64Images = await Promise.all(promises);
base64Images.forEach((base64) => {
dispatch(addFile(base64));
});
}}
placeholder={placeholder}
value={text}
maxRows={15}
showButton={!!text}
className="text-[17px] leading-5 py-[17px]"
buttonClassName="pb-[17px]"
disabled={
navigation.state === "submitting" ||
newConversationMutation.isPending
}
/>
{newConversationMutation.isPending ? (
<div className="flex justify-center py-[17px]">
<LoadingSpinner size="small" />
</div>
) : (
<ChatInput
name="q"
onSubmit={() => {
if (typeof ref !== "function") ref?.current?.requestSubmit();
}}
onChange={(message) => setText(message)}
onFocus={() => setInputIsFocused(true)}
onBlur={() => setInputIsFocused(false)}
onImagePaste={async (imageFiles) => {
const promises = imageFiles.map(convertImageToBase64);
const base64Images = await Promise.all(promises);
base64Images.forEach((base64) => {
dispatch(addFile(base64));
});
}}
placeholder={placeholder}
value={text}
maxRows={15}
showButton={!!text}
className="text-[17px] leading-5 py-[17px]"
buttonClassName="pb-[17px]"
disabled={navigation.state === "submitting"}
/>
)}
</div>
</form>
<UploadImageInput
Expand Down

0 comments on commit 2ae5017

Please sign in to comment.