diff --git a/apps/web/app/(auth)/signin/page.tsx b/apps/web/app/(auth)/signin/page.tsx index 3db512ae..ab965325 100644 --- a/apps/web/app/(auth)/signin/page.tsx +++ b/apps/web/app/(auth)/signin/page.tsx @@ -64,7 +64,7 @@ async function Signin({ action={async () => { "use server"; await signIn("google", { - redirectTo: "/home?firstTime=true", + redirectTo: "/onboarding", }); }} > diff --git a/apps/web/app/(dash)/chat/chatWindow.tsx b/apps/web/app/(dash)/chat/chatWindow.tsx index f0827a3d..066e7d20 100644 --- a/apps/web/app/(dash)/chat/chatWindow.tsx +++ b/apps/web/app/(dash)/chat/chatWindow.tsx @@ -2,7 +2,7 @@ import { AnimatePresence } from "framer-motion"; import React, { useEffect, useRef, useState } from "react"; -import QueryInput from "../home/queryinput"; +import QueryInput from "./queryinput"; import { cn } from "@repo/ui/lib/utils"; import { motion } from "framer-motion"; import { useRouter } from "next/navigation"; @@ -224,9 +224,73 @@ function ChatWindow({ {chat.question} -
+
+ {/* Related memories */} +
0 || chat.answer.parts.length === 0 ? "flex" : "hidden"}`} + > + + + + Related Memories + + {/* TODO: fade out content on the right side, the fade goes away when the user scrolls */} + + {/* Loading state */} + {chat.answer.sources.length > 0 || + (chat.answer.parts.length === 0 && ( + <> + {[1, 2, 3, 4].map((_, idx) => ( +
+
+
+
+ ))} + + ))} + {chat.answer.sources.map((source, idx) => ( + +
+ {source.type} + + {source.numChunks > 1 && ( + {source.numChunks} chunks + )} +
+
+ {source.title} +
+
+ {source.content.length > 100 + ? source.content.slice(0, 100) + "..." + : source.content} +
+ + ))} +
+
+
+
+ + {/* Summary */}
-
Answer
+
Summary
{/* Loading state */} {(chat.answer.parts.length === 0 || @@ -283,108 +347,60 @@ function ChatWindow({ > +
- -
0 || chat.answer.parts.length === 0 ? "flex" : "hidden"}`} - > - - - - Related Memories - - {/* TODO: fade out content on the right side, the fade goes away when the user scrolls */} - 0 ? "flex" : "hidden"}`} + > + -
- {/* Loading state */} - {chat.answer.sources.length > 0 || - (chat.answer.parts.length === 0 && ( - <> - {[1, 2, 3, 4].map((_, idx) => ( -
-
-
-
- ))} - - ))} - {chat.answer.sources.map((source, idx) => ( - -
- {source.type} - - {source.numChunks > 1 && ( - {source.numChunks} chunks - )} -
-
- {source.title} -
-
- {source.content.length > 100 - ? source.content.slice(0, 100) + "..." - : source.content} -
- - ))} -
- - {chat.answer.justification && - chat.answer.justification.length && ( -
0 ? "flex" : "hidden"}`} - > - - - - Justification - - - {chat.answer.justification.length > 0 - ? chat.answer.justification - .replaceAll( - "", - "", - ) - .replaceAll( - "", - "", - ) - : "No justification provided."} - - - -
- )} -
-
-
-
+ + + Justification + + + {chat.answer.justification.length > 0 + ? chat.answer.justification + .replaceAll("", "") + .replaceAll("", "") + : "No justification provided."} + + + +
+ )} diff --git a/apps/web/app/(dash)/chat/queryinput.tsx b/apps/web/app/(dash)/chat/queryinput.tsx new file mode 100644 index 00000000..99f55986 --- /dev/null +++ b/apps/web/app/(dash)/chat/queryinput.tsx @@ -0,0 +1,83 @@ +"use client"; + +import { ArrowRightIcon } from "@repo/ui/icons"; +import Image from "next/image"; +import React, { useState } from "react"; + +function QueryInput({ + initialSpaces, + initialQuery = "", + disabled = false, + className, + mini = false, + handleSubmit, +}: { + initialQuery?: string; + initialSpaces?: { + id: number; + name: string; + }[]; + disabled?: boolean; + className?: string; + mini?: boolean; + handleSubmit: (q: string, spaces: { id: number; name: string }[]) => void; +}) { + const [q, setQ] = useState(initialQuery); + + const [selectedSpaces, setSelectedSpaces] = useState< + { id: number; name: string }[] + >([]); + + return ( +
+
+ {/* input and action button */} +
{ + if (q.trim().length === 0) { + return; + } + handleSubmit(q, selectedSpaces); + setQ(""); + }} + className="flex gap-4 p-3" + > +