Skip to content

Commit

Permalink
ChatGPT Logo
Browse files Browse the repository at this point in the history
  • Loading branch information
Kivi1998 committed May 16, 2024
1 parent 01c9dbc commit bfdb47a
Show file tree
Hide file tree
Showing 8 changed files with 626 additions and 691 deletions.
54 changes: 27 additions & 27 deletions app/components/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,33 +50,33 @@ export function AuthPage() {
);
}}
/>
{!accessStore.hideUserApiKey ? (
<>
<div className={styles["auth-tips"]}>{Locale.Auth.SubTips}</div>
<input
className={styles["auth-input"]}
type="password"
placeholder={Locale.Settings.Access.OpenAI.ApiKey.Placeholder}
value={accessStore.openaiApiKey}
onChange={(e) => {
accessStore.update(
(access) => (access.openaiApiKey = e.currentTarget.value),
);
}}
/>
<input
className={styles["auth-input"]}
type="password"
placeholder={Locale.Settings.Access.Google.ApiKey.Placeholder}
value={accessStore.googleApiKey}
onChange={(e) => {
accessStore.update(
(access) => (access.googleApiKey = e.currentTarget.value),
);
}}
/>
</>
) : null}
{/*{!accessStore.hideUserApiKey ? (*/}
{/* <>*/}
{/* <div className={styles["auth-tips"]}>{Locale.Auth.SubTips}</div>*/}
{/* <input*/}
{/* className={styles["auth-input"]}*/}
{/* type="password"*/}
{/* placeholder={Locale.Settings.Access.OpenAI.ApiKey.Placeholder}*/}
{/* value={accessStore.openaiApiKey}*/}
{/* onChange={(e) => {*/}
{/* accessStore.update(*/}
{/* (access) => (access.openaiApiKey = e.currentTarget.value),*/}
{/* );*/}
{/* }}*/}
{/* />*/}
{/* <input*/}
{/* className={styles["auth-input"]}*/}
{/* type="password"*/}
{/* placeholder={Locale.Settings.Access.Google.ApiKey.Placeholder}*/}
{/* value={accessStore.googleApiKey}*/}
{/* onChange={(e) => {*/}
{/* accessStore.update(*/}
{/* (access) => (access.googleApiKey = e.currentTarget.value),*/}
{/* );*/}
{/* }}*/}
{/* />*/}
{/* </>*/}
{/*) : null}*/}

