|
|
@@ -898,7 +898,7 @@ const aiService = {
|
|
|
|
|
|
// 文本生成文本(如AI对话)
|
|
|
textToText: withErrorHandling('AI大模型调用', async function(prompt, model = "default") {
|
|
|
- console.log("AI智能体请求,提示词:", prompt);
|
|
|
+ console.log("AI智能体请求,输入文本:", prompt);
|
|
|
|
|
|
// 如果没有活跃的对话ID,创建新对话
|
|
|
if (!state.activeConversationId) {
|
|
|
@@ -1203,16 +1203,9 @@ onMounted(async () => {
|
|
|
this.appendValueInput("PROMPT")
|
|
|
.setCheck("String")
|
|
|
.appendField("输入文本:");
|
|
|
- this.appendDummyInput()
|
|
|
- .appendField("模型:")
|
|
|
- .appendField(
|
|
|
- new Blockly.FieldDropdown([
|
|
|
- ["默认", "default"],
|
|
|
- ["对话", "chat"],
|
|
|
- ["分析", "analysis"],
|
|
|
- ]),
|
|
|
- "MODEL"
|
|
|
- );
|
|
|
+ this.appendValueInput("提示词")
|
|
|
+ .setCheck("String")
|
|
|
+ .appendField("提示词:");
|
|
|
this.setOutput(true, "String");
|
|
|
this.setColour(300);
|
|
|
this.setTooltip("使用AI大模型调用并返回结果");
|
|
|
@@ -1352,14 +1345,18 @@ onMounted(async () => {
|
|
|
" <block type=\"variables_set\" id=\"AP0CO$VPeM0*PS*CKT,V\">\n" +
|
|
|
" <field name=\"VAR\" id=\"[7F(niLz{.fvWvY.VT/N\">lampConfig</field>\n" +
|
|
|
" <value name=\"VALUE\">\n" +
|
|
|
- " <block type=\"ai_text_to_text\" id=\"lZTz/FN3b(*_p?1zug7F\">\n" +
|
|
|
- " <field name=\"MODEL\">default</field>\n" +
|
|
|
- " <value name=\"PROMPT\">\n" +
|
|
|
- " <block type=\"variables_get\" id=\"si~IQyn|#1H(BKV4Gq;X\">\n" +
|
|
|
- " <field name=\"VAR\" id=\"kAVG*zJLw/q)l/(/eIMM\">inputText</field>\n" +
|
|
|
- " </block>\n" +
|
|
|
- " </value>\n" +
|
|
|
- " </block>\n" +
|
|
|
+ " <block type=\"ai_text_to_text\" id=\"XYG.cN_=CX5:Vd_)wdZ7\" x=\"190\" y=\"250\">\n" +
|
|
|
+ " <value name=\"PROMPT\">\n" +
|
|
|
+ " <block type=\"variables_get\" id=\"(3Sd)lTX],5xho{p_=s!\">\n" +
|
|
|
+ " <field name=\"VAR\" id=\"8(,gJ5{2y*8olrD{^G.P\">inputText</field>\n" +
|
|
|
+ " </block>\n" +
|
|
|
+ " </value>\n" +
|
|
|
+ " <value name=\"提示词\">\n" +
|
|
|
+ " <block type=\"text\" id=\"ubD*WPRnwBC|BxGraKX3\">\n" +
|
|
|
+ " <field name=\"TEXT\">请只回复我指定格式:白,100,热闹</field>\n" +
|
|
|
+ " </block>\n" +
|
|
|
+ " </value>\n" +
|
|
|
+ " </block>\n" +
|
|
|
" </value>\n" +
|
|
|
" <next>\n" +
|
|
|
" <block type=\"ai_smart_lamp_single_param\" id=\"ZTAwt~MMm(t5w:$$Azt`\">\n" +
|
|
|
@@ -1374,7 +1371,6 @@ onMounted(async () => {
|
|
|
" </next>\n" +
|
|
|
" </block>\n" +
|
|
|
"</xml>";
|
|
|
-
|
|
|
// 使用安全的方式解析XML
|
|
|
const xml = Blockly.utils.xml.textToDom(initialXml);
|
|
|
|