diff --git a/components/chat.tsx b/components/chat.tsx index 496e1bc..78bad46 100644 --- a/components/chat.tsx +++ b/components/chat.tsx @@ -20,7 +20,7 @@ import { useState } from 'react' import { Button } from './ui/button' import { Input } from './ui/input' -const IS_PREVIEW = true || process.env.VERCEL_ENV === 'preview' +const IS_PREVIEW = process.env.VERCEL_ENV === 'preview' export interface ChatProps extends React.ComponentProps<'div'> { initialMessages?: Message[] id?: string @@ -31,9 +31,7 @@ export function Chat({ id, initialMessages, className }: ChatProps) { 'ai-token', null ) - const [previewTokenDialog, setPreviewTokenDialog] = useState( - IS_PREVIEW && previewToken == null - ) + const [previewTokenDialog, setPreviewTokenDialog] = useState(IS_PREVIEW) const [previewTokenInput, setPreviewTokenInput] = useState(previewToken ?? '') const { messages, append, reload, stop, isLoading, input, setInput } = useChat({ @@ -44,7 +42,6 @@ export function Chat({ id, initialMessages, className }: ChatProps) { previewToken } }) - console.log(previewToken) return ( <>
@@ -67,43 +64,42 @@ export function Chat({ id, initialMessages, className }: ChatProps) { input={input} setInput={setInput} /> - {IS_PREVIEW && previewToken == null && ( - - - - Enter your OpenAI Key - - If you have not obtained your OpenAI API key, you can do so by{' '} - - signing up - {' '} - on the OpenAI website. This is only necessary for preview - environments so that the open source community can test the app. - The token will be saved to your browser's local storage - under the name ai-token. - - - setPreviewTokenInput(e.target.value)} - /> - - - - - - )} + signing up + {' '} + on the OpenAI website. This is only necessary for preview + environments so that the open source community can test the app. + The token will be saved to your browser's local storage under + the name ai-token. + + + setPreviewTokenInput(e.target.value)} + /> + + + + + ) }