From 037eec72de4131a1f3291346e6349feaf07761c6 Mon Sep 17 00:00:00 2001 From: ali asaria <aliasaria@users.noreply.github.com> Date: Mon, 15 Jul 2024 12:32:46 -0400 Subject: [PATCH] button to refresh prompt log --- src/renderer/components/Logs.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/Logs.tsx b/src/renderer/components/Logs.tsx index 0fc0acff..1c671bc5 100644 --- a/src/renderer/components/Logs.tsx +++ b/src/renderer/components/Logs.tsx @@ -7,13 +7,17 @@ import { AccordionGroup, AccordionSummary, Box, + Button, + IconButton, Sheet, + Stack, Typography, } from '@mui/joy'; import * as chatAPI from 'renderer/lib/transformerlab-api-sdk'; import useSWR from 'swr'; +import { RotateCcwIcon } from 'lucide-react'; const fetcher = (url) => fetch(url).then((res) => res.text()); @@ -71,7 +75,7 @@ function renderJSONLinesLog(logs) { } export default function Logs({}) { - const { data } = useSWR(chatAPI.Endpoints.Global.PromptLog, fetcher); + const { data, mutate } = useSWR(chatAPI.Endpoints.Global.PromptLog, fetcher); React.useEffect(() => { // Scroll to bottom @@ -88,7 +92,16 @@ export default function Logs({}) { paddingBottom: '1rem', }} > - <h1>Prompt Log</h1> + <Stack direction="row" spacing={1} justifyContent="space-between"> + <h1>Prompt Log</h1> + <IconButton + onClick={() => { + mutate(); + }} + > + <RotateCcwIcon style={{ width: '18px', height: '18px' }} /> + </IconButton> + </Stack> <Box id="logs_accordion" style={{ -- GitLab