mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
Remove file upload functionality and related components
The `FileUploadStore` and all file upload features were removed, simplifying the chat interface. This change eliminates unused code, including file handling logic, attachment management, and UI elements, streamlining the application.
This commit is contained in:

committed by
Geoff Seemueller

parent
18ba4aec21
commit
c04e19611e
@@ -1,15 +1,6 @@
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import { observer } from "mobx-react-lite";
|
||||
import {
|
||||
Alert,
|
||||
AlertIcon,
|
||||
Box,
|
||||
chakra,
|
||||
HStack,
|
||||
InputGroup,
|
||||
} from "@chakra-ui/react";
|
||||
import fileUploadStore from "../../stores/FileUploadStore";
|
||||
import { UploadedItem } from "./Attachments";
|
||||
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);
|
||||
@@ -24,24 +15,6 @@ interface InputTextAreaProps {
|
||||
|
||||
const InputTextArea: React.FC<InputTextAreaProps> = observer(
|
||||
({ inputRef, value, onChange, onKeyDown, isLoading }) => {
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
const handleAttachmentClick = () => {
|
||||
if (fileInputRef.current) {
|
||||
fileInputRef.current.click();
|
||||
}
|
||||
};
|
||||
|
||||
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const file = event.target.files?.[0];
|
||||
if (file) {
|
||||
fileUploadStore.uploadFile(file, "/api/documents");
|
||||
}
|
||||
};
|
||||
|
||||
const handleRemoveUploadedItem = (url: string) => {
|
||||
fileUploadStore.removeUploadedFile(url);
|
||||
};
|
||||
|
||||
const [heightConstraint, setHeightConstraint] = useState<
|
||||
number | undefined
|
||||
@@ -61,26 +34,6 @@ const InputTextArea: React.FC<InputTextAreaProps> = observer(
|
||||
display="flex"
|
||||
flexDirection="column"
|
||||
>
|
||||
{/* Attachments Section */}
|
||||
{fileUploadStore.uploadResults.length > 0 && (
|
||||
<HStack
|
||||
spacing={2}
|
||||
mb={2}
|
||||
overflowX="auto"
|
||||
css={{ "&::-webkit-scrollbar": { display: "none" } }}
|
||||
// Ensure attachments wrap if needed
|
||||
flexWrap="wrap"
|
||||
>
|
||||
{fileUploadStore.uploadResults.map((result) => (
|
||||
<UploadedItem
|
||||
key={result.url}
|
||||
url={result.url}
|
||||
name={result.name}
|
||||
onRemove={() => handleRemoveUploadedItem(result.url)}
|
||||
/>
|
||||
))}
|
||||
</HStack>
|
||||
)}
|
||||
|
||||
{/* Input Area */}
|
||||
<InputGroup position="relative">
|
||||
@@ -97,7 +50,7 @@ const InputTextArea: React.FC<InputTextAreaProps> = observer(
|
||||
pl="17px"
|
||||
bg="rgba(255, 255, 255, 0.15)"
|
||||
color="text.primary"
|
||||
borderRadius="20px" // Set a consistent border radius
|
||||
borderRadius="20px"
|
||||
border="none"
|
||||
placeholder="Free my mind..."
|
||||
_placeholder={{ color: "gray.400" }}
|
||||
@@ -115,32 +68,7 @@ const InputTextArea: React.FC<InputTextAreaProps> = observer(
|
||||
transition: "height 0.2s ease-in-out",
|
||||
}}
|
||||
/>
|
||||
{/*<InputRightElement*/}
|
||||
{/* position="absolute"*/}
|
||||
{/* right={0}*/}
|
||||
{/* top={0}*/}
|
||||
{/* bottom={0}*/}
|
||||
{/* width="40px"*/}
|
||||
{/* height="100%"*/}
|
||||
{/* display="flex"*/}
|
||||
{/* alignItems="center"*/}
|
||||
{/* justifyContent="center"*/}
|
||||
{/*>*/}
|
||||
{/*<EnableSearchButton />*/}
|
||||
{/*</InputRightElement>*/}
|
||||
</InputGroup>
|
||||
<input
|
||||
type="file"
|
||||
ref={fileInputRef}
|
||||
style={{ display: "none" }}
|
||||
onChange={handleFileChange}
|
||||
/>
|
||||
{fileUploadStore.uploadError && (
|
||||
<Alert status="error" mt={2}>
|
||||
<AlertIcon />
|
||||
{fileUploadStore.uploadError}
|
||||
</Alert>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
},
|
||||
|
Reference in New Issue
Block a user