deotalandAi/apps/frontend/src/views/Project/index.js

803 lines
34 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { clientApi, requestUtils } from '@deotaland/utils';
export class Project{
static timer = null;
//项目时常
duration_seconds = 0;
constructor() {
// 用于防抖处理的定时器
this.updateTimer = null;
// 存储最新的请求参数
this.latestUpdateParams = null;
}
//创建项目
async createProject(name='project',) {
return new Promise(async (resolve, reject) => {
let params = {
"thumbnail": "",//项目缩略图
"title": name,//项目标题
"description": "init",//项目描述
"details": {
"node_card": [],
"prompt":'',
"thumbnail": "", // 缩略图
},
"tags": [
"doll"
],
"duration_seconds": 0,//项目时长(秒)
}
let res = await requestUtils.common(clientApi.default.PROJECT_CREATE,params)
if(res.code !== 0){
reject(res)
}else{
resolve(res.data)
}
})
}
//更新项目(带防抖处理,三秒内只执行最后一次请求)
async updateProject(projectId,projectConfig) {
return new Promise(async (resolve, reject) => {
// 存储最新的请求参数
const params = {
"id": projectId,//项目ID
...projectConfig
};
this.latestUpdateParams = params;
// 清除之前的定时器
if (this.updateTimer) {
clearTimeout(this.updateTimer);
}
// 设置新的3秒定时器
this.updateTimer = setTimeout(async () => {
try {
const res = await requestUtils.common(clientApi.default.PROJECT_UPDATE, this.latestUpdateParams);
if(res.code !== 0){
reject(res)
}else{
resolve(res.data)
}
} catch (error) {
reject(error);
} finally {
// 清除定时器引用
this.updateTimer = null;
}
}, 1000);
})
}
//删除项目
async deleteProject(projectId) {
return new Promise(async (resolve, reject) => {
let params = {
"id": projectId,//项目ID
}
let res = await requestUtils.common(clientApi.default.PROJECT_DELETE,params)
if(res.code !== 0){
reject(res)
}else{
resolve(res.data)
}
})
}
//获取项目详情
async getProject(projectId) {
return new Promise(async (resolve, reject) => {
let params = {
"id": projectId,//项目ID
}
let res = await requestUtils.common(clientApi.default.PROJECT_GET,params)
if(res.code !== 0){
reject(res)
}else{
resolve(res.data)
}
})
}
//获取项目列表
async getProjectList(params) {
return new Promise(async (resolve, reject) => {
// resolve({
// "items": [
// {
// "id": 20,
// "user_id": 1,
// "thumbnail": "",
// "title": "project",
// "description": "init",
// "details": {
// "prompt": "",
// "node_card": [],
// "thumbnail": ""
// },
// "tags": [
// "doll"
// ],
// "duration_seconds": 0,
// "created_at": "2025-11-28T05:36:19.758116+00:00",
// "updated_at": "2025-11-28T06:05:04.982516+00:00",
// "is_delete": 0,
// "gemini_success_count": 0,
// "gemini_failure_count": 0,
// "meshy_success_count": 0,
// "meshy_failure_count": 0
// },
// {
// "id": 19,
// "user_id": 1,
// "thumbnail": "",
// "title": "蛇系",
// "description": "init",
// "details": {
// "prompt": "",
// "node_card": [
// {
// "type": "image",
// "ipType": "人物",
// "prompt": "蛇系美女",
// "status": "success",
// "zIndex": 112,
// "offsetX": "-191px",
// "offsetY": "-230px",
// "imageUrl": "https://api.deotaland.ai/upload/932512adb172459db6cb1d02c12c842e.png",
// "ipTypeImg": "/src/assets/sketches/tcww.png",
// "timestamp": "2025-11-28T05:34:17.545Z",
// "project_id": "19",
// "inspirationImage": ""
// },
// {
// "type": "image",
// "ipType": "人物",
// "prompt": "蛇系美女",
// "status": "success",
// "zIndex": 117,
// "offsetX": "96px",
// "offsetY": "-247px",
// "imageUrl": "https://api.deotaland.ai/upload/2e58e1dfc1d8459eb2b094e7c1ce459e.png",
// "ipTypeImg": "/src/assets/sketches/tcww.png",
// "timestamp": "2025-11-28T05:34:17.546Z",
// "project_id": "19",
// "inspirationImage": ""
// },
// {
// "type": "image",
// "ipType": "人物",
// "prompt": "蛇系美女",
// "status": "success",
// "zIndex": 121,
// "offsetX": "81px",
// "offsetY": "212px",
// "imageUrl": "https://api.deotaland.ai/upload/9d9d70a5ecbe4e1ab4298d3ad14a8402.png",
// "ipTypeImg": "/src/assets/sketches/tcww.png",
// "timestamp": "2025-11-28T05:34:17.546Z",
// "project_id": "19",
// "inspirationImage": ""
// },
// {
// "type": "model",
// "status": "success",
// "taskId": "019ac8f5-c5b2-775e-a36d-19a4651275dd",
// "zIndex": 117,
// "offsetX": "-223px",
// "offsetY": "210px",
// "imageUrl": "https://api.deotaland.ai/upload/2e58e1dfc1d8459eb2b094e7c1ce459e.png",
// "modelUrl": "https://api.deotaland.ai/model/ae501c6d-79fd-4bca-9768-f315ee977749/tasks/019ac8f5-c5b2-775e-a36d-19a4651275dd/output/model.glb?Expires=4917908316&Signature=Vo3dEReKA3MeFRoxQxs6xf0Ypj4lkf8sJiOk43~2M95Mw7qv5WvjPmmKRktj6XIoAlZ4wvtB-zjmhR8rxK9CMR0uRJC~v06e8jDJBViDpjaB5TC6cyvb5EQK8gEPq-lr4p8wfWoNDtO0sX6Zmby~4Z-vhp2wg9Vc4GuzqJ6Uj89qBJgAx-~i2QaGDdRaJ~qqIdCp82zZnNi8Rl-2JEfiMeMWDAUzDbqTG4Hy4yKLsZ2TBQh2YZEJZcwOYdwbwVokFPuAHn-EyIDcxHtUsLqUp8JDB~yALWmuidw1ETQUUPl914T~FfmkWfb0SqVcdIDDkNl-sLwKaxdW8hyCOCYpXA__&Key-Pair-Id=KL5I0C8H7HX83",
// "cardWidth": "250",
// "timestamp": "2025-11-28T05:35:41.218Z",
// "project_id": "19",
// "generateFourView": false
// }
// ],
// "thumbnail": ""
// },
// "tags": [
// "doll"
// ],
// "duration_seconds": 0,
// "created_at": "2025-11-28T05:33:35.161488+00:00",
// "updated_at": "2025-11-28T06:05:01.156032+00:00",
// "is_delete": 0,
// "gemini_success_count": 4,
// "gemini_failure_count": 0,
// "meshy_success_count": 0,
// "meshy_failure_count": 1
// },
// {
// "id": 18,
// "user_id": 1,
// "thumbnail": "",
// "title": "蛇系",
// "description": "init",
// "details": {
// "prompt": "",
// "node_card": [
// {
// "type": "image",
// "ipType": "人物",
// "prompt": "蛇系女孩",
// "status": "success",
// "zIndex": 102,
// "offsetX": "-446px",
// "offsetY": "-210px",
// "imageUrl": "https://api.deotaland.ai/upload/2ada0aaffd0945b49f67a0da85afc20c.png",
// "ipTypeImg": "/src/assets/sketches/tcww.png",
// "timestamp": "2025-11-28T05:29:06.741Z",
// "project_id": 18,
// "inspirationImage": ""
// },
// {
// "type": "model",
// "status": "success",
// "taskId": "019ac8f0-1ff1-78a9-885c-9258854baedb",
// "zIndex": 102,
// "offsetX": "8px",
// "offsetY": "-236px",
// "imageUrl": "https://api.deotaland.ai/upload/2ada0aaffd0945b49f67a0da85afc20c.png",
// "modelUrl": "https://api.deotaland.ai/model/ae501c6d-79fd-4bca-9768-f315ee977749/tasks/019ac8f0-1ff1-78a9-885c-9258854baedb/output/model.glb?Expires=4917907940&Signature=XcZPFzqb3JSAN1hYpm2SU~NXxn40ytlfJv~WkULZGw5ZBnNijdBxAPLYLde-FZaoX8OPHZTexnP6odftS1MXtt9NAv2Q-goLd9ey~iHrl25ihXCdTENYilhXSCi5jQS54I6x-GerPpbfKi-61hxRLO4flLAwqxTMXqueDNVMZBq7sQwJ5CsA~9wft503w2qQZBajBBTykFxUYAGFkSFYPcb5uO7Xw1JTrj3BQ~r7QCzSOAyZmK2hnDKKi160gt425h28351DOW3jP2eiV5TsLaTkJnHyUT7bVX1~JFEuO53R9d~rGwdrToLYb6NW~bkiII218VOb6ZN51oU~SVkKPA__&Key-Pair-Id=KL5I0C8H7HX83",
// "cardWidth": "250",
// "timestamp": "2025-11-28T05:29:31.065Z",
// "project_id": 18,
// "generateFourView": false
// }
// ],
// "thumbnail": ""
// },
// "tags": [
// "doll"
// ],
// "duration_seconds": 0,
// "created_at": "2025-11-28T05:28:39.047049+00:00",
// "updated_at": "2025-11-28T05:32:35.485785+00:00",
// "is_delete": 0,
// "gemini_success_count": 1,
// "gemini_failure_count": 0,
// "meshy_success_count": 0,
// "meshy_failure_count": 1
// },
// {
// "id": 17,
// "user_id": 1,
// "thumbnail": "",
// "title": "恐龙妹系列",
// "description": "init",
// "details": {
// "prompt": "",
// "node_card": [
// {
// "type": "image",
// "ipType": "人物",
// "prompt": "恐龙妹妹",
// "status": "success",
// "zIndex": 106,
// "offsetX": "-409px",
// "offsetY": "-336px",
// "imageUrl": "https://api.deotaland.ai/upload/580886031063469781f18d6ef7f0b09c.png",
// "ipTypeImg": "/src/assets/sketches/tcww.png",
// "timestamp": "2025-11-28T05:24:06.918Z",
// "project_id": 17,
// "inspirationImage": ""
// }
// ],
// "thumbnail": ""
// },
// "tags": [
// "doll"
// ],
// "duration_seconds": 0,
// "created_at": "2025-11-28T05:23:50.666448+00:00",
// "updated_at": "2025-11-28T05:24:38.270082+00:00",
// "is_delete": 0,
// "gemini_success_count": 1,
// "gemini_failure_count": 0,
// "meshy_success_count": 0,
// "meshy_failure_count": 1
// },
// {
// "id": 16,
// "user_id": 1,
// "thumbnail": "",
// "title": "project",
// "description": "init",
// "details": {
// "prompt": "",
// "node_card": [],
// "thumbnail": ""
// },
// "tags": [
// "doll"
// ],
// "duration_seconds": 0,
// "created_at": "2025-11-28T05:23:20.613163+00:00",
// "updated_at": "2025-11-28T05:23:23.442095+00:00",
// "is_delete": 0,
// "gemini_success_count": 0,
// "gemini_failure_count": 0,
// "meshy_success_count": 0,
// "meshy_failure_count": 0
// },
// {
// "id": 15,
// "user_id": 1,
// "thumbnail": "",
// "title": "project",
// "description": "init",
// "details": {
// "prompt": "",
// "node_card": [],
// "thumbnail": ""
// },
// "tags": [
// "doll"
// ],
// "duration_seconds": 0,
// "created_at": "2025-11-28T04:16:02.800209+00:00",
// "updated_at": "2025-11-28T04:16:02.800209+00:00",
// "is_delete": 0,
// "gemini_success_count": 0,
// "gemini_failure_count": 0,
// "meshy_success_count": 0,
// "meshy_failure_count": 0
// },
// {
// "id": 14,
// "user_id": 1,
// "thumbnail": "",
// "title": "project",
// "description": "init",
// "details": {
// "prompt": "",
// "node_card": [],
// "thumbnail": ""
// },
// "tags": [
// "doll"
// ],
// "duration_seconds": 0,
// "created_at": "2025-11-28T04:14:37.402123+00:00",
// "updated_at": "2025-11-28T04:14:41.210826+00:00",
// "is_delete": 0,
// "gemini_success_count": 0,
// "gemini_failure_count": 0,
// "meshy_success_count": 0,
// "meshy_failure_count": 0
// },
// {
// "id": 13,
// "user_id": 1,
// "thumbnail": "",
// "title": "project",
// "description": "init",
// "details": {
// "prompt": "",
// "node_card": [],
// "thumbnail": ""
// },
// "tags": [
// "doll"
// ],
// "duration_seconds": 0,
// "created_at": "2025-11-28T04:14:21.190171+00:00",
// "updated_at": "2025-11-28T04:14:23.700132+00:00",
// "is_delete": 0,
// "gemini_success_count": 0,
// "gemini_failure_count": 0,
// "meshy_success_count": 0,
// "meshy_failure_count": 0
// },
// {
// "id": 12,
// "user_id": 1,
// "thumbnail": "",
// "title": "project",
// "description": "init",
// "details": {
// "prompt": "",
// "node_card": [],
// "thumbnail": ""
// },
// "tags": [
// "doll"
// ],
// "duration_seconds": 0,
// "created_at": "2025-11-28T04:14:16.233977+00:00",
// "updated_at": "2025-11-28T04:14:18.747615+00:00",
// "is_delete": 0,
// "gemini_success_count": 0,
// "gemini_failure_count": 0,
// "meshy_success_count": 0,
// "meshy_failure_count": 0
// },
// {
// "id": 11,
// "user_id": 1,
// "thumbnail": "",
// "title": "猫系玩偶系列",
// "description": "init",
// "details": {
// "prompt": "",
// "node_card": [
// {
// "type": "image",
// "ipType": "人物",
// "prompt": "猫女",
// "status": "success",
// "zIndex": 101,
// "offsetX": "92px",
// "offsetY": "-395px",
// "imageUrl": "https://api.deotaland.ai/upload/526afeec880e46688d6e2edd1893e778.png",
// "ipTypeImg": "/src/assets/sketches/tcww.png",
// "timestamp": "2025-11-28T04:11:03.655Z",
// "project_id": "11",
// "inspirationImage": ""
// },
// {
// "type": "model",
// "status": "success",
// "taskId": "https://api.deotaland.ai/model/ae501c6d-79fd-4bca-9768-f315ee977749/tasks/019ac8d3-959d-7432-ac15-b5bab5c75b74/output/model.glb?Expires=4917906081&Signature=W88kkM3xYsvvJkiroo1RV141Jfp03bSQCMATSoBQ2gvct87jfWADJTm80rJTDWuNCBmXcF7dt2kDgB2mGWXjQri1DhAwzY87gIp~bJsvtis6UreApFesKHPhU~BkZGfOW2culwT29NTIY~PkTL9Whg8WZ-Mu9xb6Og6iJHol6E4gIX-jGTrXN67~BWsh17kvgSHN5bmackn9IZ~GGwC2threl0BzeFzgpYEkFuP60fkXeCvFAiZBCd0shZR9tuXa4drdzeg7FJMTWpPhhSBPXEFNeDxOpxiLd8iCrQuyu5s1sxNJuGeDcMfTTDh864J0r4-ap11L0LAnWXyHE69-kw__&Key-Pair-Id=KL5I0C8H7HX83",
// "zIndex": 101,
// "offsetX": "-263px",
// "offsetY": "-388px",
// "imageUrl": "https://api.deotaland.ai/upload/526afeec880e46688d6e2edd1893e778.png",
// "modelUrl": "https://api.deotaland.ai/model/ae501c6d-79fd-4bca-9768-f315ee977749/tasks/019ac8d3-959d-7432-ac15-b5bab5c75b74/output/model.glb?Expires=4917906081&Signature=W88kkM3xYsvvJkiroo1RV141Jfp03bSQCMATSoBQ2gvct87jfWADJTm80rJTDWuNCBmXcF7dt2kDgB2mGWXjQri1DhAwzY87gIp~bJsvtis6UreApFesKHPhU~BkZGfOW2culwT29NTIY~PkTL9Whg8WZ-Mu9xb6Og6iJHol6E4gIX-jGTrXN67~BWsh17kvgSHN5bmackn9IZ~GGwC2threl0BzeFzgpYEkFuP60fkXeCvFAiZBCd0shZR9tuXa4drdzeg7FJMTWpPhhSBPXEFNeDxOpxiLd8iCrQuyu5s1sxNJuGeDcMfTTDh864J0r4-ap11L0LAnWXyHE69-kw__&Key-Pair-Id=KL5I0C8H7HX83",
// "cardWidth": "250",
// "timestamp": "2025-11-28T04:51:05.620Z",
// "project_id": "11",
// "generateFourView": false
// },
// {
// "type": "image",
// "ipType": "人物",
// "prompt": "猫男",
// "status": "success",
// "zIndex": 102,
// "offsetX": "-232px",
// "offsetY": "66px",
// "imageUrl": "https://api.deotaland.ai/upload/eacac612e5d34e23bbf26491a00fef20.png",
// "ipTypeImg": "/src/assets/sketches/tcww.png",
// "timestamp": "2025-11-28T05:19:26.236Z",
// "project_id": "11",
// "inspirationImage": ""
// },
// {
// "type": "model",
// "status": "success",
// "taskId": "019ac8e7-3cf0-7aa8-b441-f94d8d445b88",
// "zIndex": 102,
// "offsetX": "466px",
// "offsetY": "-380px",
// "imageUrl": "https://api.deotaland.ai/upload/eacac612e5d34e23bbf26491a00fef20.png",
// "modelUrl": "https://api.deotaland.ai/model/ae501c6d-79fd-4bca-9768-f315ee977749/tasks/019ac8e7-3cf0-7aa8-b441-f94d8d445b88/output/model.glb?Expires=4917907360&Signature=HTG71MVGMBj-inbrX4fjHwf3B7xBE~WX~cB--F6cMR-~03fdqyzYKAi-UDt9rnW3md03mJbTiMa2z9z6B~3NP8Exmzp783nfrAQaWfxarDX8iaH9GXPuEePhveXXYmcg2QEBTifPqkU~fwinI6kY9dfNGRTvrp8RHglr3Q8kuhUZS2Mo79OSCg5X-oZ17uEd-uU7hae8IBAPUSiIsbS1dQRjI32WOhDP6NfSZrf304Fn6HMfpyUxbauuPmb7MJ3dQAWUA1g-iBISThp3degZyV4YhhPkxuaBX5t2GlRuibjqmRlUXB2dEasTmKwq-L5zLYbbaVPXg1HfW9zdnuZJ8A__&Key-Pair-Id=KL5I0C8H7HX83",
// "cardWidth": "250",
// "timestamp": "2025-11-28T05:19:48.668Z",
// "project_id": "11",
// "generateFourView": false
// }
// ],
// "thumbnail": ""
// },
// "tags": [
// "doll"
// ],
// "duration_seconds": 0,
// "created_at": "2025-11-28T03:40:04.226536+00:00",
// "updated_at": "2025-11-28T05:22:47.719360+00:00",
// "is_delete": 0,
// "gemini_success_count": 4,
// "gemini_failure_count": 2,
// "meshy_success_count": 0,
// "meshy_failure_count": 3
// },
// {
// "id": 10,
// "user_id": 1,
// "thumbnail": "",
// "title": "project",
// "description": "init",
// "details": {
// "prompt": "",
// "node_card": [],
// "thumbnail": ""
// },
// "tags": [
// "doll"
// ],
// "duration_seconds": 0,
// "created_at": "2025-11-28T03:39:51.024726+00:00",
// "updated_at": "2025-11-28T04:15:11.880275+00:00",
// "is_delete": 0,
// "gemini_success_count": 0,
// "gemini_failure_count": 0,
// "meshy_success_count": 0,
// "meshy_failure_count": 0
// },
// {
// "id": 9,
// "user_id": 1,
// "thumbnail": "",
// "title": "project",
// "description": "init",
// "details": {
// "prompt": "",
// "node_card": [],
// "thumbnail": ""
// },
// "tags": [
// "doll"
// ],
// "duration_seconds": 0,
// "created_at": "2025-11-28T03:39:18.867572+00:00",
// "updated_at": "2025-11-28T03:39:18.867572+00:00",
// "is_delete": 0,
// "gemini_success_count": 0,
// "gemini_failure_count": 0,
// "meshy_success_count": 0,
// "meshy_failure_count": 0
// },
// {
// "id": 8,
// "user_id": 1,
// "thumbnail": "",
// "title": "project",
// "description": "init",
// "details": {
// "prompt": "",
// "node_card": [
// {
// "type": "image",
// "ipType": "人物",
// "prompt": "111",
// "status": "success",
// "zIndex": 106,
// "offsetX": "-462px",
// "offsetY": "-105px",
// "imageUrl": 1,
// "ipTypeImg": "/src/assets/sketches/tcww.png",
// "timestamp": "2025-11-28T03:17:49.448Z",
// "inspirationImage": ""
// },
// {
// "type": "image",
// "ipType": "人物",
// "prompt": "111",
// "status": "success",
// "zIndex": 102,
// "offsetX": "55px",
// "offsetY": "78px",
// "imageUrl": 2,
// "ipTypeImg": "/src/assets/sketches/tcww.png",
// "timestamp": "2025-11-28T03:17:49.448Z",
// "inspirationImage": ""
// }
// ],
// "thumbnail": ""
// },
// "tags": [
// "doll"
// ],
// "duration_seconds": 0,
// "created_at": "2025-11-28T03:05:53.897607+00:00",
// "updated_at": "2025-11-28T03:39:15.975164+00:00",
// "is_delete": 0,
// "gemini_success_count": 0,
// "gemini_failure_count": 0,
// "meshy_success_count": 0,
// "meshy_failure_count": 0
// },
// {
// "id": 7,
// "user_id": 1,
// "thumbnail": "",
// "title": "project",
// "description": "init",
// "details": {
// "prompt": [],
// "ip_card": [],
// "thumbnail": "",
// "model_card": []
// },
// "tags": [
// "doll"
// ],
// "duration_seconds": 0,
// "created_at": "2025-11-28T01:27:47.283082+00:00",
// "updated_at": "2025-11-28T01:27:47.283082+00:00",
// "is_delete": 0,
// "gemini_success_count": 0,
// "gemini_failure_count": 0,
// "meshy_success_count": 0,
// "meshy_failure_count": 0
// },
// {
// "id": 6,
// "user_id": 1,
// "thumbnail": "",
// "title": "project",
// "description": "init",
// "details": {
// "prompt": [],
// "ip_card": [],
// "thumbnail": "",
// "model_card": []
// },
// "tags": [
// "doll"
// ],
// "duration_seconds": 0,
// "created_at": "2025-11-27T09:38:13.654692+00:00",
// "updated_at": "2025-11-27T09:38:13.654692+00:00",
// "is_delete": 0,
// "gemini_success_count": 0,
// "gemini_failure_count": 0,
// "meshy_success_count": 0,
// "meshy_failure_count": 0
// },
// {
// "id": 5,
// "user_id": 1,
// "thumbnail": "",
// "title": "project",
// "description": "init",
// "details": {
// "prompt": [],
// "ip_card": [],
// "thumbnail": "",
// "model_card": []
// },
// "tags": [
// "doll"
// ],
// "duration_seconds": 0,
// "created_at": "2025-11-27T09:29:49.987926+00:00",
// "updated_at": "2025-11-27T09:29:49.987926+00:00",
// "is_delete": 0,
// "gemini_success_count": 27,
// "gemini_failure_count": 20,
// "meshy_success_count": 0,
// "meshy_failure_count": 0
// },
// {
// "id": 4,
// "user_id": 1,
// "thumbnail": "",
// "title": "project",
// "description": "init",
// "details": {
// "prompt": [],
// "ip_card": [],
// "thumbnail": "",
// "model_card": []
// },
// "tags": [
// "doll"
// ],
// "duration_seconds": 0,
// "created_at": "2025-11-27T09:29:23.927850+00:00",
// "updated_at": "2025-11-27T09:29:23.927850+00:00",
// "is_delete": 0,
// "gemini_success_count": 0,
// "gemini_failure_count": 0,
// "meshy_success_count": 0,
// "meshy_failure_count": 0
// },
// {
// "id": 3,
// "user_id": 1,
// "thumbnail": "",
// "title": "project",
// "description": "init",
// "details": {
// "prompt": [],
// "ip_card": [],
// "thumbnail": "",
// "model_card": []
// },
// "tags": [
// "doll"
// ],
// "duration_seconds": 0,
// "created_at": "2025-11-27T09:21:24.768031+00:00",
// "updated_at": "2025-11-27T09:21:24.768031+00:00",
// "is_delete": 0,
// "gemini_success_count": 0,
// "gemini_failure_count": 0,
// "meshy_success_count": 0,
// "meshy_failure_count": 0
// }
// ],
// "page": 1,
// "page_size": 20,
// "total": 18
// })
// return
let res = await requestUtils.common(clientApi.default.PROJECT_LIST,params)
if(res.code !== 0){
// reject(res)
}else{
resolve(res.data)
}
})
}
//叠加项目时常
addProjectDuration = (time) => {
this.duration_seconds = time;
if(Project.timer){
clearInterval(Project.timer);
}
Project.timer = setInterval(() => {
this.duration_seconds +=1;
}, 1000);
}
//获取动态提示词
async getCombinedPrompt(series){//series:项目系列D1 O1
try {
return new Promise(async (resolve, reject) => {
const res = await requestUtils.common(clientApi.default.combined)
if(res.code === 0){
let data = res.data;
// 如果是Oone系列过滤掉title中包含"动物坐姿"或"人物姿势"的提示词
if (series === 'O1') {
data = data.filter(item => {
if (!item.title) return true;
return !item.title.includes('动物坐姿') && !item.title.includes('人物姿势')&& item.type != 'D1';
});
}else if(series === 'D1'){// 如果是Done系列过滤掉type为O1的提示词
data = data.filter(item => item.type !== 'O1');
}
// 初始化返回数据结构
const result = {
person: {
content: '',
imgs: []
},
animal: {
content: '',
imgs: []
}
};
// 按sortOrder排序
data.sort((a, b) => a.sortOrder - b.sortOrder);
// 处理person和general类型的数据
const personAndGeneral = data.filter(item => item.type === 'person' || item.type === 'general'|| item.type === 'O1');
personAndGeneral.forEach(item => {
// 拼接content
result.person.content += item.content;
// 处理图片
if (item.imageUrls) {
try {
const images = JSON.parse(item.imageUrls);
if (Array.isArray(images)) {
result.person.imgs.push(...images);
}
} catch (e) {
console.error('解析imageUrls失败:', e);
}
}
});
// 处理animal和general类型的数据
const animalAndGeneral = data.filter(item => item.type === 'animal' || item.type === 'general'|| item.type === 'O1');
animalAndGeneral.forEach(item => {
// 拼接content
result.animal.content += item.content;
// 处理图片
if (item.imageUrls) {
try {
const images = JSON.parse(item.imageUrls);
if (Array.isArray(images)) {
result.animal.imgs.push(...images);
}
} catch (e) {
console.error('解析imageUrls失败:', e);
}
}
});
resolve(result);
}else{
reject(res.msg)
}
})
} catch (error) {
reject(error)
}
}
}