|
@@ -4,7 +4,7 @@ import { memo, useState, useRef, useEffect, useLayoutEffect } from "react";
|
|
|
import SendWhiteIcon from "../icons/send-white.svg";
|
|
|
import BrainIcon from "../icons/brain.svg";
|
|
|
import ExportIcon from "../icons/export.svg";
|
|
|
-import MenuIcon from "../icons/menu.svg";
|
|
|
+import ReturnIcon from "../icons/return.svg";
|
|
|
import CopyIcon from "../icons/copy.svg";
|
|
|
import DownloadIcon from "../icons/download.svg";
|
|
|
import LoadingIcon from "../icons/three-dots.svg";
|
|
@@ -404,6 +404,7 @@ export function Chat(props: {
|
|
|
|
|
|
// submit user input
|
|
|
const onUserSubmit = () => {
|
|
|
+ if (userInput.length <= 0) return;
|
|
|
setIsLoading(true);
|
|
|
chatStore.onUserInput(userInput).then(() => setIsLoading(false));
|
|
|
setUserInput("");
|
|
@@ -420,7 +421,6 @@ export function Chat(props: {
|
|
|
// check if should send message
|
|
|
const onInputKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
|
|
if (shouldSubmit(e)) {
|
|
|
- setAutoScroll(true);
|
|
|
onUserSubmit();
|
|
|
e.preventDefault();
|
|
|
}
|
|
@@ -507,13 +507,10 @@ export function Chat(props: {
|
|
|
return (
|
|
|
<div className={styles.chat} key={session.id}>
|
|
|
<div className={styles["window-header"]}>
|
|
|
- <div
|
|
|
- className={styles["window-header-title"]}
|
|
|
- onClick={props?.showSideBar}
|
|
|
- >
|
|
|
+ <div className={styles["window-header-title"]}>
|
|
|
<div
|
|
|
className={`${styles["window-header-main-title"]} ${styles["chat-body-title"]}`}
|
|
|
- onClick={() => {
|
|
|
+ onClickCapture={() => {
|
|
|
const newTopic = prompt(Locale.Chat.Rename, session.topic);
|
|
|
if (newTopic && newTopic !== session.topic) {
|
|
|
chatStore.updateCurrentSession(
|
|
@@ -531,7 +528,7 @@ export function Chat(props: {
|
|
|
<div className={styles["window-actions"]}>
|
|
|
<div className={styles["window-action-button"] + " " + styles.mobile}>
|
|
|
<IconButton
|
|
|
- icon={<MenuIcon />}
|
|
|
+ icon={<ReturnIcon />}
|
|
|
bordered
|
|
|
title={Locale.Chat.Actions.ChatList}
|
|
|
onClick={props?.showSideBar}
|
|
@@ -667,7 +664,7 @@ export function Chat(props: {
|
|
|
onInput={(e) => onInput(e.currentTarget.value)}
|
|
|
value={userInput}
|
|
|
onKeyDown={onInputKeyDown}
|
|
|
- onFocus={() => setAutoScroll(isMobileScreen())}
|
|
|
+ onFocus={() => setAutoScroll(true)}
|
|
|
onBlur={() => {
|
|
|
setAutoScroll(false);
|
|
|
setTimeout(() => setPromptHints([]), 500);
|
|
@@ -679,7 +676,6 @@ export function Chat(props: {
|
|
|
text={Locale.Chat.Send}
|
|
|
className={styles["chat-input-send"]}
|
|
|
noDark
|
|
|
- disabled={!userInput}
|
|
|
onClick={onUserSubmit}
|
|
|
/>
|
|
|
</div>
|