From 03e9a613002b76c1bce0da11feddae7821260191 Mon Sep 17 00:00:00 2001 From: Yamcz00r Date: Wed, 26 Jun 2024 22:58:29 +0200 Subject: [PATCH 1/8] -Modified the layout.tsx file to render the Header in each page; -Implemented the default UI for completion text rendering; --- webui/frontend/src/app/components/Header.tsx | 4 +++- .../src/app/components/RenderCompletion.tsx | 20 +++++++++++++++++ webui/frontend/src/app/crawl-history/page.tsx | 7 +----- webui/frontend/src/app/layout.tsx | 22 ++++++++++++++----- webui/frontend/src/app/page.tsx | 19 +++++++++------- .../src/app/summarize-history/page.tsx | 8 ++----- .../src/app/types/RenderCompletionProps.ts | 4 ++++ 7 files changed, 58 insertions(+), 26 deletions(-) create mode 100644 webui/frontend/src/app/components/RenderCompletion.tsx create mode 100644 webui/frontend/src/app/types/RenderCompletionProps.ts diff --git a/webui/frontend/src/app/components/Header.tsx b/webui/frontend/src/app/components/Header.tsx index 96529ad..c367cbb 100644 --- a/webui/frontend/src/app/components/Header.tsx +++ b/webui/frontend/src/app/components/Header.tsx @@ -13,8 +13,10 @@ import { usePathname } from "next/navigation"; const Header = () => { const pathName = usePathname(); + const isSticky = pathName === "/" ? "sticky" : "static"; + return ( - +

Research Chain diff --git a/webui/frontend/src/app/components/RenderCompletion.tsx b/webui/frontend/src/app/components/RenderCompletion.tsx new file mode 100644 index 0000000..eabfebc --- /dev/null +++ b/webui/frontend/src/app/components/RenderCompletion.tsx @@ -0,0 +1,20 @@ +import { Spinner } from "@nextui-org/react"; +import type { RenderCompletionProps } from "@/app/types/RenderCompletionProps"; + +const RenderCompletion = ({ + executing, + completion_result, +}: RenderCompletionProps) => { + return ( +
+ {executing && ( +
+ +
+ )} +

{completion_result}

+
+ ); +}; + +export default RenderCompletion; diff --git a/webui/frontend/src/app/crawl-history/page.tsx b/webui/frontend/src/app/crawl-history/page.tsx index d0bed54..23c9f09 100644 --- a/webui/frontend/src/app/crawl-history/page.tsx +++ b/webui/frontend/src/app/crawl-history/page.tsx @@ -1,6 +1,5 @@ "use client"; import React from "react"; -import Header from "../components/Header"; import { UseQueryResult, useQuery } from "react-query"; import HistoryCard from "../components/HistoryCard"; import { CrawlResult } from "../types/TaskType"; @@ -14,13 +13,12 @@ const CrawlHistory = () => { throw new Error("Network response was not ok"); } return response.json() as Promise; - } + }, ); if (isLoading) { return (
-
Loading...
); @@ -29,7 +27,6 @@ const CrawlHistory = () => { if (isError) { return (
-
Fetching data
); @@ -38,7 +35,6 @@ const CrawlHistory = () => { if (!data || data.tasks.length === 0) { return (
-
There is no crawler history
); @@ -46,7 +42,6 @@ const CrawlHistory = () => { return (
-
{data.tasks.map((item) => ( diff --git a/webui/frontend/src/app/layout.tsx b/webui/frontend/src/app/layout.tsx index 7c8ef3a..1ac748e 100644 --- a/webui/frontend/src/app/layout.tsx +++ b/webui/frontend/src/app/layout.tsx @@ -1,13 +1,25 @@ -import {Providers} from "./providers"; -import './globals.css' -export default function RootLayout({children}: { children: React.ReactNode }) { +import React from "react"; +import { Metadata } from "next"; +import { Providers } from "./providers"; +import Header from "./components/Header"; +import "./globals.css"; +export default function RootLayout({ + children, +}: { + children: React.ReactNode; +}) { return ( - + +
{children} ); -} \ No newline at end of file +} + +export const metadata: Metadata = { + title: "Research Chain", +}; diff --git a/webui/frontend/src/app/page.tsx b/webui/frontend/src/app/page.tsx index ce87343..c8f2157 100644 --- a/webui/frontend/src/app/page.tsx +++ b/webui/frontend/src/app/page.tsx @@ -1,15 +1,18 @@ import PromptInput from "./components/PromptInput"; -import Header from "./components/Header"; +import RenderCompletion from "./components/RenderCompletion"; export default function Page() { return ( -
-
-
-
-
+ <> +
-
-
+ + + ); } diff --git a/webui/frontend/src/app/summarize-history/page.tsx b/webui/frontend/src/app/summarize-history/page.tsx index cb6dd3c..d7f53ab 100644 --- a/webui/frontend/src/app/summarize-history/page.tsx +++ b/webui/frontend/src/app/summarize-history/page.tsx @@ -8,7 +8,7 @@ import { SummaryResult, SummaryTask } from "../types/TaskType"; const SummarizeHistory = () => { const [selectedTaskIndex, setSelectedTaskIndex] = useState( - null + null, ); const handleCardClick = (index: number) => { @@ -27,13 +27,12 @@ const SummarizeHistory = () => { throw new Error("Network response was not ok"); } return response.json() as Promise; - } + }, ); if (isLoading) { return (
-
Loading...
); @@ -42,7 +41,6 @@ const SummarizeHistory = () => { if (isError) { return (
-
Fetching data
); @@ -51,7 +49,6 @@ const SummarizeHistory = () => { if (!data || data.tasks.length === 0) { return (
-
There is no crawler history
); @@ -59,7 +56,6 @@ const SummarizeHistory = () => { return (
-
{data.tasks.map((item, index) => ( diff --git a/webui/frontend/src/app/types/RenderCompletionProps.ts b/webui/frontend/src/app/types/RenderCompletionProps.ts new file mode 100644 index 0000000..3c6e422 --- /dev/null +++ b/webui/frontend/src/app/types/RenderCompletionProps.ts @@ -0,0 +1,4 @@ +export interface RenderCompletionProps { + executing: boolean; + completion_result: string; +} \ No newline at end of file From 7675759e993bf5adb87243cb64e597920c193e61 Mon Sep 17 00:00:00 2001 From: Yamcz00r Date: Sat, 29 Jun 2024 12:06:47 +0200 Subject: [PATCH 2/8] -Created the Context Wrapper for completion result; --- .../src/app/components/PromptInput.tsx | 17 ++++--- .../src/app/context/SummarizerContext.tsx | 45 +++++++++++++++++++ webui/frontend/src/app/page.tsx | 4 +- webui/frontend/src/app/providers.tsx | 15 ++++--- 4 files changed, 64 insertions(+), 17 deletions(-) create mode 100644 webui/frontend/src/app/context/SummarizerContext.tsx diff --git a/webui/frontend/src/app/components/PromptInput.tsx b/webui/frontend/src/app/components/PromptInput.tsx index c1c883f..e8681cd 100644 --- a/webui/frontend/src/app/components/PromptInput.tsx +++ b/webui/frontend/src/app/components/PromptInput.tsx @@ -1,5 +1,6 @@ "use client"; -import React, { Key, useState } from "react"; +import React, { Key, useState, useContext } from "react"; +import { SummarizerContext } from "@/app/context/SummarizerContext"; import { Button, Tab, Tabs, Textarea } from "@nextui-org/react"; import { UseMutationOptions, @@ -14,8 +15,7 @@ type FormValues = { }; type MutationResult = { - success: boolean; - message: string; + uuid: string; }; function PromptInput() { @@ -24,6 +24,7 @@ function PromptInput() { prompt: "", mode: "", }); + const context = useContext(SummarizerContext); const FormData = z.object({ prompt: z.string().min(1), @@ -60,7 +61,7 @@ function PromptInput() { { onSuccess: (result) => {}, onError: (error) => {}, - } as UseMutationOptions + } as UseMutationOptions, ); const addSummarize: UseMutationResult = @@ -85,7 +86,7 @@ function PromptInput() { { onSuccess: (result) => {}, onError: (error) => {}, - } as UseMutationOptions + } as UseMutationOptions, ); const onModeChange = (key: Key) => { @@ -103,12 +104,14 @@ function PromptInput() { })); }; - const handleSubmit = (event: React.FormEvent) => { + const handleSubmit = async (event: React.FormEvent) => { event.preventDefault(); if (crawlActive) { addCrawl.mutate(formValues); } else { - addSummarize.mutate(formValues); + await addSummarize.mutate(formValues); + console.log(addSummarize?.data); + context?.sendUuid(addSummarize?.data?.uuid); } }; diff --git a/webui/frontend/src/app/context/SummarizerContext.tsx b/webui/frontend/src/app/context/SummarizerContext.tsx new file mode 100644 index 0000000..0912fe2 --- /dev/null +++ b/webui/frontend/src/app/context/SummarizerContext.tsx @@ -0,0 +1,45 @@ +"use client"; + +import { createContext, useState, useEffect, ReactNode } from "react"; + +interface SummarizerContext { + isSummarizing: boolean; + completion: string; + sendUuid: (uuid: string | undefined) => void; +} + +interface SummarizerContextProviderProps { + children?: ReactNode; +} + +export const SummarizerContext = createContext(null); + +const SummarizerContextProvider = ({ + children, +}: SummarizerContextProviderProps) => { + const [isSummarizing, setIsSummarizing] = useState(false); + const [completion, setCompletion] = useState(""); + + const socket = new WebSocket("ws://localhost:8000/ws"); + + const sendUuid = (uuid?: string) => { + if (socket && socket.readyState === WebSocket.OPEN) { + setIsSummarizing(true); + socket.send(JSON.stringify({ uuid: uuid })); + } + }; + + const value = { + isSummarizing, + completion, + sendUuid, + }; + + return ( + + {children} + + ); +}; + +export default SummarizerContextProvider; diff --git a/webui/frontend/src/app/page.tsx b/webui/frontend/src/app/page.tsx index c8f2157..b6c9eb3 100644 --- a/webui/frontend/src/app/page.tsx +++ b/webui/frontend/src/app/page.tsx @@ -8,9 +8,7 @@ export default function Page() { diff --git a/webui/frontend/src/app/providers.tsx b/webui/frontend/src/app/providers.tsx index 2955e2e..a2e78d6 100644 --- a/webui/frontend/src/app/providers.tsx +++ b/webui/frontend/src/app/providers.tsx @@ -1,14 +1,15 @@ -"use client" -import {NextUIProvider} from '@nextui-org/react' -import { QueryClient, QueryClientProvider } from 'react-query'; +"use client"; +import { NextUIProvider } from "@nextui-org/react"; +import { QueryClient, QueryClientProvider } from "react-query"; +import SummarizerContextProvider from "@/app/context/SummarizerContext"; const queryClient = new QueryClient(); -export function Providers({children}: { children: React.ReactNode }) { +export function Providers({ children }: { children: React.ReactNode }) { return ( - {children} + {children} - ) -} \ No newline at end of file + ); +} From 2c4681fd5eb90227328881da25dd5cb2247b6c24 Mon Sep 17 00:00:00 2001 From: Nekxis Date: Tue, 9 Jul 2024 22:44:59 +0200 Subject: [PATCH 3/8] receiving summarize through websocket --- webui/frontend/package.json | 22 +++++++-------- .../src/app/components/PromptInput.tsx | 12 ++++----- .../src/app/components/RenderCompletion.tsx | 5 ++-- .../src/app/context/SummarizerContext.tsx | 27 ++++++++++++++----- webui/frontend/src/app/page.tsx | 2 +- 5 files changed, 42 insertions(+), 26 deletions(-) diff --git a/webui/frontend/package.json b/webui/frontend/package.json index 9e2339d..da864dd 100644 --- a/webui/frontend/package.json +++ b/webui/frontend/package.json @@ -9,24 +9,24 @@ "lint": "next lint" }, "dependencies": { - "@nextui-org/react": "^2.2.10", - "framer-motion": "^11.0.25", + "@nextui-org/react": "^2.4.2", + "framer-motion": "^11.2.14", "next": "14.1.4", - "react": "^18", - "react-dom": "^18", + "react": "^18.3.1", + "react-dom": "^18.3.1", "react-icons": "^5.2.1", "react-query": "^3.39.3", "zod": "^3.23.8" }, "devDependencies": { - "@types/node": "^20", - "@types/react": "^18", - "@types/react-dom": "^18", + "@types/node": "^20.14.10", + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", "autoprefixer": "^10.4.19", - "eslint": "^8", + "eslint": "^8.57.0", "eslint-config-next": "14.1.4", - "postcss": "^8.4.38", - "tailwindcss": "^3.4.3", - "typescript": "^5" + "postcss": "^8.4.39", + "tailwindcss": "^3.4.4", + "typescript": "^5.5.3" } } diff --git a/webui/frontend/src/app/components/PromptInput.tsx b/webui/frontend/src/app/components/PromptInput.tsx index e8681cd..6bbc14e 100644 --- a/webui/frontend/src/app/components/PromptInput.tsx +++ b/webui/frontend/src/app/components/PromptInput.tsx @@ -61,7 +61,7 @@ function PromptInput() { { onSuccess: (result) => {}, onError: (error) => {}, - } as UseMutationOptions, + } as UseMutationOptions ); const addSummarize: UseMutationResult = @@ -84,9 +84,11 @@ function PromptInput() { return result; }, { - onSuccess: (result) => {}, + onSuccess: (result) => { + context?.sendUuid(result.uuid); + }, onError: (error) => {}, - } as UseMutationOptions, + } as UseMutationOptions ); const onModeChange = (key: Key) => { @@ -109,9 +111,7 @@ function PromptInput() { if (crawlActive) { addCrawl.mutate(formValues); } else { - await addSummarize.mutate(formValues); - console.log(addSummarize?.data); - context?.sendUuid(addSummarize?.data?.uuid); + addSummarize.mutate(formValues); } }; diff --git a/webui/frontend/src/app/components/RenderCompletion.tsx b/webui/frontend/src/app/components/RenderCompletion.tsx index eabfebc..ab6ee3e 100644 --- a/webui/frontend/src/app/components/RenderCompletion.tsx +++ b/webui/frontend/src/app/components/RenderCompletion.tsx @@ -7,12 +7,13 @@ const RenderCompletion = ({ }: RenderCompletionProps) => { return (
- {executing && ( + {executing ? (
+ ) : ( +

{completion_result}

)} -

{completion_result}

); }; diff --git a/webui/frontend/src/app/context/SummarizerContext.tsx b/webui/frontend/src/app/context/SummarizerContext.tsx index 0912fe2..b1cef57 100644 --- a/webui/frontend/src/app/context/SummarizerContext.tsx +++ b/webui/frontend/src/app/context/SummarizerContext.tsx @@ -4,8 +4,8 @@ import { createContext, useState, useEffect, ReactNode } from "react"; interface SummarizerContext { isSummarizing: boolean; - completion: string; - sendUuid: (uuid: string | undefined) => void; + completion: { uuid: string; status: string; payload: string }[]; + sendUuid: (uuid: string) => void; } interface SummarizerContextProviderProps { @@ -18,17 +18,32 @@ const SummarizerContextProvider = ({ children, }: SummarizerContextProviderProps) => { const [isSummarizing, setIsSummarizing] = useState(false); - const [completion, setCompletion] = useState(""); + const [completion, setCompletion] = useState< + { uuid: string; status: string; payload: string }[] + >([]); const socket = new WebSocket("ws://localhost:8000/ws"); - const sendUuid = (uuid?: string) => { - if (socket && socket.readyState === WebSocket.OPEN) { - setIsSummarizing(true); + const sendUuid = (uuid: string) => { + if (socket && socket.readyState === WebSocket.OPEN && uuid) { + setIsSummarizing(false); socket.send(JSON.stringify({ uuid: uuid })); } }; + socket.onmessage = (event) => { + try { + const completion = JSON.parse(event.data); + if (completion.uuid && completion.status === "summary completed") { + setCompletion((prevCompletion) => [...prevCompletion, completion]); + } else { + console.error("Received message has an invalid structure:", completion); + } + } catch (error) { + console.error("Error parsing message:", error); + } + }; + const value = { isSummarizing, completion, diff --git a/webui/frontend/src/app/page.tsx b/webui/frontend/src/app/page.tsx index b6c9eb3..cae6934 100644 --- a/webui/frontend/src/app/page.tsx +++ b/webui/frontend/src/app/page.tsx @@ -8,7 +8,7 @@ export default function Page() { From d51414b330ba75a5d35574e64369743fd3630963 Mon Sep 17 00:00:00 2001 From: Nekxis Date: Sun, 14 Jul 2024 00:10:41 +0200 Subject: [PATCH 4/8] finishing logic for websocket --- .../src/app/components/RenderCompletion.tsx | 18 +++++++++------- .../src/app/context/SummarizerContext.tsx | 21 ++++++++++++------- webui/frontend/src/app/page.tsx | 19 ++++++++++++----- .../src/app/types/RenderCompletionProps.ts | 2 +- 4 files changed, 38 insertions(+), 22 deletions(-) diff --git a/webui/frontend/src/app/components/RenderCompletion.tsx b/webui/frontend/src/app/components/RenderCompletion.tsx index ab6ee3e..fb1925f 100644 --- a/webui/frontend/src/app/components/RenderCompletion.tsx +++ b/webui/frontend/src/app/components/RenderCompletion.tsx @@ -6,14 +6,16 @@ const RenderCompletion = ({ completion_result, }: RenderCompletionProps) => { return ( -
- {executing ? ( -
- -
- ) : ( -

{completion_result}

- )} +
+
+ {executing ? ( +
+ +
+ ) : ( +

{completion_result}

+ )} +
); }; diff --git a/webui/frontend/src/app/context/SummarizerContext.tsx b/webui/frontend/src/app/context/SummarizerContext.tsx index b1cef57..bfdc3ed 100644 --- a/webui/frontend/src/app/context/SummarizerContext.tsx +++ b/webui/frontend/src/app/context/SummarizerContext.tsx @@ -1,10 +1,10 @@ "use client"; -import { createContext, useState, useEffect, ReactNode } from "react"; +import { createContext, useState, ReactNode } from "react"; -interface SummarizerContext { +interface SummarizerContextProps { isSummarizing: boolean; - completion: { uuid: string; status: string; payload: string }[]; + completion?: { uuid: string; status: string; payload: string }; sendUuid: (uuid: string) => void; } @@ -12,15 +12,19 @@ interface SummarizerContextProviderProps { children?: ReactNode; } -export const SummarizerContext = createContext(null); +export const SummarizerContext = createContext( + null +); const SummarizerContextProvider = ({ children, }: SummarizerContextProviderProps) => { const [isSummarizing, setIsSummarizing] = useState(false); - const [completion, setCompletion] = useState< - { uuid: string; status: string; payload: string }[] - >([]); + const [completion, setCompletion] = useState<{ + uuid: string; + status: string; + payload: string; + }>(); const socket = new WebSocket("ws://localhost:8000/ws"); @@ -35,7 +39,7 @@ const SummarizerContextProvider = ({ try { const completion = JSON.parse(event.data); if (completion.uuid && completion.status === "summary completed") { - setCompletion((prevCompletion) => [...prevCompletion, completion]); + setCompletion(completion); } else { console.error("Received message has an invalid structure:", completion); } @@ -43,6 +47,7 @@ const SummarizerContextProvider = ({ console.error("Error parsing message:", error); } }; + console.log(isSummarizing, completion); const value = { isSummarizing, diff --git a/webui/frontend/src/app/page.tsx b/webui/frontend/src/app/page.tsx index cae6934..082ff8a 100644 --- a/webui/frontend/src/app/page.tsx +++ b/webui/frontend/src/app/page.tsx @@ -1,15 +1,24 @@ +"use client" +import { useContext } from "react"; import PromptInput from "./components/PromptInput"; import RenderCompletion from "./components/RenderCompletion"; +import { SummarizerContext } from "./context/SummarizerContext"; export default function Page() { + const context = useContext(SummarizerContext); + const isSummarizing = context?.isSummarizing ?? false; + const completion = context?.completion ?? null; return ( <>
- - + {isSummarizing || completion ? ( + + ) : ( + + )}
); diff --git a/webui/frontend/src/app/types/RenderCompletionProps.ts b/webui/frontend/src/app/types/RenderCompletionProps.ts index 3c6e422..c7780c9 100644 --- a/webui/frontend/src/app/types/RenderCompletionProps.ts +++ b/webui/frontend/src/app/types/RenderCompletionProps.ts @@ -1,4 +1,4 @@ export interface RenderCompletionProps { executing: boolean; - completion_result: string; + completion_result: string | undefined; } \ No newline at end of file From 0ca58dc09998c96149e42a203ded1b71b547335e Mon Sep 17 00:00:00 2001 From: Yamcz00r Date: Sat, 20 Jul 2024 13:36:01 +0200 Subject: [PATCH 5/8] -Created the websocket functionality --- .../src/app/components/RenderCompletion.tsx | 16 ++++++++++++---- .../src/app/context/SummarizerContext.tsx | 15 ++++++++++----- webui/frontend/src/app/page.tsx | 4 +++- .../src/app/types/RenderCompletionProps.ts | 7 ++++--- webui/main.py | 1 + 5 files changed, 30 insertions(+), 13 deletions(-) diff --git a/webui/frontend/src/app/components/RenderCompletion.tsx b/webui/frontend/src/app/components/RenderCompletion.tsx index fb1925f..97176fb 100644 --- a/webui/frontend/src/app/components/RenderCompletion.tsx +++ b/webui/frontend/src/app/components/RenderCompletion.tsx @@ -1,19 +1,27 @@ -import { Spinner } from "@nextui-org/react"; +import { Spinner, Button } from "@nextui-org/react"; import type { RenderCompletionProps } from "@/app/types/RenderCompletionProps"; const RenderCompletion = ({ executing, completion_result, + handleClose, }: RenderCompletionProps) => { return ( -
-
+
+
{executing ? (
) : ( -

{completion_result}

+ <> +

{completion_result}

+
+ +
+ )}
diff --git a/webui/frontend/src/app/context/SummarizerContext.tsx b/webui/frontend/src/app/context/SummarizerContext.tsx index bfdc3ed..09fa063 100644 --- a/webui/frontend/src/app/context/SummarizerContext.tsx +++ b/webui/frontend/src/app/context/SummarizerContext.tsx @@ -4,8 +4,9 @@ import { createContext, useState, ReactNode } from "react"; interface SummarizerContextProps { isSummarizing: boolean; - completion?: { uuid: string; status: string; payload: string }; + completion?: { uuid: string; status: string; payload: string } | null; sendUuid: (uuid: string) => void; + handleCloseCompletionModal: () => void; } interface SummarizerContextProviderProps { @@ -24,13 +25,13 @@ const SummarizerContextProvider = ({ uuid: string; status: string; payload: string; - }>(); + } | null>(); const socket = new WebSocket("ws://localhost:8000/ws"); const sendUuid = (uuid: string) => { if (socket && socket.readyState === WebSocket.OPEN && uuid) { - setIsSummarizing(false); + setIsSummarizing(true); socket.send(JSON.stringify({ uuid: uuid })); } }; @@ -40,8 +41,7 @@ const SummarizerContextProvider = ({ const completion = JSON.parse(event.data); if (completion.uuid && completion.status === "summary completed") { setCompletion(completion); - } else { - console.error("Received message has an invalid structure:", completion); + setIsSummarizing(false); } } catch (error) { console.error("Error parsing message:", error); @@ -49,10 +49,15 @@ const SummarizerContextProvider = ({ }; console.log(isSummarizing, completion); + const handleCloseCompletionModal = () => { + setCompletion(null); + }; + const value = { isSummarizing, completion, sendUuid, + handleCloseCompletionModal, }; return ( diff --git a/webui/frontend/src/app/page.tsx b/webui/frontend/src/app/page.tsx index 082ff8a..c4559de 100644 --- a/webui/frontend/src/app/page.tsx +++ b/webui/frontend/src/app/page.tsx @@ -1,4 +1,4 @@ -"use client" +"use client"; import { useContext } from "react"; import PromptInput from "./components/PromptInput"; import RenderCompletion from "./components/RenderCompletion"; @@ -8,12 +8,14 @@ export default function Page() { const context = useContext(SummarizerContext); const isSummarizing = context?.isSummarizing ?? false; const completion = context?.completion ?? null; + const handleCloseCompletionModal = context!.handleCloseCompletionModal; return ( <>
{isSummarizing || completion ? ( ) : ( diff --git a/webui/frontend/src/app/types/RenderCompletionProps.ts b/webui/frontend/src/app/types/RenderCompletionProps.ts index c7780c9..b39a1c7 100644 --- a/webui/frontend/src/app/types/RenderCompletionProps.ts +++ b/webui/frontend/src/app/types/RenderCompletionProps.ts @@ -1,4 +1,5 @@ export interface RenderCompletionProps { - executing: boolean; - completion_result: string | undefined; -} \ No newline at end of file + executing: boolean; + completion_result: string | undefined; + handleClose: () => void; +} diff --git a/webui/main.py b/webui/main.py index d06f532..5570512 100644 --- a/webui/main.py +++ b/webui/main.py @@ -83,6 +83,7 @@ async def on_connection(websocket: WebSocket): del active_connections[websocket] + # This decorator allow to call async callback function in side synchronous context def sync(f): @functools.wraps(f) From f32bc6c910c008b4cf1653e891f0746790c32c60 Mon Sep 17 00:00:00 2001 From: Yamcz00r Date: Tue, 23 Jul 2024 15:05:27 +0200 Subject: [PATCH 6/8] -Fix the background with the big summarize; --- webui/frontend/src/app/components/RenderCompletion.tsx | 2 +- webui/frontend/src/app/page.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/webui/frontend/src/app/components/RenderCompletion.tsx b/webui/frontend/src/app/components/RenderCompletion.tsx index 97176fb..8c578d6 100644 --- a/webui/frontend/src/app/components/RenderCompletion.tsx +++ b/webui/frontend/src/app/components/RenderCompletion.tsx @@ -7,7 +7,7 @@ const RenderCompletion = ({ handleClose, }: RenderCompletionProps) => { return ( -
+
{executing ? (
diff --git a/webui/frontend/src/app/page.tsx b/webui/frontend/src/app/page.tsx index c4559de..8c75769 100644 --- a/webui/frontend/src/app/page.tsx +++ b/webui/frontend/src/app/page.tsx @@ -11,7 +11,7 @@ export default function Page() { const handleCloseCompletionModal = context!.handleCloseCompletionModal; return ( <> -
+
{isSummarizing || completion ? ( Date: Wed, 24 Jul 2024 23:37:40 +0200 Subject: [PATCH 7/8] adding transition --- webui/frontend/src/app/components/Header.tsx | 2 +- .../src/app/components/PromptInput.tsx | 80 +++++++++---------- .../src/app/components/RenderCompletion.tsx | 32 ++++---- webui/frontend/src/app/page.tsx | 29 ++++--- 4 files changed, 75 insertions(+), 68 deletions(-) diff --git a/webui/frontend/src/app/components/Header.tsx b/webui/frontend/src/app/components/Header.tsx index c367cbb..068674c 100644 --- a/webui/frontend/src/app/components/Header.tsx +++ b/webui/frontend/src/app/components/Header.tsx @@ -16,7 +16,7 @@ const Header = () => { const isSticky = pathName === "/" ? "sticky" : "static"; return ( - +

Research Chain diff --git a/webui/frontend/src/app/components/PromptInput.tsx b/webui/frontend/src/app/components/PromptInput.tsx index 6bbc14e..d4dfaf5 100644 --- a/webui/frontend/src/app/components/PromptInput.tsx +++ b/webui/frontend/src/app/components/PromptInput.tsx @@ -116,54 +116,52 @@ function PromptInput() { }; return ( -
-
-