From 70592f1203271f2d097a85222cc40133a8f9e4f5 Mon Sep 17 00:00:00 2001 From: Bianca Wentzel Date: Fri, 20 Sep 2024 13:57:33 +0200 Subject: [PATCH] Integrated stop button into input, added Button to start new chat --- assets/js/Containers/FrevaGPT/index.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/assets/js/Containers/FrevaGPT/index.js b/assets/js/Containers/FrevaGPT/index.js index 90ce240f..203140e9 100644 --- a/assets/js/Containers/FrevaGPT/index.js +++ b/assets/js/Containers/FrevaGPT/index.js @@ -1,5 +1,5 @@ import React, { useState, useEffect, useRef } from 'react'; -import { Container, Row, Col, FormControl, InputGroup, Card } from 'react-bootstrap'; +import { Container, Row, Col, FormControl, InputGroup, Card, Button } from 'react-bootstrap'; import { browserHistory } from "react-router"; import { isEmpty } from 'lodash'; import Markdown from 'react-markdown'; @@ -164,6 +164,16 @@ const ChatBot = () => { thread_id: thread.current, }).toString()); } + + function startNewChat() { + setConversation([]); + thread.current = ""; + browserHistory.push({ + pathname: '/chatbot/', + search: "", + }); + window.scrollTo(0, 0) + } return ( @@ -230,14 +240,16 @@ const ChatBot = () => { + {answerLoading + ? () + : null + } + - {!answerLoading - ? () - : () - } +