feat: 机器人说话和表情节点
This commit is contained in:
parent
74c75e111e
commit
592ebddc25
@ -17,6 +17,7 @@ import awakenSvg from './icon/awaken.svg'
|
||||
import dialogueSvg from './icon/dialogue.svg'
|
||||
import audioSvg from './icon/audio.svg'
|
||||
import touchSvg from './icon/touch.svg'
|
||||
import expressionSvg from './icon/expression.svg'
|
||||
|
||||
import { v4 as randomUUID } from 'uuid'
|
||||
|
||||
@ -74,11 +75,39 @@ export const registerCustomizeNode = (lf) => {
|
||||
};
|
||||
|
||||
const deviceOptions = () => {
|
||||
return ['cam1', 'cam2', 'cam3', 'cam4']
|
||||
return [{
|
||||
value: 'cam1',
|
||||
label: 'cam1'
|
||||
}, {
|
||||
value: 'cam2',
|
||||
label: 'cam2'
|
||||
}, {
|
||||
value: 'cam3',
|
||||
label: 'cam3'
|
||||
}, {
|
||||
value: 'cam4',
|
||||
label: 'cam4'
|
||||
}]
|
||||
}
|
||||
|
||||
const audioOptions = () => {
|
||||
return ['spk1']
|
||||
return [{
|
||||
value: 'spk1',
|
||||
label: 'spk1'
|
||||
}]
|
||||
}
|
||||
|
||||
const expressOptions = () => {
|
||||
return [{
|
||||
value: 1,
|
||||
label: '高兴'
|
||||
}, {
|
||||
value: 2,
|
||||
label: '惊讶'
|
||||
}, {
|
||||
value: 3,
|
||||
label: '疲惫'
|
||||
}]
|
||||
}
|
||||
|
||||
export const collapseList = [
|
||||
@ -365,7 +394,41 @@ export const collapseList = [
|
||||
{ name: "touchParams", type: "input", input: "", disabled: true }
|
||||
],
|
||||
outputType: 'json',
|
||||
}
|
||||
},
|
||||
{
|
||||
icon: expressionSvg,
|
||||
name: "开始说话",
|
||||
type: "serviceNode",
|
||||
desc: "控制机器人说话",
|
||||
action: 'BIO_HEAD_SPEAK_START',
|
||||
nodeParams: [
|
||||
{ name: "deviceId", type: "input", input: "", disabled: true }
|
||||
],
|
||||
outputType: 'json',
|
||||
},
|
||||
{
|
||||
icon: expressionSvg,
|
||||
name: "停止说话",
|
||||
type: "serviceNode",
|
||||
desc: "停止机器人说话",
|
||||
action: 'BIO_HEAD_SPEAK_STOP',
|
||||
nodeParams: [
|
||||
{ name: "deviceId", type: "input", input: "", disabled: true }
|
||||
],
|
||||
outputType: 'json',
|
||||
},
|
||||
{
|
||||
icon: expressionSvg,
|
||||
name: "表情",
|
||||
type: "serviceNode",
|
||||
desc: "控制机器人的面部表情",
|
||||
action: 'BIO_HEAD_SPECIAL_EXPRESSION',
|
||||
nodeParams: [
|
||||
{ name: "deviceId", type: "input", input: "", disabled: true },
|
||||
{ name: "expressKey", type: "input",componentType: 'select', selectOptions: expressOptions(), disabled: true },
|
||||
],
|
||||
outputType: 'json',
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
1
src/views/flow/icon/expression.svg
Normal file
1
src/views/flow/icon/expression.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg t="1762999534829" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4760" width="200" height="200"><path d="M512 979C263.472 979 62 777.528 62 529S263.472 79 512 79s450 201.472 450 450-201.472 450-450 450zM337 479c41.421 0 75-33.579 75-75s-33.579-75-75-75-75 33.579-75 75 33.579 75 75 75z m350 0c41.421 0 75-33.579 75-75s-33.579-75-75-75-75 33.579-75 75 33.579 75 75 75zM312 629c0 110.457 89.543 200 200 200s200-89.543 200-200H312z" fill="#65BEE0" p-id="4761"></path></svg>
|
||||
|
After Width: | Height: | Size: 520 B |
@ -62,6 +62,7 @@
|
||||
<el-input
|
||||
:disabled="property?.disabled || false"
|
||||
v-model="property.name"
|
||||
@keydown="handleInputKeydown"
|
||||
placeholder="请输入"
|
||||
clearable
|
||||
/>
|
||||
@ -81,9 +82,9 @@
|
||||
>
|
||||
<el-input-number v-if="property.componentType === 'number'" v-model="property.input" :min="0" :controls="false" :step-strictly="true" placeholder="请输入" clearable />
|
||||
<el-select v-model="property.input" v-else-if="property.componentType === 'select'" >
|
||||
<el-option v-for="item in property.selectOptions" :key="item" :label="item" :value="item" />
|
||||
<el-option v-for="item in property.selectOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
<el-input v-else v-model="property.input" placeholder="请输入" clearable />
|
||||
<el-input @keydown="handleInputKeydown" v-else v-model="property.input" placeholder="请输入" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="property.type === 'quote'"
|
||||
@ -322,6 +323,15 @@ watch(
|
||||
}
|
||||
);
|
||||
|
||||
const handleInputKeydown = (e) => {
|
||||
// 阻止事件冒泡到 Logic Flow 节点,避免被其事件拦截
|
||||
e.stopPropagation();
|
||||
// 可选:明确放行 Ctrl+V(增强兼容性)
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === 'v') {
|
||||
e.returnValue = true; // 允许默认粘贴行为
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
emitter.on("changeNodeState", (data) => {
|
||||
if (data.nodeId === props.model.id) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user