-
- {t('apiKey.inputLabel', { ns: 'api' })}
+ {apiKey && apiKey.length > 0 ? (
+
+
+ API Key Set
+
+
-
{
- _setApiKey(e.target.value);
- }}
- />
-
-
+ ) : (
+
+
+ {t('apiKey.inputLabel', { ns: 'api' })}
+
+
{
+ _setApiKey(e.target.value);
+ }}
+ />
+
+ )}
{
return config ? (
<>
{
setIsModalOpen(true);
}}
diff --git a/src/components/Chat/ChatContent/Message/View/EditView.tsx b/src/components/Chat/ChatContent/Message/View/EditView.tsx
index e0d9503e2..d4b28c8f8 100644
--- a/src/components/Chat/ChatContent/Message/View/EditView.tsx
+++ b/src/components/Chat/ChatContent/Message/View/EditView.tsx
@@ -14,7 +14,7 @@ const EditView = ({
content,
setIsEdit,
messageIndex,
- sticky,
+ sticky
}: {
content: string;
setIsEdit: React.Dispatch
>;
@@ -28,6 +28,7 @@ const EditView = ({
const [_content, _setContent] = useState(content);
const [isModalOpen, setIsModalOpen] = useState(false);
const textareaRef = React.createRef();
+ const bufferRef = React.createRef();
const { t } = useTranslation();
@@ -105,18 +106,23 @@ const EditView = ({
handleSubmit();
};
- useEffect(() => {
- if (textareaRef.current) {
- textareaRef.current.style.height = 'auto';
- textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;
+ const adjustTextareaHeight = () => {
+ if (textareaRef.current && bufferRef.current) {
+ const textarea = textareaRef.current;
+ const buffer = bufferRef.current;
+
+ buffer.style.height = 'auto';
+ buffer.style.height = buffer.scrollHeight + 'px';
+ textarea.style.height = buffer.scrollHeight + 'px';
}
+ };
+
+ useEffect(() => {
+ adjustTextareaHeight();
}, [_content]);
useEffect(() => {
- if (textareaRef.current) {
- textareaRef.current.style.height = 'auto';
- textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;
- }
+ adjustTextareaHeight();
}, []);
return (
@@ -128,6 +134,7 @@ const EditView = ({
: ''
}`}
>
+
+
+
{
const { t } = useTranslation();
@@ -51,6 +52,7 @@ const SettingsMenu = () => {
+
diff --git a/src/components/SettingsMenu/ShareGPTToggle.tsx b/src/components/SettingsMenu/ShareGPTToggle.tsx
new file mode 100644
index 000000000..cfbd92202
--- /dev/null
+++ b/src/components/SettingsMenu/ShareGPTToggle.tsx
@@ -0,0 +1,28 @@
+import React, { useEffect, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import useStore from '@store/store';
+import Toggle from '@components/Toggle';
+
+const ShareGPTToggle = () => {
+ const { t } = useTranslation();
+
+ const setShareGPT = useStore((state) => state.setShareGPT);
+
+ const [isChecked, setIsChecked] = useState
(
+ useStore.getState().shareGPT
+ );
+
+ useEffect(() => {
+ setShareGPT(isChecked);
+ }, [isChecked]);
+
+ return (
+
+ );
+};
+
+export default ShareGPTToggle;
diff --git a/src/components/ShareGPT/ShareGPT.tsx b/src/components/ShareGPT/ShareGPT.tsx
index f9b4cc8ce..f300a95e8 100644
--- a/src/components/ShareGPT/ShareGPT.tsx
+++ b/src/components/ShareGPT/ShareGPT.tsx
@@ -9,6 +9,7 @@ import { ShareGPTSubmitBodyInterface } from '@type/api';
const ShareGPT = React.memo(() => {
const { t } = useTranslation();
const [isModalOpen, setIsModalOpen] = useState(false);
+ const isAvailable = useStore((state) => state.shareGPT);
const handleConfirm = async () => {
const chats = useStore.getState().chats;
@@ -40,7 +41,7 @@ const ShareGPT = React.memo(() => {
return (
<>
-
+ ) }
{isModalOpen && (
void;
setTheme: (theme: Theme) => void;
setAutoTitle: (autoTitle: boolean) => void;
+ setShareGPT: (autoTitle: boolean) => void;
setAdvancedMode: (advancedMode: boolean) => void;
setDefaultChatConfig: (defaultChatConfig: ConfigInterface) => void;
setDefaultSystemMessage: (defaultSystemMessage: string) => void;
@@ -38,6 +40,7 @@ export const createConfigSlice: StoreSlice = (set, get) => ({
hideMenuOptions: false,
hideSideMenu: false,
autoTitle: false,
+ shareGPT: false,
enterToSubmit: true,
advancedMode: true,
defaultChatConfig: _defaultChatConfig,
@@ -64,6 +67,12 @@ export const createConfigSlice: StoreSlice = (set, get) => ({
autoTitle: autoTitle,
}));
},
+ setShareGPT: (shareGPT: boolean) => {
+ set((prev: ConfigSlice) => ({
+ ...prev,
+ shareGPT: shareGPT,
+ }));
+ },
setAdvancedMode: (advancedMode: boolean) => {
set((prev: ConfigSlice) => ({
...prev,
diff --git a/src/store/store.ts b/src/store/store.ts
index 69aba7de0..c29c49077 100644
--- a/src/store/store.ts
+++ b/src/store/store.ts
@@ -46,6 +46,7 @@ export const createPartializedState = (state: StoreState) => ({
apiEndpoint: state.apiEndpoint,
theme: state.theme,
autoTitle: state.autoTitle,
+ shareGPT: state.shareGPT,
advancedMode: state.advancedMode,
prompts: state.prompts,
defaultChatConfig: state.defaultChatConfig,