useManyValues.ts 16.9 KB
Newer Older
周成波's avatar
周成波 committed
1 2 3 4 5 6 7 8
import { ref, reactive } from 'vue'
import type { CSSProperties } from 'vue'

interface MyMarkInterface {
  style: CSSProperties
  label: string
}
type MyMarkType = Record<number, MyMarkInterface | string>
周成波's avatar
周成波 committed
9 10

export const useManyValues = () => {
周成波's avatar
周成波 committed
11
  const screen = "横屏";
周成波's avatar
周成波 committed
12 13
  const horizontal_img_size = {width: "960", height: "540"};
  const vertical_img_size = {width: "540", height: "960"};
周成波's avatar
周成波 committed
14 15
  const if_need_subtitle = "false";

周成波's avatar
周成波 committed
16 17 18
  // const sd_prompt_prefix = `,best quality,masterpiece,realistic,HDR,UHD,8K,best quality,highres,absurdres,realistic,masterpiece,
  // Highly detailed,extreme detail description,Professional,cinematic_lighting,ultra-fine painting,full body,Vivid Colors,
  // physically-based rendering,cinematic`;
周成波's avatar
周成波 committed
19

周成波's avatar
周成波 committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
  // const sd_negative_prompt_prefix = `multiple breasts, (mutated hands and fingers:1.5), (long body :1.3), 
  // (mutation, poorly drawn :1.2) , black-white, bad anatomy, liquid body, liquid tongue, disfigured, 
  // malformed, mutated, anatomical nonsense, malformed hands, long neck, blurred, 
  // lowers, bad proportions, bad shadow, uncoordinated body, unnatural body, fused breasts, 
  // bad breasts, huge breasts, poorly drawn breasts, extra breasts, liquid breasts, heavy breasts, missing breasts, 
  // huge haunch, huge thighs, huge calf, bad hands, fused hand, missing hand, disappearing arms, disappearing thigh, 
  // disappearing calf, disappearing legs, fused ears, bad ears, poorly drawn ears, extra ears, liquid ears, heavy ears, 
  // missing ears, fused animal ears, bad animal ears, poorly drawn animal ears, extra animal ears, liquid animal ears, 
  // heavy animal ears, missing animal ears, text, ui, error, missing fingers, missing limb, fused fingers, 
  // one hand with more than 5 fingers, one hand with less than 5 fingers, one hand with more than 5 digit, 
  // one hand with less than 5 digit, extra digit, fewer digits, fused digit, missing digit, bad digit, liquid digit, 
  // colorful tongue, black tongue, cropped, watermark, username, blurry, JPEG artifacts, signature, 3D, 3D game, 
  // 3D game scene, 3D character, malformed feet, extra feet, bad feet, poorly drawn feet, fused feet, missing feet, 
  // extra shoes, bad shoes, fused shoes, more than two shoes, poorly drawn shoes, bad gloves, poorly drawn gloves, 
  // fused gloves, bad cum, poorly drawn cum, fused cum, bad hairs, poorly drawn hairs, fused hairs, big muscles, ugly, 
  // bad face, fused face, poorly drawn face, cloned face, big face, long face, bad eyes, fused eyes poorly drawn eyes, 
  // extra eyes, malformed limbs, more than 2 nipples, missing nipples, different nipples, fused nipples, bad nipples, 
  // poorly drawn nipples, black nipples, colorful nipples, gross proportions. short arm, (((missing arms))), missing thighs, 
  // missing calf, missing legs, mutation, duplicate, morbid, mutilated, poorly drawn hands, more than 1 left hand, 
  // more than 1 right hand, deformed, (blurry), disfigured, missing legs, extra arms, extra thighs, more than 2 thighs, 
  // extra calf, fused calf, nsfw,logo,text,extra legs, bad knee, extra knee, more than 2 legs, bad tails, bad mouth, 
  // fused mouth, poorly drawn mouth, bad tongue, tongue within mouth, too long tongue, black tongue, big mouth, cracked mouth, 
  // bad mouth, dirty face, dirty teeth, dirty pantie, fused pantie, poorly drawn pantie, fused cloth, poorly drawn cloth, bad pantie, 
  // yellow teeth, thick lips, bad cameltoe, colorful cameltoe, bad asshole, poorly drawn asshole, fused asshole, missing asshole, 
  // bad anus, bad pussy, bad crotch, bad crotch seam, fused anus, fused pussy, fused anus, fused crotch, poorly drawn crotch, 
  // fused seam, poorly drawn anus, poorly drawn pussy, poorly drawn crotch, poorly drawn crotch seam, bad thigh gap, missing thigh gap, 
  // fused thigh gap, liquid thigh gap, poorly drawn thigh gap, poorly drawn anus, bad collarbone, fused collarbone, missing collarbone, 
  // liquid collarbone, obesity, worst quality, low quality, normal quality, liquid tentacles, bad tentacles, poorly drawn tentacles, 
  // split tentacles, fused tentacles, missing clit, bad clit, fused clit, colorful clit, black clit, liquid clit, QR code, bar code, censored, 
  // safety panties, safety knickers, beard, furry ,pony, pubic hair, mosaic, excrement, faeces, shit, futa, testis,mutated hands and fingers,
  // deformed,bad anatomy,disfigured,poorly drawn face,lowres,mutated,extra limb,ugly,poorly drawn hands,missing limb,floating limbs,
  // disconnected limbs,malformed hands,out of focus,long neck,long body,gape,`;
  const sd_prompt_prefix = `,best quality,masterpiece,realistic,Highly detailed,Professional,cinematic_lighting,Vivid Colors,physically-based rendering`;
  // ,malformed,cropped, watermark, username, blurry, JPEG artifacts, signature, 3D, 3D game, 3D game scene, 3D character, QR code, bar code, censored,out of focus
  const sd_negative_prompt_prefix = `(mutated hands and fingers:1.5),(mutation, poorly drawn :1.2)`;
周成波's avatar
周成波 committed
55

周成波's avatar
周成波 committed
56 57 58 59 60
  const llms = {
    tyqw_online: {'api': 'tyqw', 'name':'线上通义千问'},
    baichuan: {'api': 'langchain', 'name':'本地baichuan2-7b'},
    qwen_local: {'api': 'langchain', 'name':'本地Qwen-7B-Chat'},
    chatgpt: {'api': 'gpt', 'name':'chatgpt'},
周成波's avatar
周成波 committed
61
    kimi: {'api': 'kimi', 'name':'kimi'},
周成波's avatar
周成波 committed
62 63
  };

周成波's avatar
周成波 committed
64 65
  const horizontal_data = {
    task_id: "20240209114425596",
周成波's avatar
周成波 committed
66
    chatgpt_prompt: `生成一个50字的小故事`,
周成波's avatar
周成波 committed
67 68
    chatgpt_answer: ``,
    chatgpt_answer_roles: [],
周成波's avatar
周成波 committed
69
    all_roles: "",
周成波's avatar
周成波 committed
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
    adapt_result_json: [
      {
          "编号": "1",
          "场景描述": "森林里的美味秘密是什么呢",
          "场景关键词": "\"葱郁绿林深处,隐藏着一份鲜为人知的美味秘密,它在枝叶间悄然生长,诱惑着探寻者的味蕾与好奇心。\"",
          "场景关键词英文": "Deep in the lush green forest, there is a little-known delicious secret. It grows quietly among the branches and leaves, tempting the taste buds and curiosity of the explorer.",
          "角色": "",
          "角色关键词": "",
          "角色关键词英文": "",
          "画面描述词": "Deep in the lush green forest, there is a little-known delicious secret. It grows quietly among the branches and leaves, tempting the taste buds and curiosity of the explorer.,",
          "本镜配图": "http://wm-tools-backend.frp.wmdigit.com:8888/assets/outputs/20240209114425596/img/1_resized.png?v=20240321152031224",
          "local_image_path": "assets/outputs/20240209114425596/img/1_resized.png",
          "info": "",
          "roles": []
      },
      {
          "编号": "2",
          "场景描述": "在葱郁的绿林中",
          "场景关键词": "葱郁的绿林中,枝叶茂密如绿色帷幕,阳光斑驳洒落,交织出神秘光影,其间鸟语花香,生机盎然,仿佛隐藏着无尽的秘密与美味。",
          "场景关键词英文": "In the lush green forest, the branches and leaves are as dense as a green curtain, the sun is mottled and scattered, interwoven with mysterious light and shadow, during which birds and flowers are fragrant, full of vitality, as if hiding endless secrets and delicacies.",
          "角色": "",
          "角色关键词": "",
          "角色关键词英文": "",
          "画面描述词": "In the lush green forest, the branches and leaves are as dense as a green curtain, the sun is mottled and scattered, interwoven with mysterious light and shadow, during which birds and flowers are fragrant, full of vitality, as if hiding endless secrets and delicacies.,",
          "本镜配图": "http://wm-tools-backend.frp.wmdigit.com:8888/assets/outputs/20240209114425596/img/2_resized.png?v=20240321152034264",
          "local_image_path": "assets/outputs/20240209114425596/img/2_resized.png",
          "info": "",
          "roles": []
      }
  ],
周成波's avatar
周成波 committed
100
    final_video: ``,
周成波's avatar
周成波 committed
101 102 103
  };

  const vertical_data = {
104
    task_id: "20240220181602687",
周成波's avatar
周成波 committed
105
    chatgpt_prompt: `生成一个50字的科幻小故事,阿凡达系列`,
周成波's avatar
周成波 committed
106
    chatgpt_answer: `森林里的美味秘密是什么呢?在葱郁的绿林中,一只机敏的小松鼠和一只温顺的大熊结伴而行,他们跨越山涧,攀爬树木,只为寻找传说中的金巧蒂。这不仅仅是一种美食,而是一段由新鲜、柔软、香酥编织的传奇。狡猾的狐狸也觊觎这份美味,但在小松鼠和大熊的智勇合作下,美味得以保全。他们分享了这份酥香,友谊也在森林中流传开来。`,
周成波's avatar
周成波 committed
107 108
    chatgpt_answer_roles: [
      {
周成波's avatar
周成波 committed
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
          "角色": "小松鼠",
          "角色关键词": "",
          "角色关键词英文": "",
          "属性": "动物"
      },
      {
          "角色": "大熊",
          "角色关键词": "",
          "角色关键词英文": "",
          "属性": "动物"
      },
      {
          "角色": "狐狸",
          "角色关键词": "",
          "角色关键词英文": "",
周成波's avatar
周成波 committed
124 125 126 127 128 129
          "属性": "动物"
      }
  ],
    adapt_result_json: [
      {
          "编号": "1",
周成波's avatar
周成波 committed
130
          "场景描述": "森林里的美味秘密是什么呢",
周成波's avatar
周成波 committed
131 132
          "场景关键词": "在葱郁神秘的森林深处,隐藏着一种令人垂涎欲滴的美食秘密,引得动物们纷纷探寻,交织出一段段奇妙冒险。",
          "场景关键词英文": "Deep in the lush and mysterious forest, there is a mouth-watering food secret hidden, which attracts animals to explore and interweave a wonderful adventure.",
周成波's avatar
周成波 committed
133
          "角色": "",
周成波's avatar
周成波 committed
134 135
          "角色关键词": "",
          "角色关键词英文": "",
周成波's avatar
周成波 committed
136 137 138
          "画面描述词": "Deep in the lush and mysterious forest, there is a mouth-watering food secret hidden, which attracts animals to explore and interweave a wonderful adventure.,",
          "本镜配图": "http://wm-tools-backend.frp.wmdigit.com:8888/assets/outputs/20240320160758713/img/1_resized.png?v=20240320160811071",
          "local_image_path": "assets/outputs/20240320160758713/img/1_resized.png",
周成波's avatar
周成波 committed
139 140
          "info": "",
          "roles": []
周成波's avatar
周成波 committed
141 142
      }
  ],
周成波's avatar
周成波 committed
143
    all_roles: "小松鼠, 大熊, 狐狸",
144
    final_video: ``,
周成波's avatar
周成波 committed
145 146
  };

周成波's avatar
周成波 committed
147
  const en_vertical_data = {
148
    task_id: "20240225222232784",
周成波's avatar
周成波 committed
149
    chatgpt_prompt: `Generate a 50 words science fiction short story, Avatar series`,
150
    chatgpt_answer: `In a futuristic world, humans have developed the ability to upload their consciousness into virtual avatars. These avatars explore distant planets, collecting information for their creators. One day, a group of avatars stumble upon a planet inhabited by sentient beings who are also able to upload their consciousness. A new alliance is formed.`,
151 152 153
    chatgpt_answer_roles: [],
    adapt_result_json: [],
    final_video: ``,
周成波's avatar
周成波 committed
154
  };
周成波's avatar
周成波 committed
155

周成波's avatar
周成波 committed
156 157 158 159 160 161 162 163 164 165 166
  const marks = reactive<MyMarkType>({
    '-100': '-100%',
    '-90': '-90%',
    '-80': '-80%',
    '-70': '-70%',
    '-60': '-60%',
    '-50': '-50%',
    '-40': '-40%',
    '-30': '-30%',
    '-20': '-20%',
    '-10': '-10%',
周成波's avatar
周成波 committed
167 168 169 170 171 172
    0: {
      style: {
        color: '#1989FA',
      },
      label: '标准',
    },
周成波's avatar
周成波 committed
173 174 175 176 177 178 179 180 181 182
    10: '+10%',
    20: '+20%',
    30: '+30%',
    40: '+40%',
    50: '+50%',
    60: '+60%',
    70: '+70%',
    80: '+80%',
    90: '+90%',
    100: '+100%',
183 184 185 186 187 188 189 190 191 192 193 194 195 196
  });

  const bgm_volume_marks = reactive<MyMarkType>({
    0: '-100%',
    0.5: '-50%',
    1.0: {
      style: {
        color: '#1989FA',
      },
      label: '标准音量',
    },
    1.5: '+50%',
    2.0: '+100%',
  });
197

周成波's avatar
周成波 committed
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
  const voices = [
    {
      value: 'zh-CN-liaoning-XiaobeiNeural',
      gender: 'Female',
      label: '女,东北口音',
    },
    {
      value: 'zh-CN-shaanxi-XiaoniNeural',
      gender: 'Female',
      label: '女,陕西口音',
    },
    {
      value: 'zh-CN-XiaoxiaoNeural',
      gender: 'Female',
      label: '女,像个老师',
    },
    {
      value: 'zh-CN-XiaoyiNeural',
      gender: 'Female',
      label: '女,小女孩',
    },
    {
      value: 'zh-CN-YunjianNeural',
      gender: 'Male',
      label: '男,成熟稳重',
    },
    {
      value: 'zh-CN-YunxiaNeural',
      gender: 'Male',
      label: '男,小男孩',
    },
    {
      value: 'zh-CN-YunxiNeural',
      gender: 'Male',
      label: '男,大哥哥',
    },{
      value: 'zh-CN-YunyangNeural',
      gender: 'Male',
      label: '男,像个播音员',
    },{
      value: 'zh-HK-HiuGaaiNeural',
      gender: 'Female',
      label: '女,粤语,中年',
    },{
      value: 'zh-HK-HiuMaanNeural',
      gender: 'Female',
      label: '女,粤语,年轻',
    },{
      value: 'zh-HK-WanLungNeural',
      gender: 'Male',
      label: '男,粤语',
    },{
      value: 'zh-TW-HsiaoChenNeural',
      gender: 'Female',
      label: '女,台湾腔',
    },{
      value: 'zh-TW-HsiaoYuNeural',
      gender: 'Female',
      label: '女,台湾,偏普通话',
    },{
      value: 'zh-TW-YunJheNeural',
      gender: 'Male',
      label: '男,台湾腔',
    },
周成波's avatar
周成波 committed
262
  ];
周成波's avatar
周成波 committed
263

264 265 266 267 268 269
  const voices_en = [
    {
      value: 'en-US-BrianNeural',
      gender: 'Male',
      label: '男,美式磁性',
    },
周成波's avatar
周成波 committed
270
  ];
271

周成波's avatar
周成波 committed
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
  const bgm = [
    {
      value: '',
      label: '无',
    },
    {
      value: '安魂曲',
      label: '安魂曲',
    },
    {
      value: '解忧曲',
      label: '解忧曲',
    },
    {
      value: 'Anacreon',
      label: 'Anacreon',
    },
    {
      value: 'MySunset',
      label: 'MySunset',
    },
    {
      value: 'WindyHill',
      label: 'WindyHill',
    },
297 298 299 300 301 302 303 304
    {
      value: '雨声',
      label: '雨声',
    },
    {
      value: '大自然',
      label: '大自然',
    },
周成波's avatar
周成波 committed
305 306 307 308 309 310 311 312 313 314 315 316
  ];

  const role_attribute_options = [
    {
      value: '人',
      label: '人',
    },
    {
      value: '动物',
      label: '动物',
    },
  ];
317 318 319

  const sd_paras = {
    dreamshaperXL_v21TurboDPMSDE: {
320
      model: "dreamshaperXL_v21TurboDPMSDE.safetensors",
321 322 323 324
      sampler_index: "DPM++ SDE Karras",
      seed: "-1",
      steps: "6",
      cfg_scale: "2",
周成波's avatar
周成波 committed
325
      sd_prompt_prefix: sd_prompt_prefix
326 327
    },
    juggernautXL_v9Rdphoto2Lightning: {
328
      model: "juggernautXL_v9Rdphoto2Lightning.safetensors",
329 330 331
      sampler_index: "Euler",
      seed: "-1",
      steps: "8",
周成波's avatar
周成波 committed
332
      cfg_scale: "1.5",
周成波's avatar
周成波 committed
333
      sd_prompt_prefix: sd_prompt_prefix + ", <lora:sdxl_lightning_8step_lora:0.2>",
334 335
    },
  };
周成波's avatar
周成波 committed
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353

  const marketing_template = {
    product_name: "金巧蒂原味猪肉松",
    product_description: 
    `1. 酥而不腻,入口即化
2. 原料主要采用新鲜猪后腿肉,经过水域立即处理,加上老师傅祖传的配方,结合现代化的生产工艺,锤炼出柔软酥松,绵而不腻,味香可口的“猪肉松”,并全程使用“多力牌”葵花油
3. 选用天然万家香酱油
4. 选用蒂纳海盐
5. 猪肉松的主要营养成分有碳水化合物、脂肪、蛋白质和多种矿物质,胆固醇含量低,且易于人体消化吸收,具有很高的营养价值。但是要注意一点,猪肉松不能与鹌鹑肉同食,吃多容易生黑斑哦
6. 我们“金巧蒂”的产品,确保是在屠宰后2小时内进行加工,绝对锁住肉质口感不流失。猪肉肉质细腻且营养价值丰富,对人体有极高的营养价值及保健作用,如长期食用可延年益寿,并有着汤汁浓郁,绕齿留香的特点`,
    target_people: "20-30岁年轻女生",
    text_role: "小松鼠",
    text_style: "幽默",
    story_type: "科幻",
    reference: "猪八戒娶媳妇儿的情节",
    words_num: 100,
    result1: "",
    result2: "",
周成波's avatar
周成波 committed
354 355 356
  };

  const cover_backcover = {
周成波's avatar
周成波 committed
357 358 359 360
    product_pic: "http://wm-tools-backend.frp.wmdigit.com:8888/assets/2024/03/12/887a52c6-e022-11ee-a7de-9be5c7a16c02_resized.png",
    product_pic_local: "assets/2024/03/12/887a52c6-e022-11ee-a7de-9be5c7a16c02_resized.png",
    product_pic_with_text: "http://wm-tools-backend.frp.wmdigit.com:8888/assets/2024/03/12/887a52c6-e022-11ee-a7de-9be5c7a16c02_resized_with_text.png",
    product_pic_with_text_local: "assets/2024/03/12/887a52c6-e022-11ee-a7de-9be5c7a16c02_resized_with_text.png",
周成波's avatar
周成波 committed
361
    product_pic_titles: [],
周成波's avatar
周成波 committed
362
    product_pic_speech: "",
363 364 365 366
    cover_pic: "http://wm-tools-backend.frp.wmdigit.com:8888/assets/2024/03/12/10170c9e-e035-11ee-a7de-9be5c7a16c02_resized.jpg",
    cover_pic_local: "assets/2024/03/12/10170c9e-e035-11ee-a7de-9be5c7a16c02_resized.jpg",
    cover_pic_with_text: "http://wm-tools-backend.frp.wmdigit.com:8888/assets/2024/03/12/10170c9e-e035-11ee-a7de-9be5c7a16c02_resized_with_text.jpg",
    cover_pic_with_text_local: "assets/2024/03/12/10170c9e-e035-11ee-a7de-9be5c7a16c02_resized_with_text.jpg",
周成波's avatar
周成波 committed
367
    cover_pic_titles: [],
周成波's avatar
周成波 committed
368
  };
周成波's avatar
周成波 committed
369
  
周成波's avatar
周成波 committed
370 371
  return {
    screen: screen,
周成波's avatar
周成波 committed
372 373
    horizontal_img_size: horizontal_img_size,
    vertical_img_size: vertical_img_size,
周成波's avatar
周成波 committed
374 375
    sd_prompt_prefix: sd_prompt_prefix,
    sd_negative_prompt_prefix: sd_negative_prompt_prefix,
周成波's avatar
周成波 committed
376
    llms: llms,
周成波's avatar
周成波 committed
377 378 379
    horizontal_data: horizontal_data,
    vertical_data: vertical_data,
    if_need_subtitle: if_need_subtitle,
周成波's avatar
周成波 committed
380
    en_vertical_data: en_vertical_data,
周成波's avatar
周成波 committed
381 382
    marks: marks,
    voices: voices,
383
    voices_en: voices_en,
周成波's avatar
周成波 committed
384
    bgm: bgm,
385
    bgm_volume_marks: bgm_volume_marks,
周成波's avatar
周成波 committed
386
    role_attribute_options: role_attribute_options,
387
    sd_paras: sd_paras,
周成波's avatar
周成波 committed
388
    marketing_template: marketing_template,
周成波's avatar
周成波 committed
389
    cover_backcover: cover_backcover,
周成波's avatar
周成波 committed
390 391
  }
}