From 93d2b1d6964d3890b79d06b23784a13c49de307b Mon Sep 17 00:00:00 2001 From: jhdcruz Date: Sat, 30 Nov 2024 20:50:39 +0800 Subject: [PATCH] fix(analytics): reduce poll wait, improve result --- .../_components/ActivityAnalytics/analytics.actions.ts | 2 +- src/trigger/generate-summary.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/portal/activities/_components/ActivityAnalytics/analytics.actions.ts b/src/app/portal/activities/_components/ActivityAnalytics/analytics.actions.ts index 0c3fd147..f6f29b0c 100644 --- a/src/app/portal/activities/_components/ActivityAnalytics/analytics.actions.ts +++ b/src/app/portal/activities/_components/ActivityAnalytics/analytics.actions.ts @@ -33,7 +33,7 @@ export async function triggerSummary( }, }, { - pollIntervalMs: 60000, // 1 minute + pollIntervalMs: 5000, metadata: { activity: id }, }, ); diff --git a/src/trigger/generate-summary.ts b/src/trigger/generate-summary.ts index b179ce71..bf0c00f9 100644 --- a/src/trigger/generate-summary.ts +++ b/src/trigger/generate-summary.ts @@ -57,12 +57,12 @@ export const generateSummary = task({ messages: [ { role: 'system', - content: 'You are a professional data analyst and secretary.', + content: 'You are a professional analyst and secretary.', }, { role: 'user', content: - 'Write a single-paragraph consisting of at least 5 sentences summary report of the feedback evaluation results provided below. Add basic html tags to format the text and highlight important parts, no links.', + 'Write a paragraph consisting of at least 5 sentences summary report of the feedback evaluation results provided below. Add basic html tags to format the text and highlight important parts, no links.', }, { role: 'user', @@ -70,8 +70,8 @@ export const generateSummary = task({ }, { role: 'user', - content: `The evaluation feedback also shows that the evaluators have ${emotions?.length} distinct emotions, with the top 10 emotions being ${emotions - .slice(0, 9) + content: `Also, Find out the dominant and frequent emotions that shows: ${emotions + .slice(0, 60) .map((emotion) => emotion.label) .join(', ')}.`, },