<div className={styles["auth-actions"]}>
<IconButton
Expand Down
185 changes: 92 additions & 93 deletions app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -490,79 +490,79 @@ export function ChatActions(props: {

return (
<div className={styles["chat-input-actions"]}>
{couldStop && (
<ChatAction
onClick={stopAll}
text={Locale.Chat.InputActions.Stop}
icon={<StopIcon />}
/>
)}
{!props.hitBottom && (
<ChatAction
onClick={props.scrollToBottom}
text={Locale.Chat.InputActions.ToBottom}
icon={<BottomIcon />}
/>
)}
{props.hitBottom && (
<ChatAction
onClick={props.showPromptModal}
text={Locale.Chat.InputActions.Settings}
icon={<SettingsIcon />}
/>
)}

{showUploadImage && (
<ChatAction
onClick={props.uploadImage}
text={Locale.Chat.InputActions.UploadImage}
icon={props.uploading ? <LoadingButtonIcon /> : <ImageIcon />}
/>
)}
<ChatAction
onClick={nextTheme}
text={Locale.Chat.InputActions.Theme[theme]}
icon={
<>
{theme === Theme.Auto ? (
<AutoIcon />
) : theme === Theme.Light ? (
<LightIcon />
) : theme === Theme.Dark ? (
<DarkIcon />
) : null}
</>
}
/>

<ChatAction
onClick={props.showPromptHints}
text={Locale.Chat.InputActions.Prompt}
icon={<PromptIcon />}
/>

<ChatAction
onClick={() => {
navigate(Path.Masks);
}}
text={Locale.Chat.InputActions.Masks}
icon={<MaskIcon />}
/>

<ChatAction
text={Locale.Chat.InputActions.Clear}
icon={<BreakIcon />}
onClick={() => {
chatStore.updateCurrentSession((session) => {
if (session.clearContextIndex === session.messages.length) {
session.clearContextIndex = undefined;
} else {
session.clearContextIndex = session.messages.length;
session.memoryPrompt = ""; // will clear memory
}
});
}}
/>
{/*{couldStop && (*/}
{/* <ChatAction*/}
{/* onClick={stopAll}*/}
{/* text={Locale.Chat.InputActions.Stop}*/}
{/* icon={<StopIcon />}*/}
{/* />*/}
{/*)}*/}
{/*{!props.hitBottom && (*/}
{/* <ChatAction*/}
{/* onClick={props.scrollToBottom}*/}
{/* text={Locale.Chat.InputActions.ToBottom}*/}
{/* icon={<BottomIcon />}*/}
{/* />*/}
{/*)}*/}
{/*{props.hitBottom && (*/}
{/* <ChatAction*/}
{/* onClick={props.showPromptModal}*/}
{/* text={Locale.Chat.InputActions.Settings}*/}
{/* icon={<SettingsIcon />}*/}
{/* />*/}
{/*)}*/}

{/*{showUploadImage && (*/}
{/* <ChatAction*/}
{/* onClick={props.uploadImage}*/}
{/* text={Locale.Chat.InputActions.UploadImage}*/}
{/* icon={props.uploading ? <LoadingButtonIcon /> : <ImageIcon />}*/}
{/* />*/}
{/*)}*/}
{/*<ChatAction*/}
{/* onClick={nextTheme}*/}
{/* text={Locale.Chat.InputActions.Theme[theme]}*/}
{/* icon={*/}
{/* <>*/}
{/* {theme === Theme.Auto ? (*/}
{/* <AutoIcon />*/}
{/* ) : theme === Theme.Light ? (*/}
{/* <LightIcon />*/}
{/* ) : theme === Theme.Dark ? (*/}
{/* <DarkIcon />*/}
{/* ) : null}*/}
{/* </>*/}
{/* }*/}
{/*/>*/}

{/*<ChatAction*/}
{/* onClick={props.showPromptHints}*/}
{/* text={Locale.Chat.InputActions.Prompt}*/}
{/* icon={<PromptIcon />}*/}
{/*/>*/}

{/*<ChatAction*/}
{/* onClick={() => {*/}
{/* navigate(Path.Masks);*/}
{/* }}*/}
{/* text={Locale.Chat.InputActions.Masks}*/}
{/* icon={<MaskIcon />}*/}
{/*/>*/}

{/*<ChatAction*/}
{/* text={Locale.Chat.InputActions.Clear}*/}
{/* icon={<BreakIcon />}*/}
{/* onClick={() => {*/}
{/* chatStore.updateCurrentSession((session) => {*/}
{/* if (session.clearContextIndex === session.messages.length) {*/}
{/* session.clearContextIndex = undefined;*/}
{/* } else {*/}
{/* session.clearContextIndex = session.messages.length;*/}
{/* session.memoryPrompt = ""; // will clear memory*/}
{/* }*/}
{/* });*/}
{/* }}*/}
{/*/>*/}

<ChatAction
onClick={() => setShowModelSelector(true)}
Expand Down Expand Up @@ -1088,7 +1088,6 @@ function _Chat() {
if (payload.url) {
accessStore.update((access) => (access.openaiUrl = payload.url!));
}
accessStore.update((access) => (access.useCustomConfig = true));
});
}
} catch {
Expand Down Expand Up @@ -1233,25 +1232,25 @@ function _Chat() {
</div>
</div>
<div className="window-actions">
{!isMobileScreen && (
<div className="window-action-button">
<IconButton
icon={<RenameIcon />}
bordered
onClick={() => setIsEditingMessage(true)}
/>
</div>
)}
<div className="window-action-button">
<IconButton
icon={<ExportIcon />}
bordered
title={Locale.Chat.Actions.Export}
onClick={() => {
setShowExport(true);
}}
/>
</div>
{/*{!isMobileScreen && (*/}
{/* <div className="window-action-button">*/}
{/* <IconButton*/}
{/* icon={<RenameIcon />}*/}
{/* bordered*/}
{/* onClick={() => setIsEditingMessage(true)}*/}
{/* />*/}
{/* </div>*/}
{/*)}*/}
{/*<div className="window-action-button">*/}
{/* <IconButton*/}
{/* icon={<ExportIcon />}*/}
{/* bordered*/}
{/* title={Locale.Chat.Actions.Export}*/}
{/* onClick={() => {*/}
{/* setShowExport(true);*/}
{/* }}*/}
{/* />*/}
{/*</div>*/}
{showMaxIcon && (
<div className="window-action-button">
<IconButton
Expand Down
Loading

0 comments on commit bfdb47a

Please sign in to comment.