diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx
index 052a9643..4e7ec094 100644
--- a/frontend/src/Navigation.tsx
+++ b/frontend/src/Navigation.tsx
@@ -6,6 +6,7 @@ import { NavLink, useNavigate } from 'react-router-dom';
import conversationService from './api/services/conversationService';
import userService from './api/services/userService';
import Add from './assets/add.svg';
+import openNewChat from './assets/openNewChat.svg';
import DocsGPT3 from './assets/cute_docsgpt3.svg';
import Discord from './assets/discord.svg';
import Expand from './assets/expand.svg';
@@ -164,7 +165,12 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
}),
);
};
-
+ const newChat = () => {
+ if (conversations && conversations?.length > 0) {
+ resetConversation();
+ navigate('/');
+ }
+ };
async function updateConversationName(updatedConversation: {
name: string;
id: string;
@@ -200,26 +206,40 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
return (
<>
{!navOpen && (
-
+
+
+
+

{
+ newChat();
+ }}
+ />
+
+ DocsGPT
+
+
+
)}
-
+
+
+
DocsGPT
+
+
+
+
diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx
index fb819922..92ae0a4a 100644
--- a/frontend/src/conversation/Conversation.tsx
+++ b/frontend/src/conversation/Conversation.tsx
@@ -1,7 +1,7 @@
import { Fragment, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
-
+import newChatIcon from '../assets/openNewChat.svg';
import ArrowDown from '../assets/arrow-down.svg';
import Send from '../assets/send.svg';
import SendDark from '../assets/send_dark.svg';
@@ -9,9 +9,11 @@ import ShareIcon from '../assets/share.svg';
import SpinnerDark from '../assets/spinner-dark.svg';
import Spinner from '../assets/spinner.svg';
import RetryIcon from '../components/RetryIcon';
+import { useNavigate } from 'react-router-dom';
import Hero from '../Hero';
import { useDarkTheme, useMediaQuery } from '../hooks';
import { ShareConversationModal } from '../modals/ShareConversationModal';
+import { setConversation, updateConversationId } from './conversationSlice';
import { selectConversationId } from '../preferences/preferenceSlice';
import { AppDispatch } from '../store';
import ConversationBubble from './ConversationBubble';
@@ -27,6 +29,7 @@ import {
export default function Conversation() {
const queries = useSelector(selectQueries);
+ const navigate = useNavigate();
const status = useSelector(selectStatus);
const conversationId = useSelector(selectConversationId);
const dispatch = useDispatch();
@@ -120,6 +123,18 @@ export default function Conversation() {
handleInput();
}
};
+ const resetConversation = () => {
+ dispatch(setConversation([]));
+ dispatch(
+ updateConversationId({
+ query: { conversationId: null },
+ }),
+ );
+ };
+ const newChat = () => {
+ resetConversation();
+ navigate('/');
+ };
const prepResponseView = (query: Query, index: number) => {
let responseView;
@@ -197,23 +212,41 @@ export default function Conversation() {
};
}, []);
return (
-
+
{conversationId && (
- <>
+
{' '}
-
+
+ {isMobile && (
+
+ )}
+
+
+
{isShareModalOpen && (
{
@@ -222,7 +255,7 @@ export default function Conversation() {
conversationId={conversationId}
/>
)}
- >
+
)}