diff --git a/src/interface/web/.eslintrc.json b/src/interface/web/.eslintrc.json index bffb357a..2324a052 100644 --- a/src/interface/web/.eslintrc.json +++ b/src/interface/web/.eslintrc.json @@ -1,3 +1,11 @@ { - "extends": "next/core-web-vitals" + "extends": [ + "next", + "next/core-web-vitals", + "plugin:prettier/recommended" + ], + "plugins": ["prettier"], + "rules": { + "prettier/prettier": "error" + } } diff --git a/src/interface/web/.husky/pre-commit b/src/interface/web/.husky/pre-commit new file mode 100644 index 00000000..053576eb --- /dev/null +++ b/src/interface/web/.husky/pre-commit @@ -0,0 +1,5 @@ +#!/usr/bin/env sh +. "$(dirname "$0")/_/husky.sh" + +yarn run lint-staged +yarn test diff --git a/src/interface/web/app/chat/page.tsx b/src/interface/web/app/chat/page.tsx index ac641d6a..325cf4f0 100644 --- a/src/interface/web/app/chat/page.tsx +++ b/src/interface/web/app/chat/page.tsx @@ -33,7 +33,6 @@ interface ChatBodyDataProps { isLoggedIn: boolean; } - function ChatBodyData(props: ChatBodyDataProps) { const searchParams = useSearchParams(); const conversationId = searchParams.get('conversationId'); @@ -119,10 +118,8 @@ export default function Chat() { welcomeConsole(); - const handleWebSocketMessage = (event: MessageEvent) => { let chunk = event.data; - let currentMessage = messages.find(message => !message.completed); if (!currentMessage) { @@ -165,7 +162,6 @@ export default function Chat() { } finally { // no-op } - } else { // Update the current message with the new chunk if (chunk && chunk.includes("### compiled references:")) { @@ -179,7 +175,6 @@ export default function Chat() { // If the chunk is not a JSON object, just display it as is currentMessage.rawResponse += chunk; } - } }; // Update the state with the new message, currentMessage @@ -269,7 +264,9 @@ export default function Chat() { + uploadedFiles={uploadedFiles} + isMobileWidth={isMobileWidth} + />
diff --git a/src/interface/web/app/components/chatHistory/chatHistory.module.css b/src/interface/web/app/components/chatHistory/chatHistory.module.css index 984fb922..c379460b 100644 --- a/src/interface/web/app/components/chatHistory/chatHistory.module.css +++ b/src/interface/web/app/components/chatHistory/chatHistory.module.css @@ -17,14 +17,10 @@ div.agentIndicator a { align-items: center; } -div.agentIndicator { - padding: 10px; -} - div.trainOfThought { border: 1px var(--border-color) solid; border-radius: 16px; - padding: 16px; + padding: 0 16px; margin: 12px; box-shadow: 0 4px 10px var(--box-shadow-color); } diff --git a/src/interface/web/app/components/chatHistory/chatHistory.tsx b/src/interface/web/app/components/chatHistory/chatHistory.tsx index 8d02c086..f4bd1c98 100644 --- a/src/interface/web/app/components/chatHistory/chatHistory.tsx +++ b/src/interface/web/app/components/chatHistory/chatHistory.tsx @@ -10,10 +10,12 @@ import { ScrollArea } from "@/components/ui/scroll-area" import renderMathInElement from 'katex/contrib/auto-render'; import 'katex/dist/katex.min.css'; -import Loading, { InlineLoading } from '../loading/loading'; +import { InlineLoading } from '../loading/loading'; import { Lightbulb } from "@phosphor-icons/react"; +import ProfileCard from '../profileCard/profileCard'; + interface ChatResponse { status: string; response: ChatHistoryData; @@ -231,6 +233,10 @@ export default function ChatHistory(props: ChatHistoryProps) { return data.agent.name; } + function constructAgentPersona() { + if (!data || !data.agent || !data.agent.persona) return ``; + return data.agent.persona; + } if (!props.conversationId && !props.publicConversationSlug) { return null; @@ -241,7 +247,7 @@ export default function ChatHistory(props: ChatHistoryProps) {
- {fetchingData && } + {fetchingData && }
{(data && data.chat) && data.chat.map((chatMessage, index) => ( ))} { @@ -270,7 +277,8 @@ export default function ChatHistory(props: ChatHistoryProps) { } } customClassName='fullHistory' - borderLeftColor='orange-500' /> + borderLeftColor='orange-500' + /> { message.trainOfThought && constructTrainOfThought( @@ -294,6 +302,7 @@ export default function ChatHistory(props: ChatHistoryProps) { } customClassName='fullHistory' borderLeftColor='orange-500' + isLastMessage={true} /> ) @@ -316,14 +325,21 @@ export default function ChatHistory(props: ChatHistoryProps) { } customClassName='fullHistory' borderLeftColor='orange-500' + isLastMessage={true} /> } - + {data && +
+
+ } + description={constructAgentPersona()} + /> +
+
+ }
diff --git a/src/interface/web/app/components/chatInputArea/chatInputArea.tsx b/src/interface/web/app/components/chatInputArea/chatInputArea.tsx index 760301d9..e2b59848 100644 --- a/src/interface/web/app/components/chatInputArea/chatInputArea.tsx +++ b/src/interface/web/app/components/chatInputArea/chatInputArea.tsx @@ -133,42 +133,43 @@ export default function ChatInputArea(props: ChatInputProps) { } function getIconForSlashCommand(command: string) { + const className = 'h-4 w-4 mr-2'; if (command.includes('summarize')) { - return + return } if (command.includes('help')) { - return + return } if (command.includes('automation')) { - return + return } if (command.includes('webpage')) { - return + return } if (command.includes('notes')) { - return + return } if (command.includes('image')) { - return + return } if (command.includes('default')) { - return + return } if (command.includes('general')) { - return + return } if (command.includes('online')) { - return + return } - return + return } return ( @@ -270,7 +271,6 @@ export default function ChatInputArea(props: ChatInputProps) {
}
-