feat: assistant

This commit is contained in:
2026-03-30 17:11:57 +08:00
parent f9067e335d
commit b3881a871e
5 changed files with 188 additions and 117 deletions

View File

@@ -62,7 +62,7 @@
<threeModel :currentData="currentData" />
</template>
</baseModal>
<!-- <Assistant /> -->
<Assistant />
</template>
<script setup lang="ts">
@@ -110,7 +110,7 @@
const vueFlow = ref<any>()
const nodeTypes = ref([NODE_TYPE.INPUT, NODE_TYPE.SECONDARY, NODE_TYPE.OUTPUT, NODE_TYPE.ALONE])
// 状态管理器
const stateManager = new StateManager({ vueFlow,sketchId:props.config.imgId })
const stateManager = new StateManager({ vueFlow, sketchId: props.config.imgId })
provide('stateManager', stateManager)
// 事件管理器
@@ -197,25 +197,30 @@
const downloadData = ref<any>({
amount: 0,
progress: 0,
status: 'success',//success
status: 'success' //success
})
const exportFlow = async () => {
// console.log(vueFlow.value)
// console.log(vueFlow.value.toImage)
let arr = stateManager.nodes.value.filter((v) => v.data.type === NODE_COMPONENT.RESULT_IMAGE)
let arr = stateManager.nodes.value.filter(
(v) => v.data.type === NODE_COMPONENT.RESULT_IMAGE
)
let imgList = []
arr.forEach((v,i) => {
v.data.data.imageProcessTasks.forEach((item,index) => {
arr.forEach((v, i) => {
v.data.data.imageProcessTasks.forEach((item, index) => {
let url = item.url
let name = url?.split(".").pop().split("?").shift();
imgList.push({url:url,name:`${v.data.type}${i}-${index == 0?'':index}.${name}`})
let name = url?.split('.').pop().split('?').shift()
imgList.push({
url: url,
name: `${v.data.type}${i}-${index == 0 ? '' : index}.${name}`
})
})
})
downloadData.value.amount = imgList.length
downloadData.value.status = 'loading'
await downImgListToZip(imgList,(progress)=>{
await downImgListToZip(imgList, (progress) => {
downloadData.value.progress = progress
if(progress == downloadData.value.amount){
if (progress == downloadData.value.amount) {
downloadData.value.status = 'success'
}
})