@@ -565,15 +565,17 @@ func SynthesizeActionsTool2(message string, actions []map[string]string) (update
565
565
//
566
566
// Returns:
567
567
// - updatedActions: the list of synthesized actions
568
- func SynthesizeActionsTool3 (message_1 string , message_2 string , actions []map [string ]string ) (updatedActions []map [string ]string ) {
568
+ func SynthesizeActionsTool3 (message_1 string , message_2 string , target_object string , actions []map [string ]string ) (updatedActions []map [string ]string ) {
569
569
ctx := & logging.ContextMap {}
570
570
571
571
// Clean up the input messages
572
572
message_1 = strings .TrimSpace (strings .Trim (message_1 , "\" " ))
573
573
message_2 = strings .TrimSpace (strings .Trim (message_2 , "\" " ))
574
+ target_object = strings .TrimSpace (strings .Trim (target_object , "\" " ))
574
575
575
576
logging .Log .Debugf (ctx , "Tool 3 Synthesize Message 1: %s\n " , message_1 )
576
577
logging .Log .Debugf (ctx , "Tool 3 Synthesize Message 2: %s\n " , message_2 )
578
+ logging .Log .Debugf (ctx , "Tool 3 Target Object: %s\n " , target_object )
577
579
578
580
// Get synthesize actions find key from configuration
579
581
synthesizeActionsFindKey1 , exists := config .GlobalConfig .WORKFLOW_CONFIG_VARIABLES ["APP_PROMPT_TEMPLATE_SYNTHESIZE_ACTION_TOOL3_VALUE" ]
@@ -590,20 +592,52 @@ func SynthesizeActionsTool3(message_1 string, message_2 string, actions []map[st
590
592
panic (errorMessage )
591
593
}
592
594
595
+ APP_TOOL_ACTIONS_TARGET_5 , exists := config .GlobalConfig .WORKFLOW_CONFIG_VARIABLES ["APP_TOOL_ACTIONS_TARGET_5" ]
596
+ if ! exists {
597
+ errorMessage := fmt .Sprintf ("failed to load APP_TOOL_ACTIONS_TARGET_5 from the configuration" )
598
+ logging .Log .Error (ctx , errorMessage )
599
+ panic (errorMessage )
600
+ }
601
+
602
+ APP_TOOL_ACTIONS_TARGET_6 , exists := config .GlobalConfig .WORKFLOW_CONFIG_VARIABLES ["APP_TOOL_ACTIONS_TARGET_6" ]
603
+ if ! exists {
604
+ errorMessage := fmt .Sprintf ("failed to load APP_TOOL_ACTIONS_TARGET_6 from the configuration" )
605
+ logging .Log .Error (ctx , errorMessage )
606
+ panic (errorMessage )
607
+ }
608
+
593
609
// Initialize updatedActions with the input actions
594
610
updatedActions = actions
595
611
596
- // Check the first dictionary in actions
597
- if len (updatedActions ) > 0 {
598
- firstAction := updatedActions [0 ]
599
- if _ , ok := firstAction [synthesizeActionsFindKey1 ]; ok && len (message_1 ) != 0 {
600
- // Replace the value with the input message
601
- firstAction [synthesizeActionsFindKey1 ] = message_1
612
+ if target_object == APP_TOOL_ACTIONS_TARGET_5 {
613
+ // Check the first dictionary in actions
614
+ if len (updatedActions ) > 0 {
615
+ firstAction := updatedActions [0 ]
616
+ if _ , ok := firstAction [synthesizeActionsFindKey1 ]; ok {
617
+ // Replace the value with the input message
618
+ firstAction [synthesizeActionsFindKey1 ] = message_1
619
+ }
620
+
621
+ if _ , ok := firstAction [synthesizeActionsFindKey2 ]; ok && len (message_2 ) != 0 {
622
+ firstAction [synthesizeActionsFindKey2 ] = message_2
623
+ }
602
624
}
625
+ } else if target_object == APP_TOOL_ACTIONS_TARGET_6 {
626
+ // Check if there is a third dictionary in actions
627
+ if len (updatedActions ) > 2 {
628
+ thirdAction := updatedActions [2 ]
629
+ if _ , ok := thirdAction [synthesizeActionsFindKey1 ]; ok {
630
+ // Replace the value with the input message
631
+ thirdAction [synthesizeActionsFindKey1 ] = message_1
632
+ }
603
633
604
- if _ , ok := firstAction [synthesizeActionsFindKey2 ]; ok && len (message_2 ) != 0 {
605
- firstAction [synthesizeActionsFindKey2 ] = message_2
634
+ updatedActions = []map [string ]string {thirdAction }
635
+ } else {
636
+ logging .Log .Warnf (ctx , "No third action found in updatedActions for target_object: %s" , target_object )
606
637
}
638
+ } else {
639
+ // Skip if target_object is neither APP_TOOL_ACTIONS_TARGET_5 nor APP_TOOL_ACTIONS_TARGET_6
640
+ logging .Log .Infof (ctx , "Skipping action synthesis for target_object: %s" , target_object )
607
641
}
608
642
609
643
logging .Log .Debugf (ctx , "The Updated Actions: %q\n " , updatedActions )
@@ -1813,12 +1847,15 @@ func ParseSlashCommand(userInput string) (slashCmd, targetCmd string, hasCmd boo
1813
1847
// Parameters:
1814
1848
// - slashCmd: the slash command
1815
1849
// - targetCmd: the target command
1850
+ // - finalizeResult: the finalize result from previous step
1816
1851
//
1817
1852
// Returns:
1818
1853
// - result: the synthesized string
1819
1854
func SynthesizeSlashCommand (slashCmd , targetCmd , finalizeResult string ) (result string ) {
1820
1855
ctx := & logging.ContextMap {}
1821
1856
1857
+ logging .Log .Debugf (ctx , "finalizeResult: %q, targetCmd: %q, slashCmd: %q" , finalizeResult , targetCmd , slashCmd )
1858
+
1822
1859
message , exists := config .GlobalConfig .WORKFLOW_CONFIG_VARIABLES ["APP_ACTION_TOOL_17_SUCCESS_MESSAGE" ]
1823
1860
if ! exists {
1824
1861
errorMessage := fmt .Sprintf ("failed to load APP_ACTION_TOOL_17_SUCCESS_MESSAGE from the configuration" )
0 commit comments