Commit 8b81526e authored by Kostis Trantzas's avatar Kostis Trantzas
Browse files

Merge branch...

Merge branch '39-create-a-new-block-in-blockly-to-support-agent-ask-and-response-from-the-service-orchestrator' into 'develop'

adding the block and resolve issue #39

See merge request !33
parents 79baecb5 08916264
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -345,6 +345,7 @@
          </category>
          
        <category name="Openslice" colour="210"> 
          <block type="askAgent"></block>   
          <block type="createServiceOrder"></block> 
          <block type="createServiceOrderJson"></block>   
        </category>
+19 −1
Original line number Diff line number Diff line
@@ -1421,6 +1421,23 @@ export class ServiceRuleDesignComponent implements OnInit {
    return  [code, Blockly.Java.ORDER_ATOMIC];
  };

    Blockly.Java['askAgent'] = function(block: any) {
    // Variable getter.
        console.log('askAgent')
    
        var agentName = Blockly.Java.valueToCode(block, 'agentName',
        Blockly.Java.ORDER_NONE) || null;
        var chattext = Blockly.Java.valueToCode(block, 'text',
        Blockly.Java.ORDER_NONE) || null;
        var defaultText = Blockly.Java.valueToCode(block, 'defaultText',
        Blockly.Java.ORDER_NONE) || null;
        var timeOut = Blockly.Java.valueToCode(block, 'timeOut',
        Blockly.Java.ORDER_NONE) || null;
    
        var code = 'askAgent('  + agentName + ',' + chattext  + ',' + defaultText + ',' + timeOut + ')';
    return  [code, Blockly.Java.ORDER_ATOMIC];
  };


  Blockly.Java['createServiceOrderJson'] = function(block: any) {
    // Variable getter.
@@ -1433,6 +1450,7 @@ export class ServiceRuleDesignComponent implements OnInit {
    return  [code, Blockly.Java.ORDER_ATOMIC];
  };

  
  Blockly.Java['variables_get'] = function(block: any) {
    // Variable getter.
        console.log('Variable getter CUSTOM')
+34 −0
Original line number Diff line number Diff line
@@ -794,7 +794,39 @@ Blockly.Blocks['string_to_float'] = {
  * 
  ****************************************************************************/

  Blockly.Blocks['askAgent'] = {
    init: function() {     
      
      this.appendDummyInput()
      .appendField("Ask agent"); 
      
      this.appendValueInput("agentName")
      .setCheck("String")
      .setAlign(Blockly.ALIGN_RIGHT)
      .appendField("Agent Name");     

   this.appendValueInput("text")
      .setCheck("String")
      .setAlign(Blockly.ALIGN_RIGHT)
      .appendField("Text");     
      
   this.appendValueInput("defaultText")
      .setCheck("String")
      .setAlign(Blockly.ALIGN_RIGHT)
      .appendField("Default Text");   

   this.appendValueInput("timeOut")
      .setCheck("Number")
      .setAlign(Blockly.ALIGN_RIGHT)
      .appendField("TimeOut (ms)");   

    this.setOutput(true, 'String');   

      this.setColour(230);
   this.setTooltip("Ask the locally configured LLM agent a question. The response will be the text answer from the agent. On error will return the default text");
   this.setHelpUrl("");
    }
  };
   

  
@@ -849,6 +881,7 @@ Blockly.Blocks['string_to_float'] = {
  };
  
  

  /*************************************************************************** 
  *
  *   OSM RELATED
@@ -1032,6 +1065,7 @@ Blockly.Blocks['string_to_float'] = {
    }
  };


  Blockly.Blocks['valueFromJsonPath'] = {
    init: function() {      
      this.appendValueInput("jsoninput")