From 3718ef42b9e82cf2f01729c3c1a257dc1614f0b6 Mon Sep 17 00:00:00 2001 From: Ishan Mishra Date: Sat, 24 Feb 2024 13:16:52 +0530 Subject: [PATCH 01/20] Feat/stt immediate display fix (#180) * error handling added * error handling added --- .../(main)/project/[project_id]/chat/[chat_id]/page.tsx | 3 ++- src/app/(main)/project/[project_id]/page.tsx | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/(main)/project/[project_id]/chat/[chat_id]/page.tsx b/src/app/(main)/project/[project_id]/chat/[chat_id]/page.tsx index 1bb8ffda..fa07bdfe 100644 --- a/src/app/(main)/project/[project_id]/chat/[chat_id]/page.tsx +++ b/src/app/(main)/project/[project_id]/chat/[chat_id]/page.tsx @@ -136,7 +136,8 @@ export default function Chat( converseMutation.mutate({ formdata: fd }); } catch(e: any){ - setApiError(e.message); + setIsTyping(false); + setApiError(e?.error?.error); } }; diff --git a/src/app/(main)/project/[project_id]/page.tsx b/src/app/(main)/project/[project_id]/page.tsx index bbbde1fd..1698cb90 100644 --- a/src/app/(main)/project/[project_id]/page.tsx +++ b/src/app/(main)/project/[project_id]/page.tsx @@ -115,7 +115,8 @@ export default function Chat(params: { params: { project_id: string } }) { const fd = await getFormData(undefined, chat); converseMutation.mutate({ external_id, formdata: fd }); }catch(e: any){ - setApiError(e.message); + setIsTyping(false); + setApiError(e?.error?.error); } }; @@ -132,6 +133,7 @@ export default function Chat(params: { params: { project_id: string } }) { external_id, sttFormData, ) + setChat(transcript); const fd = await getFormData(undefined, transcript); @@ -140,7 +142,8 @@ export default function Chat(params: { params: { project_id: string } }) { converseMutation.mutate({ external_id, formdata: fd }); } catch(e: any){ - setApiError(e.message); + setIsTyping(false); + setApiError(e?.error?.error); } }; From 27851d1fbddf9a23c8747b8faf16c33191d8d19f Mon Sep 17 00:00:00 2001 From: Laditya Gogoi <108052802+Lobi29@users.noreply.github.com> Date: Wed, 28 Feb 2024 10:53:34 +0530 Subject: [PATCH 02/20] Improve User Experience by Delaying and Repositioning Interaction Buttons. (#184) --- src/components/chatblock.tsx | 67 +++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/src/components/chatblock.tsx b/src/components/chatblock.tsx index 6b58098f..0cfa5718 100644 --- a/src/components/chatblock.tsx +++ b/src/components/chatblock.tsx @@ -194,26 +194,37 @@ export default function ChatBlock(props: { )} {message?.messageType === ChatMessageType.AYUSHMA && message?.audio && ( -
- - {(audioStatus === "paused" || - audioStatus === "playing") && ( - - )} +
+
+ + {(audioStatus === "paused" || + audioStatus === "playing") && ( + + )} +
+
+ {message?.messageType === ChatMessageType.AYUSHMA && ( + + )} +
)} {storage?.show_english && @@ -274,12 +285,6 @@ export default function ChatBlock(props: { })}
)} - {message?.messageType === ChatMessageType.AYUSHMA && ( - - )} ); } @@ -288,10 +293,12 @@ const ChatFeedback = ({ feedback, message_id, onSuccess, + contentLoading }: { message_id: string; feedback: ChatFeedback; onSuccess?: (data: ChatFeedback) => void; + contentLoading?: string }) => { const queryClient = useQueryClient(); const [liked, setLiked] = useState(null); @@ -316,8 +323,12 @@ const ChatFeedback = ({ }, ); + if (!contentLoading) { + return; + } + return feedback ? ( -
+
{feedback.message && (
{feedback.message} @@ -401,7 +412,7 @@ const ChatFeedback = ({
-
+
setLiked(true)} className="far fa-thumbs-up cursor-pointer p-1 rounded text-gray-500 hover:text-gray-900 hover:bg-gray-100" From 70869d8c8f3dcd6b592f32f6ec632d73110e8c50 Mon Sep 17 00:00:00 2001 From: Ashesh <3626859+Ashesh3@users.noreply.github.com> Date: Wed, 28 Feb 2024 22:41:44 +0530 Subject: [PATCH 03/20] Enhancements to Pagination and Other Fixes (#187) * Enhancements to pagination * Update src/app/(main)/client.tsx Co-authored-by: Shivank Kacker * Update src/app/admin/page.tsx Co-authored-by: Shivank Kacker --------- Co-authored-by: Shivank Kacker --- src/app/(main)/client.tsx | 2 +- .../[project_id]/chat/[chat_id]/page.tsx | 2 +- src/app/admin/page.tsx | 26 +- src/app/admin/tests/[testsuite_id]/page.tsx | 324 +++++++++--------- src/app/admin/tests/new/page.tsx | 6 +- src/components/forms/testsuiteform.tsx | 4 +- src/utils/api.ts | 74 ++-- 7 files changed, 228 insertions(+), 210 deletions(-) diff --git a/src/app/(main)/client.tsx b/src/app/(main)/client.tsx index 82fbc67e..b91ad229 100644 --- a/src/app/(main)/client.tsx +++ b/src/app/(main)/client.tsx @@ -7,7 +7,7 @@ import { useEffect } from "react"; export default function Client() { const projectsQuery = useQuery>({ - queryKey: ["projects"], + queryKey: ["projects", "app"], queryFn: () => API.projects.list() }); const router = useRouter(); diff --git a/src/app/(main)/project/[project_id]/chat/[chat_id]/page.tsx b/src/app/(main)/project/[project_id]/chat/[chat_id]/page.tsx index fa07bdfe..5adb6ef6 100644 --- a/src/app/(main)/project/[project_id]/chat/[chat_id]/page.tsx +++ b/src/app/(main)/project/[project_id]/chat/[chat_id]/page.tsx @@ -159,7 +159,7 @@ export default function Chat( }, [autoPlayIndex]); return ( -
+
{chat?.chats?.map((message, i) => ( { return API.projects.list({ offset: pageParam, @@ -29,13 +29,15 @@ export default function Page() {

Projects

-
- ))} +
+ File +
+ + + +
+ ); + })} {has_new_document && (
{" "} - {document.file.name} + {document?.file?.name} {" "} +
{chat ? ( <> -
+
)} -
+
setValue(value)} diff --git a/src/app/(main)/layout-client.tsx b/src/app/(main)/layout-client.tsx index 1422a022..548d931f 100644 --- a/src/app/(main)/layout-client.tsx +++ b/src/app/(main)/layout-client.tsx @@ -32,7 +32,7 @@ export default function LayoutClient() { onClick={toggleSidebar} type="button" className={`${isSidebarExpanded ? "hidden" : "block" - } absolute h-12 md:hidden items-center p-1 px-3 z-10 ml-3 text-sm text-gray-500 rounded-lg hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-200 dark:focus:ring-gray-200`} + } absolute h-12 md:hidden items-center p-1 px-3 z-10 ml-3 text-sm text-gray-500 rounded-lg hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-secondaryActive dark:text-gray-400 dark:hover:bg-secondaryActive dark:focus:ring-secondaryActive`} > Open sidebar
diff --git a/src/app/(main)/layout.tsx b/src/app/(main)/layout.tsx index dc334a61..fd6d7fd3 100644 --- a/src/app/(main)/layout.tsx +++ b/src/app/(main)/layout.tsx @@ -6,7 +6,7 @@ export default function Layout({ children }: { children: React.ReactNode }) {
{children} diff --git a/src/app/(main)/profile/page.tsx b/src/app/(main)/profile/page.tsx index 63bd6763..e97073ea 100644 --- a/src/app/(main)/profile/page.tsx +++ b/src/app/(main)/profile/page.tsx @@ -86,7 +86,7 @@ export default function Page() { setShowPassword((prev) => !prev)} > setShowConfirmPassword((prev) => !prev)} >
diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index 77184fb8..e1e631d6 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -29,17 +29,15 @@ export default function Page() {

Projects

@@ -48,7 +46,7 @@ export default function Page() {
New Project @@ -58,11 +56,11 @@ export default function Page() { {project.title} {project.is_default && ( - + Default )} @@ -71,9 +69,8 @@ export default function Page() { )}