abadesalex's picture
updated frontend
5fe6398
import baseUrl from "@/services/api/api.config";
import { Button, Typography, useTheme } from "@mui/material";
import Grid from "@mui/material/Unstable_Grid2";
import { useEffect } from "react";
export default function ModelSelection({ fetchChunks, fetchMessages }) {
const theme = useTheme();
const onHandleClearVariables = async () => {
const url = `${baseUrl}/clear/clear_variables`;
await fetch(url, {
method: "DELETE",
headers: { "Content-Type": "application/json" },
});
await fetchChunks();
await fetchMessages();
};
useEffect(() => {
fetchChunks();
fetchMessages();
}, []);
return (
<>
<Grid
container
mb={2}
alignItems={"center"}
border={1}
borderColor={theme.palette.border.default}
borderRadius={2}
padding={2}
sx={{
backgroundColor: theme.palette.background.default,
}}
>
<Grid item sm={6}>
<Typography variant="h4">Do you want to clear the chat?</Typography>
</Grid>
<Grid
item
container
alignItems="center"
justifyContent={"center"}
sm={4}
border={1}
borderColor={theme.palette.border.default}
borderRadius={2}
sx={{
backgroundColor: "white",
}}
>
<Button onClick={onHandleClearVariables}>
<Typography variant="h6" color="black">
Clear Chat
</Typography>
</Button>
</Grid>
</Grid>
</>
);
}