add react-hot-toast and surface OpenAI API errors to users (#328)

This commit is contained in:
Jason Banich
2023-04-01 22:05:07 -07:00
committed by GitHub
parent 23ad285a4b
commit b7b6bbaaca
6 changed files with 78 additions and 5 deletions
+2
View File
@@ -34,6 +34,7 @@ import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import Head from 'next/head';
import { useEffect, useRef, useState } from 'react';
import { v4 as uuidv4 } from 'uuid';
import toast from 'react-hot-toast';
interface HomeProps {
serverSideApiKeyIsSet: boolean;
@@ -120,6 +121,7 @@ const Home: React.FC<HomeProps> = ({
if (!response.ok) {
setLoading(false);
setMessageIsStreaming(false);
toast.error(response.statusText);
return;
}