mini增加云端智能-语音交互
This commit is contained in:
108
boards/default_src/micropython/blocks/ai_cloud.js
Normal file
108
boards/default_src/micropython/blocks/ai_cloud.js
Normal file
@@ -0,0 +1,108 @@
|
||||
import * as Blockly from 'blockly/core';
|
||||
import { Variables } from '../../python/export';
|
||||
const AI_CLOUD_VOICE_HUE = '#88ada6';
|
||||
|
||||
export const init_xunfei_vi = {
|
||||
init: function () {
|
||||
this.setColour(AI_CLOUD_VOICE_HUE);
|
||||
this.appendValueInput('VAR')
|
||||
.appendField(Blockly.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_SETUP + Blockly.Msg.MIXLY_AS + Blockly.Msg.MIXLY_XUFEI + Blockly.Msg.MIXLY_AipSpeech_asr );
|
||||
this.appendValueInput('APPID')
|
||||
.setCheck(String)
|
||||
.appendField('APPID');
|
||||
this.appendValueInput('APISecret')
|
||||
.setCheck(String)
|
||||
.appendField('APISecret');
|
||||
this.appendValueInput('APIKey')
|
||||
.setCheck(String)
|
||||
.appendField('APIKey');
|
||||
this.setInputsInline(false);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const init_xunfei_Spark_Ultra = {
|
||||
init: function () {
|
||||
this.setColour(AI_CLOUD_VOICE_HUE);
|
||||
this.appendValueInput('VAR')
|
||||
.appendField(Blockly.Msg.MIXLY_MICROPYTHON_SOCKET_MAKE);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_SETUP + Blockly.Msg.MIXLY_AS + Blockly.Msg.MIXLY_XUFEI + 'Spark Ultra' +Blockly.Msg.MIXLY_LARGE_LANGUAGE_MODEL );
|
||||
this.appendValueInput('APPID')
|
||||
.setCheck(String)
|
||||
.appendField('APPID');
|
||||
this.appendValueInput('APISecret')
|
||||
.setCheck(String)
|
||||
.appendField('APISecret');
|
||||
this.appendValueInput('APIKey')
|
||||
.setCheck(String)
|
||||
.appendField('APIKey');
|
||||
this.setInputsInline(false);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const init_xunfei_vi_run = {
|
||||
init: function () {
|
||||
this.setColour(AI_CLOUD_VOICE_HUE);
|
||||
this.appendValueInput('VAR')
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_RUN + Blockly.Msg.MIXLY_AipSpeech_asr);
|
||||
this.appendValueInput('time')
|
||||
.setCheck(Number);
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXPY_AI_AUDIO_TIME);
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
this.setTooltip(Blockly.Msg.init_xunfei_vi_op_tooltip);
|
||||
}
|
||||
};
|
||||
|
||||
export const init_xunfei_Spark_Ultra_run = {
|
||||
init: function () {
|
||||
this.setColour(AI_CLOUD_VOICE_HUE);
|
||||
this.appendValueInput('VAR')
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_RUN + Blockly.Msg.MIXLY_LARGE_LANGUAGE_MODEL);
|
||||
this.appendValueInput('qus')
|
||||
.setCheck(String)
|
||||
.appendField(Blockly.Msg.MIXLY_MICROPYTHON_SOCKET_SEND);
|
||||
this.setInputsInline(true);
|
||||
this.setOutput(true);
|
||||
this.setTooltip(Blockly.Msg.init_xunfei_vi_run_tooltip);
|
||||
}
|
||||
};
|
||||
|
||||
export const init_xunfei_Spark_Ultra_clr_his = {
|
||||
init: function () {
|
||||
this.setColour(AI_CLOUD_VOICE_HUE);
|
||||
this.appendValueInput('VAR')
|
||||
this.appendDummyInput()
|
||||
.appendField(Blockly.Msg.MIXLY_RUN + Blockly.Msg.MIXLY_LARGE_LANGUAGE_MODEL + Blockly.Msg.MIXLY_EMPTY_HISTORY);
|
||||
this.setInputsInline(true);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
}
|
||||
};
|
||||
|
||||
export const llm_set_callback = {
|
||||
init: function () {
|
||||
this.setColour(AI_CLOUD_VOICE_HUE);
|
||||
this.appendValueInput('VAR1')
|
||||
.appendField(Blockly.Msg.MIXLY_LARGE_LANGUAGE_MODEL)
|
||||
this.appendValueInput('callback')
|
||||
.appendField(Blockly.Msg.MIXLY_PYTHON_CONTROLS_THREAD_USE)
|
||||
this.appendValueInput('VAR')
|
||||
.appendField(Blockly.Msg.MIXLY_PARAMS);
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
this.setInputsInline(true);
|
||||
this.setTooltip(Blockly.Msg.llm_set_callback_tooltip);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user