@@ -489,7 +489,10 @@ const main = async () => {
489489
490490 let resp = `🔤 Natural Language to DQL:\n\n` ;
491491 resp += `**Query:** "${ text } "\n\n` ;
492- resp += `**Generated DQL:**\n\`\`\`\n${ response . dql } \n\`\`\`\n\n` ;
492+ if ( response . dql ) {
493+ // Typically, the DQL response is empty if status == FAILED
494+ resp += `**Generated DQL:**\n\`\`\`\n${ response . dql } \n\`\`\`\n\n` ;
495+ }
493496 resp += `**Status:** ${ response . status } \n` ;
494497 resp += `**Message Token:** ${ response . messageToken } \n` ;
495498
@@ -500,9 +503,11 @@ const main = async () => {
500503 } ) ;
501504 }
502505
503- resp += `\n💡 **Next Steps:**\n` ;
504- resp += `1. Use "execute_dql" tool to run the query (you can omit running the "verify_dql" tool)\n` ;
505- resp += `2. If results don't match expectations, refine your natural language description and try again\n` ;
506+ if ( response . status != 'FAILED' ) {
507+ resp += `\n💡 **Next Steps:**\n` ;
508+ resp += `1. Use "execute_dql" tool to run the query (you can omit running the "verify_dql" tool)\n` ;
509+ resp += `2. If results don't match expectations, refine your natural language description and try again\n` ;
510+ }
506511
507512 return resp ;
508513 } ,
@@ -580,7 +585,10 @@ const main = async () => {
580585
581586 let resp = `🤖 Davis CoPilot Response:\n\n` ;
582587 resp += `**Your Question:** "${ text } "\n\n` ;
583- resp += `**Answer:**\n${ response . text } \n\n` ;
588+ if ( response . text ) {
589+ // Typically, text is empty if status is FAILED
590+ resp += `**Answer:**\n${ response . text } \n\n` ;
591+ }
584592 resp += `**Status:** ${ response . status } \n` ;
585593 resp += `**Message Token:** ${ response . messageToken } \n` ;
586594
@@ -602,6 +610,10 @@ const main = async () => {
602610 resp += `\n**Conversation ID:** ${ response . state . conversationId } ` ;
603611 }
604612
613+ if ( response . status == 'FAILED' ) {
614+ resp += `\n❌ **Your request was not successful**\n` ;
615+ }
616+
605617 return resp ;
606618 } ,
607619 ) ;
0 commit comments