From 7c0027ffcdfb2a6930e64674666b73f98177b11f Mon Sep 17 00:00:00 2001 From: "[witbox2018]" <103164430@qq.com> Date: Thu, 6 Apr 2023 17:07:36 +0800 Subject: [PATCH] 4 --- app/components/button.module.scss | 1 + app/components/chat.tsx | 259 +- app/components/home.module.scss | 190 +- app/components/home.tsx | 22 +- app/icons/chatgpt1.svg | 48 + app/icons/logo.png | Bin 0 -> 5573 bytes app/styles/globals.scss | 74 +- app/styles/markdown.scss | 34 +- package-lock.json | 8095 +++++++++++++++++++++++++++++ package.json | 1 + yarn.lock | 1547 +++--- 11 files changed, 9222 insertions(+), 1049 deletions(-) create mode 100644 app/icons/chatgpt1.svg create mode 100644 app/icons/logo.png create mode 100644 package-lock.json diff --git a/app/components/button.module.scss b/app/components/button.module.scss index 88da97481..167c008c9 100644 --- a/app/components/button.module.scss +++ b/app/components/button.module.scss @@ -30,6 +30,7 @@ display: flex; justify-content: center; align-items: center; + color: aqua; } @media only screen and (max-width: 600px) { diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 90c88d97b..9f53e3bfc 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -1,5 +1,6 @@ import { useDebouncedCallback } from "use-debounce"; import { memo, useState, useRef, useEffect, useLayoutEffect } from "react"; +import TextareaAutosize from "react-textarea-autosize"; import SendWhiteIcon from "../icons/send-white.svg"; import BrainIcon from "../icons/brain.svg"; @@ -131,133 +132,133 @@ function PromptToast(props: { }); }; - return ( -
- {props.showToast && ( -
props.setShowModal(true)} - > - - - {Locale.Context.Toast(context.length)} - -
- )} - {props.showModal && ( -
- props.setShowModal(false)} - actions={[ - } - bordered - text={Locale.Memory.Reset} - onClick={() => - confirm(Locale.Memory.ResetConfirm) && - chatStore.resetSession() - } - />, - } - bordered - text={Locale.Memory.Copy} - onClick={() => copyToClipboard(session.memoryPrompt)} - />, - ]} - > - <> -
- {context.map((c, i) => ( -
- - - updateContextPrompt(i, { - ...c, - content: e.currentTarget.value as any, - }) - } - /> - } - className={chatStyle["context-delete-button"]} - onClick={() => removeContextPrompt(i)} - bordered - /> -
- ))} + // return ( + //
+ // {props.showToast && ( + //
props.setShowModal(true)} + // > + // + // + // {Locale.Context.Toast(context.length)} + // + //
+ // )} + // {props.showModal && ( + //
+ // props.setShowModal(false)} + // actions={[ + // } + // bordered + // text={Locale.Memory.Reset} + // onClick={() => + // confirm(Locale.Memory.ResetConfirm) && + // chatStore.resetSession() + // } + // />, + // } + // bordered + // text={Locale.Memory.Copy} + // onClick={() => copyToClipboard(session.memoryPrompt)} + // />, + // ]} + // > + // <> + //
+ // {context.map((c, i) => ( + //
+ // + // + // updateContextPrompt(i, { + // ...c, + // content: e.currentTarget.value as any, + // }) + // } + // /> + // } + // className={chatStyle["context-delete-button"]} + // onClick={() => removeContextPrompt(i)} + // bordered + // /> + //
+ // ))} -
- } - text={Locale.Context.Add} - bordered - className={chatStyle["context-prompt-button"]} - onClick={() => - addContextPrompt({ - role: "system", - content: "", - date: "", - }) - } - /> -
-
-
-
- - {Locale.Memory.Title} ({session.lastSummarizeIndex} of{" "} - {session.messages.length}) - + //
+ // } + // text={Locale.Context.Add} + // bordered + // className={chatStyle["context-prompt-button"]} + // onClick={() => + // addContextPrompt({ + // role: "system", + // content: "", + // date: "", + // }) + // } + // /> + //
+ //
+ //
+ //
+ // + // {Locale.Memory.Title} ({session.lastSummarizeIndex} of{" "} + // {session.messages.length}) + // - -
-
- {session.memoryPrompt || Locale.Memory.EmptyContent} -
-
- - -
- )} -
- ); + // + //
+ //
+ // {session.memoryPrompt || Locale.Memory.EmptyContent} + //
+ //
+ // + //
+ //
+ // )} + //
+ // ); } function useSubmitHandler() { @@ -590,9 +591,9 @@ export function Chat(props: { } >
-
+ {/*
-
+
*/} {(message.preview || message.streaming) && (
{Locale.Chat.Typing} @@ -659,11 +660,11 @@ export function Chat(props: {
-