feat: 添加dotenv依赖,增强配置管理;更新Aside组件以传递flowId;新增语料获取节点及相关逻辑

This commit is contained in:
zhanghao 2026-09-10 15:25:41 +08:00
parent df522fb87c
commit f8d1adc788
6 changed files with 60 additions and 21 deletions

View File

@ -47,6 +47,7 @@
"axios": "1.13.2",
"clipboard": "2.0.11",
"dayjs": "^1.11.13",
"dotenv": "^17.4.2",
"echarts": "5.6.0",
"file-saver": "2.0.5",
"fuse.js": "7.1.0",

9
pnpm-lock.yaml generated
View File

@ -38,6 +38,9 @@ importers:
dayjs:
specifier: ^1.11.13
version: 1.11.23
dotenv:
specifier: ^17.4.2
version: 17.4.2
echarts:
specifier: 5.6.0
version: 5.6.0
@ -1016,6 +1019,10 @@ packages:
dompurify@3.2.7:
resolution: {integrity: sha512-WhL/YuveyGXJaerVlMYGWhvQswa7myDG17P7Vu65EWC05o8vfeNbvNf4d/BOvH99+ZW+LlQsc1GDKMa1vNK6dw==}
dotenv@17.4.2:
resolution: {integrity: sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==}
engines: {node: '>=12'}
dunder-proto@1.0.1:
resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}
engines: {node: '>= 0.4'}
@ -2730,6 +2737,8 @@ snapshots:
optionalDependencies:
'@types/trusted-types': 2.0.7
dotenv@17.4.2: {}
dunder-proto@1.0.1:
dependencies:
call-bind-apply-helpers: 1.0.2

View File

@ -31,7 +31,7 @@
<div class="node-list">
<div
v-for="node in item.nodeList"
v-for="node in filterNodeList(item.nodeList)"
:key="`${node.type}-${node.action || node.name}`"
class="node-item"
draggable="true"
@ -57,6 +57,8 @@ import { computed, ref, watch } from "vue";
import { Rank, Search } from "@element-plus/icons-vue";
import { collapseList } from "../config";
const props = defineProps({ flowId: String })
const keyword = ref("");
const activeNames = ref(collapseList[0] ? [collapseList[0].collapseTitle] : []);
const totalCount = computed(() => collapseList.reduce((total, group) => total + group.nodeList.length, 0));
@ -79,6 +81,13 @@ watch(keyword, (value) => {
if (value.trim()) activeNames.value = filteredGroups.value.map((group) => group.collapseTitle);
});
const filterNodeList = (nodeList) => {
return nodeList.filter((node) => {
if (node.show === undefined) return true;
return node.show;
});
};
/**
* 处理 handleDragCustom 对应的数据或交互;作用范围仅限当前组件或模块。
* @param {*} event 触发操作的浏览器事件
@ -86,6 +95,14 @@ watch(keyword, (value) => {
*/
const handleDragCustom = (event, node) => {
event.dataTransfer.effectAllowed = "copy";
if (node.action === "INSPECTION_WAYPOINT_CORPUS") {
node.nodeParams = node.nodeParams.map((param) => {
if (param.name === "detectItemId") {
param.input = props.flowId || "";
}
return param;
});
}
event.dataTransfer.setData("flowNode", JSON.stringify(node));
};
</script>

View File

@ -96,6 +96,16 @@ const inspectionEventTypes = () => {
}]
}
const corpus_type = () => {
return [{
value: 'zh-CN',
label: '中文'
}, {
value: 'en-US',
label: '英文'
}]
}
export const collapseList = [
{
collapseTitle: "相机",
@ -133,11 +143,6 @@ export const collapseList = [
outputParams: [],
outputType: 'json'
},
],
},
{
collapseTitle: "录像",
nodeList: [
{
icon: videoSvg,
name: "开启录像",
@ -194,20 +199,6 @@ export const collapseList = [
action: 'STOP_LOOP',
desc: "用于立即终止当前所在的循环,跳出循环体",
},
// {
// icon: startSvg,
// name: "单次循环开始",
// type: "subStart",
// action: 'SUB_START',
// desc: "循环体内部工作流的开始节点,开始循环体内部的单次流程",
// },
// {
// icon: endSvg,
// name: "单次循环结束",
// type: "subEnd",
// action: 'SUB_END',
// desc: "循环体内部工作流的终止节点,结束循环体内部的单次流程",
// },
{
icon: switchSvg,
name: "分支",
@ -303,6 +294,20 @@ function handler(params) {
], desc: '当前循环对象', }
]
},
{
icon: cameraSvg,
name: "获取语料",
type: "serviceNode",
desc: "获取点位设置的语料",
show: __PROJECT_NAME__ === 'changan',
action: 'INSPECTION_WAYPOINT_CORPUS',
nodeParams: [
{ name: "detectItemId", type: "input", input: "", disabled: true },
{ name: "type", type: "input", input: "", componentType: 'select', selectOptions: corpus_type(), disabled: true }
],
outputType: 'json',
outputParams: [{ name: 'corpus', type: 'string', desc: '语料文本' }]
},
],
},
{
@ -341,6 +346,7 @@ function handler(params) {
name: "通用指令",
type: "deviceUniversal",
desc: "执行设备通用指令",
show: __PROJECT_NAME__ === 'aima',
action: 'DEVICE_EXECUTE_JSON_COMMAND',
nodeType: 'EDGE',
nodeParams: [
@ -356,6 +362,7 @@ function handler(params) {
name: "动作队列",
type: "actionQueue",
desc: "在边缘端按顺序连续执行多个动作",
show: __PROJECT_NAME__ === 'aima',
action: 'SYSTEM_EXECUTE_ACTION_QUEUE',
nodeType: 'EDGE',
nodeParams: [
@ -564,6 +571,7 @@ function handler(params) {
name: "视频智能分析",
type: "mediaAnalysis",
desc: "按分析场景理解测试录像并输出结构化结论",
show: __PROJECT_NAME__ === 'aima',
action: "VIDEO_ANALYZE",
nodeType: "LLM",
nodeParams: [
@ -597,6 +605,7 @@ function handler(params) {
name: "通用图片分析",
type: "imageAnalysis",
desc: "按照提示词分析一张或多张图片并返回指定内容",
show: __PROJECT_NAME__ === 'aima',
action: 'IMAGE_ANALYZE',
nodeType: "LLM",
nodeParams: [
@ -666,6 +675,7 @@ function handler(params) {
type: "sdAgent",
desc: "通过apiKey调用商道大模型",
action: 'AI_AGENT_PLATFORM',
show: __PROJECT_NAME__ === 'cmvr',
nodeType: "LLM",
outputType: 'json',
nodeParams: [

View File

@ -118,7 +118,7 @@
</el-header>
<el-container class="container">
<el-aside v-if="!flowStore.disableForm">
<Aside />
<Aside :flowId="flowInfoData.itemId" />
</el-aside>
<el-main>
<div class="canvas-toolbar">

View File

@ -22,6 +22,7 @@
</template>
<template #output>
<div v-if="nodeOperatingStatus != 'FAILED'">
{{ props.properties.outputType }}
<JsonViewer
v-if="!['img', 'video', 'audio'].includes(props.properties.outputType)"
:value="outputJsonData"
@ -184,6 +185,7 @@ onMounted(() => {
output = data.paramsOut || {};
}
inputJsonData.value = inputData;
console.log('output', output)
outputJsonData.value = output;
emits("contentChange");
}