update strings

This commit is contained in:
Cogent Apps
2023-03-16 19:06:29 +00:00
parent 210cca9a44
commit b216cf2900
8 changed files with 59 additions and 113 deletions

View File

@@ -1,6 +1,7 @@
import styled from "@emotion/styled";
import { Button, Modal, PasswordInput, TextInput } from "@mantine/core";
import { useCallback, useState } from "react";
import { FormattedMessage, useIntl } from "react-intl";
import { useAppDispatch, useAppSelector } from "../../store";
import { closeModals, openLoginModal, openSignupModal, selectModal } from "../../store/ui";
@@ -35,6 +36,7 @@ const Container = styled.form`
export function LoginModal(props: any) {
const modal = useAppSelector(selectModal);
const dispatch = useAppDispatch();
const intl = useIntl();
const onClose = useCallback(() => dispatch(closeModals()), [dispatch]);
const onCreateAccountClick = useCallback(() => dispatch(openSignupModal()), [dispatch]);
@@ -42,24 +44,26 @@ export function LoginModal(props: any) {
return <Modal opened={modal === 'login'} onClose={onClose} withCloseButton={false}>
<Container action="/chatapi/login" method="post">
<h2>
Sign in
<FormattedMessage defaultMessage={"Sign in"} />
</h2>
<input type="hidden" name="redirect_url" value={window.location.href} />
<TextInput label="Email address"
<TextInput
label={intl.formatMessage({ defaultMessage: "Email address" })}
name="username"
placeholder="Enter your email address"
placeholder={intl.formatMessage({ defaultMessage: "Enter your email address" })}
type="email"
required />
<PasswordInput label="Password"
<PasswordInput
label={intl.formatMessage({ defaultMessage: "Password" })}
name="password"
placeholder="Enter your password"
placeholder={intl.formatMessage({ defaultMessage: "Enter your password" })}
maxLength={500}
required />
<Button fullWidth type="submit">
Sign in
<FormattedMessage defaultMessage={"Sign in"} />
</Button>
<Button fullWidth variant="subtle" onClick={onCreateAccountClick}>
Or create an account
<FormattedMessage defaultMessage={"Or create an account"} />
</Button>
</Container>
</Modal>
@@ -68,6 +72,7 @@ export function LoginModal(props: any) {
export function CreateAccountModal(props: any) {
const modal = useAppSelector(selectModal);
const dispatch = useAppDispatch();
const intl = useIntl();
const onClose = useCallback(() => dispatch(closeModals()), [dispatch]);
const onSignInClick = useCallback(() => dispatch(openLoginModal()), [dispatch]);
@@ -75,25 +80,27 @@ export function CreateAccountModal(props: any) {
return <Modal opened={modal === 'signup'} onClose={onClose} withCloseButton={false}>
<Container action="/chatapi/register" method="post">
<h2>
Create an account
<FormattedMessage defaultMessage={"Create an account"} />
</h2>
<input type="hidden" name="redirect_url" value={window.location.href} />
<TextInput label="Email address"
<TextInput
label={intl.formatMessage({ defaultMessage: "Email address" })}
name="username"
placeholder="Enter your email address"
placeholder={intl.formatMessage({ defaultMessage: "Enter your email address" })}
type="email"
required />
<PasswordInput label="Password"
<PasswordInput
label={intl.formatMessage({ defaultMessage: "Password" })}
name="password"
placeholder="Enter your password"
placeholder={intl.formatMessage({ defaultMessage: "Enter your password" })}
minLength={6}
maxLength={500}
required />
<Button fullWidth type="submit">
Sign up
<FormattedMessage defaultMessage={"Sign up"} />
</Button>
<Button fullWidth variant="subtle" onClick={onSignInClick}>
Or sign in to an existing account
<FormattedMessage defaultMessage={"Or sign in to an existing account"} />
</Button>
</Container>
</Modal>

View File

@@ -1,79 +0,0 @@
import styled from "@emotion/styled";
import { Markdown } from "../markdown";
import { Page } from "../page";
const title = "Learn about Chat with GPT";
const content = `
# About Chat with GPT
Chat with GPT is an open-source, unofficial ChatGPT app with extra features and more ways to customize your experience.
ChatGPT is an AI assistant developed by OpenAI. It's designed to understand natural language and generate human-like responses to a wide range of questions and prompts. ChatGPT has been trained on a massive dataset of text from the internet, which allows it to draw on a vast amount of knowledge and information to answer questions and engage in conversation. ChatGPT is constantly being improved. Feel free to ask it anything!
[Join the Discord.](https://discord.gg/mS5QvKykvv)
## Features
- 🚀 **Fast** response times.
- 🔎 **Search** through your past chat conversations.
- 📄 View and customize the System Prompt - the **secret prompt** the system shows the AI before your messages.
- 🌡 Adjust the **creativity and randomness** of responses by setting the Temperature setting. Higher temperature means more creativity.
- 💬 Give ChatGPT AI a **realistic human voice** by connecting your ElevenLabs text-to-speech account.
- ✉ **Share** your favorite chat sessions online using public share URLs.
- 📋 Easily **copy-and-paste** ChatGPT messages.
- 🖼 **Full markdown support** including code, tables, and math.
- 🫰 Pay for only what you use with the ChatGPT API.
## Bring your own API keys
### OpenAI
To get started with Chat with GPT, you will need to add your OpenAI API key on the settings screen. Click "Connect your OpenAI account to get started" on the home page to begin. Once you have added your API key, you can start chatting with ChatGPT.
Your API key is stored only on your device and is never transmitted to anyone except OpenAI. Please note that OpenAI API key usage is billed at a pay-as-you-go rate, separate from your ChatGPT subscription.
### ElevenLabs
To use the realistic AI text-to-speech feature, you will need to add your ElevenLabs API key by clicking "Play" next to any message.
Your API key is stored only on your device and never transmitted to anyone except ElevenLabs.
## Roadmap
- Edit messages (coming soon)
- Regenerate messages (coming soon)
- [Suggest feature ideas on the Discord](https://discord.gg/mS5QvKykvv)
`;
const Container = styled.div`
flex-grow: 1;
overflow-y: auto;
padding-top: 2rem;
padding-bottom: 3rem;
.inner {
max-width: 50rem;
margin-left: auto;
margin-right: auto;
font-weight: "Work Sans", sans-serif;
* {
color: white !important;
}
h1, h2 {
border-bottom: thin solid rgba(255, 255, 255, 0.2);
padding-bottom: 1rem;
margin-bottom: 1rem;
}
}
`;
export default function AboutPage(props: any) {
return <Page id={'about'} headerProps={{ title }}>
<Container>
<Markdown content={content} className='inner' />
</Container>
</Page>;
}

View File

@@ -7,6 +7,7 @@ import GenerationOptionsTab from './options';
import { useAppDispatch, useAppSelector } from '../../store';
import { closeSettingsUI, selectSettingsTab, setTab } from '../../store/settings-ui';
import SpeechOptionsTab from './speech';
import { FormattedMessage } from 'react-intl';
const Container = styled.div`
padding: .4rem 1rem 1rem 1rem;
@@ -102,7 +103,7 @@ export default function SettingsDrawer(props: SettingsDrawerProps) {
</Tabs>
<div id="save">
<Button variant="light" fullWidth size="md" onClick={close}>
Save and Close
<FormattedMessage defaultMessage={"Save and Close"} />
</Button>
</div>
</Container>

View File

@@ -54,8 +54,14 @@ export default function GenerationOptionsTab(props: any) {
<Select
value={model || defaultModel}
data={[
{ label: "GPT 3.5 Turbo (default)", value: "gpt-3.5-turbo" },
{ label: "GPT 4 (requires invite)", value: "gpt-4" },
{
label: intl.formatMessage({ defaultMessage: "GPT 3.5 Turbo (default)" }),
value: "gpt-3.5-turbo",
},
{
label: intl.formatMessage({ defaultMessage: "GPT 4 (requires invite)" }),
value: "gpt-4",
},
]}
onChange={onModelChange} />
{model === 'gpt-4' && (

View File

@@ -2,7 +2,7 @@ import styled from '@emotion/styled';
import { ActionIcon, Avatar, Burger, Button, Menu } from '@mantine/core';
import { useElementSize } from '@mantine/hooks';
import { useCallback, useMemo } from 'react';
import { useIntl } from 'react-intl';
import { FormattedMessage, useIntl } from 'react-intl';
import { backend } from '../../backend';
import { useAppContext } from '../../context';
import { useAppDispatch, useAppSelector } from '../../store';
@@ -115,7 +115,7 @@ export default function Sidebar(props: {
const elem = useMemo(() => (
<Container className={"sidebar " + (sidebarOpen ? 'opened' : 'closed')} ref={ref}>
<div className="sidebar-header">
<h2>Chat History</h2>
<h2><FormattedMessage defaultMessage={"Chat History"} /></h2>
<Burger opened={sidebarOpen} onClick={onBurgerClick} aria-label={burgerLabel} transitionDuration={0} />
</div>
<div className="sidebar-content">
@@ -141,12 +141,12 @@ export default function Sidebar(props: {
<Menu.Item onClick={() => {
dispatch(setTab('user'));
}} icon={<i className="fas fa-gear" />}>
User settings
<FormattedMessage defaultMessage={"User settings"} />
</Menu.Item>
{/*
<Menu.Divider />
<Menu.Item color="red" onClick={() => backend.current?.logout()} icon={<i className="fas fa-sign-out-alt" />}>
Sign out
<FormattedMessage defaultMessage={"Sign out"} />
</Menu.Item>
*/}
</Menu.Dropdown>

View File

@@ -1,5 +1,6 @@
import styled from '@emotion/styled';
import { useCallback, useEffect } from 'react';
import { FormattedMessage } from 'react-intl';
import { Link } from 'react-router-dom';
import { useAppContext } from '../../context';
import { useAppDispatch } from '../../store';
@@ -83,12 +84,12 @@ export default function RecentChats(props: any) {
onClick={onClick}
data-chat-id={c.chatID}
className={c.chatID === currentChatID ? 'selected' : ''}>
<strong>{c.title || 'Untitled'}</strong>
<strong>{c.title || <FormattedMessage defaultMessage={"Untitled"} />}</strong>
</ChatListItem>
))}
</ChatList>}
{recentChats.length === 0 && <Empty>
No chats yet.
<FormattedMessage defaultMessage={"No chats yet."} />
</Empty>}
</Container>
);