Spaces:
Running
Running
handling error correctly
Browse files
components/editor/ask-ai/index.tsx
CHANGED
|
@@ -193,8 +193,8 @@ export function AskAI({
|
|
| 193 |
|
| 194 |
const isJson =
|
| 195 |
chunk.trim().startsWith("{") && chunk.trim().endsWith("}");
|
| 196 |
-
|
| 197 |
-
|
| 198 |
if (res.openLogin) {
|
| 199 |
setOpen(true);
|
| 200 |
} else if (res.openSelectProvider) {
|
|
|
|
| 193 |
|
| 194 |
const isJson =
|
| 195 |
chunk.trim().startsWith("{") && chunk.trim().endsWith("}");
|
| 196 |
+
const res = isJson ? JSON.parse(chunk) : null;
|
| 197 |
+
if (res && !res.ok) {
|
| 198 |
if (res.openLogin) {
|
| 199 |
setOpen(true);
|
| 200 |
} else if (res.openSelectProvider) {
|