Merge pull request #451 from buster-so/dallin/bus-1339-make-sure-only-major-assumption-make-it-into-summary

Refactor follow-up and initial message formatting to handle major assumptions more effectively. Added checks for major assumptions and updated message structure for clarity in output.
This commit is contained in:
dal 2025-07-09 08:18:17 -07:00 committed by GitHub
commit 38243a133d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 15 deletions

View File

@ -90,24 +90,38 @@ export const formatFollowUpMessageStepExecution = async ({
inputData: z.infer<typeof inputSchema>; inputData: z.infer<typeof inputSchema>;
}): Promise<z.infer<typeof formatFollowUpMessageOutputSchema>> => { }): Promise<z.infer<typeof formatFollowUpMessageOutputSchema>> => {
try { try {
// Check if there are any major assumptions
const majorAssumptions = inputData.assumptions?.filter((a) => a.label === 'major') || [];
// If no major assumptions, return null for formatted_message
if (majorAssumptions.length === 0) {
return {
...inputData,
};
}
// Prepare context about issues and assumptions for the agent // Prepare context about issues and assumptions for the agent
const issuesAndAssumptions = { const issuesAndAssumptions = {
flagged_issues: inputData.flagChatMessage || 'No issues flagged', flagged_issues: inputData.flagChatMessage || 'No issues flagged',
assumptions: inputData.assumptions || [], major_assumptions: majorAssumptions,
}; };
const contextMessage = `New issues and assumptions identified from the latest chat messages: const contextMessage = `New issues and assumptions identified from the latest chat messages:
User: ${inputData.userName} User: ${inputData.userName}
Issues Flagged: ${issuesAndAssumptions.flagged_issues}
Assumptions Identified: ${ Issues Flagged:
issuesAndAssumptions.assumptions.length > 0 ${issuesAndAssumptions.flagged_issues}
? issuesAndAssumptions.assumptions
Major Assumptions Identified:
${
issuesAndAssumptions.major_assumptions.length > 0
? issuesAndAssumptions.major_assumptions
.map((a) => `- ${a.descriptiveTitle}: ${a.explanation}`) .map((a) => `- ${a.descriptiveTitle}: ${a.explanation}`)
.join('\n') .join('\n\n')
: 'No new assumptions identified' : 'No major assumptions identified'
} }
Generate a concise update message for the data team.`; Generate a concise update message for the data team.`;

View File

@ -152,15 +152,17 @@ export const formatInitialMessageStepExecution = async ({
User: ${inputData.userName} User: ${inputData.userName}
Issues Flagged: ${issuesAndAssumptions.flagged_issues} Issues Flagged:
${issuesAndAssumptions.flagged_issues}
Major Assumptions Identified: ${ Major Assumptions Identified:
issuesAndAssumptions.major_assumptions.length > 0 ${
? issuesAndAssumptions.major_assumptions issuesAndAssumptions.major_assumptions.length > 0
.map((a) => `- ${a.descriptiveTitle}: ${a.explanation}`) ? issuesAndAssumptions.major_assumptions
.join('\n') .map((a) => `- ${a.descriptiveTitle}: ${a.explanation}`)
: 'No major assumptions identified' .join('\n\n')
} : 'No major assumptions identified'
}
Generate a cohesive summary with title for the data team.`; Generate a cohesive summary with title for the data team.`;