update sync for executive dashboard ai insight

This commit is contained in:
Alberto-Audrix committed 2026-10-05 14:10:52 +07:00
1 parent 3fdd9b936f
commit 3f5db48b16
2 files changed
+21 -10

No files matched your search

+9 -7
View File
@@ -603,13 +603,15 @@ export const PageAiInsight: React.FC<PageAiInsightProps> = ({
}
const text = apiResult.insight_text ?? '';
const parsed =
apiResult.summary || apiResult.insight
? {
summary: apiResult.summary || '',
insight: apiResult.insight || '',
}
: parseAiResult(text);
let parsed: { summary: string; insight: string } | null = null;
if (apiResult.summary || apiResult.insight) {
parsed = {
summary: apiResult.summary || '',
insight: apiResult.insight || apiResult.insight_text || '',
};
} else {
parsed = parseAiResult(text);
}
if (!parsed || (!parsed.summary && !parsed.insight)) {
throw new Error('Respons AI tidak dapat diproses.');