import styled from '@emotion/styled'; import { Button, Drawer, Grid, Select, Slider, Tabs, Textarea, TextInput } from "@mantine/core"; import { useMediaQuery } from '@mantine/hooks'; import { useEffect, useState } from 'react'; import { defaultSystemPrompt } from '../openai'; import { defaultVoiceList, getVoices } from '../elevenlabs'; import { useAppContext } from '../context'; const Container = styled.div` padding: .4rem 1rem 1rem 1rem; position: absolute; top: 0; left: 0; right: 0; bottom: 0; max-width: 100vw; max-height: 100vh; @media (max-width: 40em) { padding: 0; } .mantine-Tabs-root { display: flex; flex-direction: column; height: calc(100% - 3rem); @media (max-width: 40em) { height: calc(100% - 5rem); } } .mantine-Tabs-tab { padding: 1.2rem 1.618rem 0.8rem 1.618rem; @media (max-width: 40em) { padding: 1rem; span { display: none; } } } .mantine-Tabs-panel { flex-grow: 1; overflow-y: scroll; overflow-x: hidden; min-height: 0; margin-left: 0; padding: 1.2rem 0 3rem 0; @media (max-width: 40em) { padding: 1.2rem 1rem 3rem 1rem; } } #save { position: absolute; bottom: 0; left: 0; right: 0; padding: 0 1rem 1rem 1rem; opacity: 1; .mantine-Button-root { height: 3rem; } } `; const Settings = styled.div` font-family: "Work Sans", sans-serif; color: white; section { margin-bottom: .618rem; padding: 0.618rem; h3 { font-size: 1rem; font-weight: bold; margin-bottom: 1rem; } p { line-height: 1.7; margin-top: 0.8rem; font-size: 1rem; } a { color: white; text-decoration : underline; } code { font-family: "Fira Code", monospace; } } .focused { border: thin solid rgba(255, 255, 255, 0.1); border-radius: 0.25rem; animation: flash 3s; } @keyframes flash { 0% { border-color: rgba(255, 0, 0, 0); } 50% { border-color: rgba(255, 0, 0, 1); } 100% { border-color: rgba(255, 255, 255, .1); } } `; export interface SettingsDrawerProps { } export default function SettingsDrawer(props: SettingsDrawerProps) { const context = useAppContext(); const small = useMediaQuery('(max-width: 40em)'); const { parameters, setParameters } = context; const [voices, setVoices] = useState(defaultVoiceList); useEffect(() => { if (context.apiKeys.elevenlabs) { getVoices().then(data => { if (data?.voices?.length) { setVoices(data.voices); } }); } }, [context.apiKeys.elevenlabs]); if (!context.settings.tab) { return null; } return ( context.settings.close()} withCloseButton={false}> Options User Speech

Your OpenAI API Key

{ setParameters({ ...parameters, apiKey: event.currentTarget.value }); context.apiKeys.setOpenAIApiKey(event.currentTarget.value); }} />

Find your API key here. Your API key is stored only on this device and never transmitted to anyone except OpenAI.

OpenAI API key usage is billed at a pay-as-you-go rate, separate from your ChatGPT subscription.

System Prompt