We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents f4b1097 + 577ffbb commit 566a4a9Copy full SHA for 566a4a9
src/modals/HouseholdAIModal.jsx
@@ -65,6 +65,16 @@ export default function HouseholdAIModal(props) {
65
return;
66
}
67
68
+ // Response can either be static or streaming; if static, parse and set analysis
69
+ if (res.headers.get("Content-Type") !== "application/x-ndjson") {
70
+ const resJson = await res.json();
71
+ const result = await JSON.parse(resJson.result);
72
+ setIsLoading(false);
73
+ setAnalysis(result);
74
+ return;
75
+ }
76
+
77
+ // Otherwise, handle streaming using ReadableStream
78
const reader = res.body.getReader();
79
const decoder = new TextDecoder();
80
setIsLoading(false);
0 commit comments