增加ollama块

This commit is contained in:
Irene-Maxine
2025-03-09 23:05:36 +08:00
parent c18326aca4
commit a6b05daefe
9 changed files with 329 additions and 3 deletions

View File

@@ -1790,4 +1790,20 @@ export const educore_ble_keyboard_input = {
this.setNextStatement(true);
this.setInputsInline(true);
}
};
export const get_keyboard_light = {
init: function () {
this.setColour(ACTUATOR_ONBOARD_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_KEYBOARD_LIGHT)
this.appendDummyInput()
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.MIXLY_NumLock, "0"],
[Blockly.Msg.MIXLY_CapsLock, "1"],
[Blockly.Msg.MIXLY_ScorllLock, "2"]
]),'key');
this.setOutput(true);
this.setInputsInline(true);
}
};

View File

@@ -621,4 +621,119 @@ export const iot_wificonnect = iot_wifi_connect;
export const iot_onenetconnect = iot_onenet_connect;
export const iot_onenetdisconnect = iot_onenet_disconnect;
export const iot_checkonenet = iot_onenet_check;
export const iot_publish = iot_onenet_publish;
export const iot_publish = iot_onenet_publish;
export const IOT_CONNECT_OLLAMA = {
init: function () {
this.setColour(IOT_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_CONNECT_OLLAMA);
this.appendValueInput('SERVER')
.appendField(Blockly.Msg.MIXLY_EMQX_SERVER)
.setAlign(Blockly.inputs.Align.RIGHT);
this.appendValueInput('NAME')
.appendField(Blockly.Msg.MODEL_NAME)
.setAlign(Blockly.inputs.Align.RIGHT);
this.appendValueInput('NUMBER')
.appendField(Blockly.Msg.MIXLY_SET_MAXIMUM_HISTORICAL_SESSIONS_NUM);
this.setInputsInline(false);
this.setPreviousStatement(true);
this.setNextStatement(true);
}
};
export const use_ollama_llm_to_chat = {
init: function () {
this.setColour(IOT_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_LLM_CHAT);
this.appendValueInput('TOPIC')
.appendField(Blockly.Msg.MIXLY_MIXGO_ESPNOW_SEND);
this.appendValueInput('METHOD')
.appendField(Blockly.Msg.MIXLY_LLM_CONTENT_CALLBACK);
this.setInputsInline(true);
this.setPreviousStatement(true);
this.setNextStatement(true);
}
};
export const use_ollama_llm_to_chat_return = {
init: function () {
this.setColour(IOT_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_LLM_CHAT);
this.appendValueInput('TOPIC')
.appendField(Blockly.Msg.MIXLY_MIXGO_ESPNOW_SEND);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXPY_REQUESTS_GET_RESULT)
this.setInputsInline(true);
this.setOutput(true);
}
};
// export const ollama_set_timeout = {
// init: function () {
// this.setColour(IOT_HUE);
// this.appendValueInput("VAR")
// .appendField('Ollama ' + Blockly.Msg.MIXLY_OLLAMA_SET_TIMEOUT);
// this.setInputsInline(true);
// this.setPreviousStatement(true);
// this.setNextStatement(true);
// }
// }
// export const ollama_set_max_retries = {
// init: function () {
// this.setColour(IOT_HUE);
// this.appendValueInput("VAR")
// .appendField('Ollama ' + Blockly.Msg.MIXLY_OLLAMA_SET_MAX_RETRIES);
// this.setInputsInline(true);
// this.setPreviousStatement(true);
// this.setNextStatement(true);
// }
// }
// export const ollama_set_custom_url = {
// init: function () {
// this.setColour(IOT_HUE);
// this.appendValueInput("TEXT")
// .appendField('Ollama ' + Blockly.Msg.MIXLY_OLLAMA_SET_CUSTOM_URL);
// this.setInputsInline(true);
// this.setPreviousStatement(true);
// this.setNextStatement(true);
// }
// }
// export const ollama_select_model = {
// init: function () {
// this.setColour(IOT_HUE);
// this.appendValueInput("TEXT")
// .appendField('Ollama ' + Blockly.Msg.MIXLY_SELECT_MODEL);
// this.setInputsInline(true);
// this.setPreviousStatement(true);
// this.setNextStatement(true);
// }
// }
// export const ollama_clear_user_history = {
// init: function () {
// this.setColour(IOT_HUE);
// this.appendDummyInput()
// .appendField('Ollama ' + Blockly.Msg.MIXLY_CLEAR_USER_HISTORY);
// this.setInputsInline(true);
// this.setPreviousStatement(true);
// this.setNextStatement(true);
// }
// }
export const ollama_empty_history = {
init: function () {
this.setColour(IOT_HUE);
this.appendDummyInput()
.appendField('Ollama ' + Blockly.Msg.MIXLY_EMPTY_HISTORY);
this.setInputsInline(true);
this.setPreviousStatement(true);
this.setNextStatement(true);
}
}

View File

@@ -2227,7 +2227,7 @@ export const weigh_sensor_get_weight = {
this.appendValueInput('SUB')
.appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_WEIGH_SENSOR)
this.appendDummyInput()
.appendField(Blockly.Msg.blockpy_set_of + Blockly.Msg.MIXLY_DATA)
.appendField(Blockly.Msg.blockpy_set_of + Blockly.Msg.MIXLY_DATA + '(g)')
this.setOutput(true);
this.setInputsInline(true);
}

View File

@@ -1038,6 +1038,7 @@ export const sensor_mixgo_cc_mmc5603_get_magnetic = {
});
}
};
export const sensor_mixgo_cc_mmc5603_get_angle = {
init: function () {
this.setColour(SENSOR_ONBOARD_HUE);
@@ -1045,7 +1046,6 @@ export const sensor_mixgo_cc_mmc5603_get_angle = {
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_GET_COMPASS + Blockly.Msg.MIXLY_MICROBIT_JS_BY_ANGLE)
this.setOutput(true, Number);
this.setInputsInline(true);
}
};
@@ -1737,4 +1737,14 @@ export const CI130X_SET_SYSTEM_CMD_SANT = {
this.setNextStatement(true);
this.setInputsInline(true);
}
};
export const sensor_get_the_coprocessor_version = {
init: function () {
this.setColour(SENSOR_ONBOARD_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_GET + Blockly.Msg.MIXLY_THE_COPROCESSOR_VERSION)
this.setOutput(true);
this.setInputsInline(true);
}
};