eslint fixes

This commit is contained in:
Cogent Apps
2023-03-09 11:50:57 -08:00
committed by GitHub
parent d9aa5aefbe
commit 7c5ffbbac7
13 changed files with 47 additions and 51 deletions

View File

@@ -158,7 +158,7 @@ export default function Header(props: HeaderProps) {
Share
</HeaderButton>}
{backend && !context.authenticated && (
<HeaderButton onClick={() => backend?.signIn()}>Sign in <span className="hide-on-mobile">to sync</span></HeaderButton>
<HeaderButton onClick={() => backend.current?.signIn()}>Sign in <span className="hide-on-mobile">to sync</span></HeaderButton>
)}
<HeaderButton icon="plus" onClick={onNewChat} loading={loading} variant="light">
New Chat

View File

@@ -45,13 +45,13 @@ export default function MessageInput(props: MessageInputProps) {
const onChange = useCallback((e: React.ChangeEvent<HTMLTextAreaElement>) => {
context.setMessage(e.target.value);
}, [context.setMessage]);
}, [context]);
const onSubmit = useCallback(async () => {
if (await context.onNewMessage(context.message)) {
context.setMessage('');
}
}, [context.message, context.onNewMessage, context.setMessage]);
}, [context]);
const onKeyDown = useCallback((e: React.KeyboardEvent<HTMLTextAreaElement>) => {
if (e.key === 'Enter' && e.shiftKey === false && !props.disabled) {
@@ -71,8 +71,8 @@ export default function MessageInput(props: MessageInputProps) {
);
}, [onSubmit, props.disabled]);
const openSystemPromptPanel = useCallback(() => context.settings.open('options', 'system-prompt'), []);
const openTemperaturePanel = useCallback(() => context.settings.open('options', 'temperature'), []);
const openSystemPromptPanel = useCallback(() => context.settings.open('options', 'system-prompt'), [context.settings]);
const openTemperaturePanel = useCallback(() => context.settings.open('options', 'temperature'), [context.settings]);
const messagesToDisplay = context.currentChat.messagesToDisplay;
const disabled = context.generating

View File

@@ -54,7 +54,7 @@ export default function ChatPage(props: any) {
container?.scrollTo({ top: offset, behavior: 'smooth' });
}, 500);
}
}, [context.currentChat?.chatLoadedAt, context.currentChat?.messagesToDisplay.length]);
}, [context.currentChat?.chatLoadedAt, context.currentChat?.messagesToDisplay.length, props.share]);
const messagesToDisplay = context.currentChat.messagesToDisplay;
@@ -67,7 +67,7 @@ export default function ChatPage(props: any) {
title: (id && messagesToDisplay.length) ? context.currentChat.chat?.title : null,
onShare: async () => {
if (context.currentChat.chat) {
const id = await backend?.shareChat(context.currentChat.chat);
const id = await backend.current?.shareChat(context.currentChat.chat);
if (id) {
const slug = context.currentChat.chat.title
? '/' + slugify(context.currentChat.chat.title.toLocaleLowerCase())

View File

@@ -1,7 +1,5 @@
import styled from '@emotion/styled';
import { Button } from '@mantine/core';
import MessageInput from '../input';
import SettingsDrawer from '../settings';
import { useAppContext } from '../../context';
import { Page } from '../page';

View File

@@ -167,7 +167,7 @@ export default function SettingsDrawer(props: SettingsDrawerProps) {
setParameters({ ...parameters, apiKey: event.currentTarget.value });
context.apiKeys.setOpenAIApiKey(event.currentTarget.value);
}} />
<p><a href="https://platform.openai.com/account/api-keys" target="_blank">Find your API key here.</a> Your API key is stored only on this device and never transmitted to anyone except OpenAI.</p>
<p><a href="https://platform.openai.com/account/api-keys" target="_blank" rel="noreferrer">Find your API key here.</a> Your API key is stored only on this device and never transmitted to anyone except OpenAI.</p>
<p>OpenAI API key usage is billed at a pay-as-you-go rate, separate from your ChatGPT subscription.</p>
</section>
</Grid.Col>
@@ -211,7 +211,7 @@ export default function SettingsDrawer(props: SettingsDrawerProps) {
<section className={context.settings.option === 'elevenlabs-api-key' ? 'focused' : ''}>
<h3>Your ElevenLabs Text-to-Speech API Key (optional)</h3>
<TextInput placeholder="Paste your API key here" value={context.apiKeys.elevenlabs || ''} onChange={event => context.apiKeys.setElevenLabsApiKey(event.currentTarget.value)} />
<p>Give ChatGPT a realisic human voice by connecting your ElevenLabs account (preview the available voices below). <a href="https://beta.elevenlabs.io" target="_blank">Click here to sign up.</a></p>
<p>Give ChatGPT a realisic human voice by connecting your ElevenLabs account (preview the available voices below). <a href="https://beta.elevenlabs.io" target="_blank" rel="noreferrer">Click here to sign up.</a></p>
<p>You can find your API key by clicking your avatar or initials in the top right of the ElevenLabs website, then clicking Profile. Your API key is stored only on this device and never transmitted to anyone except ElevenLabs.</p>
</section>
</Grid.Col>