Commit aac7852c authored by 周成波's avatar 周成波

对接通义千问,流程中增加总结角色环节

parent e32979e9
......@@ -8,7 +8,7 @@ export default {
if (!prompt) {
return Promise.reject("输入不能为空");
}
const post_data = { source_text: prompt }
const post_data = { source_text: prompt, llm: 'tyqw' }
return request.post('/text2video/text2gpt', post_data)
.then((res: any) => {
// console.log(res);
......
......@@ -34,6 +34,7 @@ export default class utils {
// 拆分文本
static splitText(str: string) {
str = str.replaceAll('“','').replaceAll('”','')
// 使用正则表达式拆分文本
let sentences = str.split(/[!|?|。]/);
// 过滤掉长度为 0 的句子
......
......@@ -45,6 +45,7 @@ export const useManyValues = () => {
task_id: "20240209114425596",
chatgpt_prompt: `生成一个100字的小故事`,
chatgpt_answer: `从前有一个小男孩名叫小明,他非常喜欢冒险和探险。一天,他听说镇上的老教堂有一个传说中的宝藏。于是,小明决定前往探寻宝藏的秘密。他兴奋地穿过了一个森林,越过了一条湍急的河流,终于来到了老教堂的门前。教堂里昏暗而阴森,小明开始在各个角落寻找宝藏。他翻遍了教堂的每一个房间,甚至爬上了教堂的钟楼,但是却没有找到宝藏的踪迹。慢慢地,小明感到失望和沮丧。正当他准备离开时,他发现了一个看似普通的石头。他突然有了一种直觉,将石头掀开,竟然发现了一道秘密通道!小明毫不犹豫地走了进去,迎接他的是散发着金光的宝藏。小明高兴地抱起宝藏,回到家中。从那天起,他决定要成为一个伟大的探险家,为世界带来更多的惊喜和宝藏。`,
chatgpt_answer_roles: [{"角色": "小明", "角色关键词": "小男孩, 性别: 男, 年龄: 10岁, 肤色: 黄色, 衣服: 破旧的牛仔裤和绿色T恤, 发型: 短发, 发色: 乌黑, 脸色: 健康的小麦色, 五官特点: 大眼睛炯炯有神, 高鼻梁, 嘴角总是挂着微笑"}],
adapt_result_json: [
{
"编号": "1",
......@@ -171,172 +172,53 @@ export const useManyValues = () => {
};
const vertical_data = {
task_id: "20240216181518705",
chatgpt_prompt: `生成一个100字的小故事`,
chatgpt_answer: `从前有一个叫小明的男孩,他非常喜欢动物。他家附近有一个小公园,那里有各种各样的动物。小明每天放学后都会去公园看动物,有时候还会和它们互动。他最喜欢的是一只叫小乖的小狗。每次小明去公园,小乖总是迎接他的到来,它用尾巴摇摆着示意小明过去玩耍。小明和小乖玩得非常开心,他们一起追逐、玩耍,仿佛成了最好的朋友。有一天,小明发现小乖不见了。他非常担心,到处寻找,却找不到小乖的踪影。他整夜没睡,很担心他的好朋友。第二天清晨,小明突然被一阵狗叫声吵醒。他赶紧跑到窗户前,发现小乖在外面叫着喊着。小明兴奋地穿上衣服,冲出家门,抱住小乖。原来小乖走失了,被一个好心的阿姨捡到并带回了家。小乖想着主人的样子,一路才能找到小明。小明感到非常高兴,他对小乖说:“以后我们要互相照顾,不再分开。”从那天起,小乖成为了小明最忠实的伙伴,他们在一起经历了许多快乐的时光。`,
task_id: "20240218223401728",
chatgpt_prompt: `我叫干净哥,一名有志男青年,职业程序员,有一个可爱的女朋友,请根据我的人设,发挥想象力,创作一个日常生活小故事,100字左右`,
chatgpt_answer: `干净哥,身为程序员的他严谨又细致,下班后总会把温馨的小窝打理得一尘不染。这天,他正专注地敲击着代码,女友捧着刚烘焙出的曲奇闯入他的视线,笑盈盈地说:“亲爱的干净哥,来尝尝我新学的甜点。”他欣然接过,甜蜜的味道在舌尖绽放,就像他们的爱情一样,平淡却温暖人心。在充满代码与爱的世界里,干净哥的生活因这份日常小确幸而更加美好。`,
chatgpt_answer_roles: [{"角色": "干净哥(程序员)", "角色关键词": "男性, 30岁, 中等肤色, 穿着休闲格子衬衫和牛仔裤, 短发, 发色为深棕色, 脸色健康红润, 眼神专注且略带笑意, 鼻梁高挺, 嘴唇薄而抿紧,显得严谨认真"}, {"角色": "女友", "角色关键词": "女性, 28岁, 白皙肤色, 穿着粉色围裙, 长卷发, 发色为浅金色, 脸色红润透亮, 明亮的眼睛笑起来像弯月, 瓜子脸, 高鼻梁, 唇形饱满, 笑容温暖而甜美"}],
adapt_result_json: [
{
"编号": "1",
"场景描述": "从前有一个叫小明的男孩,他非常喜欢动物",
"场景关键词": "从前,男孩,喜欢动物",
"角色": "小明",
"角色关键词": "男孩",
"画面描述词": "Once upon a time, there was a young boy named Xiao Ming, who had a deep passion for animals. He spent most of his days surrounded by various creatures, learning about their behaviors and habits. Xiao Ming's love for animals was evident in the way he always eagerly sought opportunities to interact with them. Whether it was visiting the local zoo, watching wildlife documentaries, or simply observing birds in his backyard, he couldn't get enough of the fascinating world of animals. Xiao Ming's gentle nature and genuine interest in animal welfare earned him the reputation of being a kind-hearted animal lover among his friends and family. His dream was to one day dedicate his life to protect and care for these beautiful creatures.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240216181518705/img/1.png?v=20240216181549815",
"local_image_path": "assets/outputs/20240216181518705/img/1.png"
"场景描述": "干净哥,身为程序员的他严谨又细致,下班后总会把温馨的小窝打理得一尘不染",
"场景关键词": "现代,室内,下班后,温馨小窝,干净整洁",
"角色": "干净哥(程序员)",
"角色关键词": "男性, 30岁, 中等肤色, 穿着休闲格子衬衫和牛仔裤, 短发, 发色为深棕色, 脸色健康红润, 眼神专注且略带笑意, 鼻梁高挺, 嘴唇薄而抿紧,显得严谨认真",
"画面描述词": "In a contemporary urban setting, the scene unfolds indoors during the tranquil hours after work. Our protagonist, Clean-Cut Guy, is a 30-year-old programmer with an intermediate complexion. Dressed in a casual plaid shirt and well-worn jeans, his short, deep brown hair frames a face that exudes health and vitality. His gaze is focused yet carries a subtle hint of a smile, reflecting both his dedication to his craft and his contentment off the clock. With a strong, straight nose and lips pressed firmly together in a display of meticulousness and seriousness, he diligently transforms his cozy apartment into a spotless haven. Every corner, every surface speaks volumes about his disciplined nature, as the space brims with warmth and orderliness under his attentive care.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240218223401728/img/1.png?v=20240218223435661",
"local_image_path": "assets/outputs/20240218223401728/img/1.png"
},
{
"编号": "2",
"场景描述": "他家附近有一个小公园,那里有各种各样的动物",
"场景关键词": "小公园,动物",
"角色": "小明,小乖",
"角色关键词": "小明:男孩,年龄较小,普通肤色,校服,普通发型,黑发色,紧张的脸色,好奇的五官特点,活泼的体态,担心的情绪,迎接的肢体动作;小乖:小狗,无性别,毛色不详,小巧的体态,亲切的情绪,摇摆尾巴的肢体动作",
"画面描述词": "There is a small park near his house, which is home to a variety of animals. One sunny day, as little Ming walked towards the park in his school uniform, his young face was filled with both nervousness and curiosity. His black hair was neatly combed and his lively body language showed his excitement. As he reached the entrance, he noticed a small dog named Little Waggie, wagging its tail and approaching him affectionately. Little Waggie had a mysterious fur color, and its petite body size made it look even cuter. It emitted a friendly and welcoming vibe. In this small park filled with various animals, Little Ming and Little Waggie were about to embark on an adventure together.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240216181518705/img/2.png?v=20240216181627543",
"local_image_path": "assets/outputs/20240216181518705/img/2.png"
"场景描述": "这天,他正专注地敲击着代码,女友捧着刚烘焙出的曲奇闯入他的视线,笑盈盈地说:亲爱的干净哥,来尝尝我新学的甜点",
"场景关键词": "现代,室内,下班后,温馨小窝,电脑桌前,明亮灯光,代码编辑器,新鲜曲奇饼干",
"角色": "干净哥(程序员),女友",
"角色关键词": "男性,30岁,中等肤色,休闲格子衬衫和牛仔裤,短发,深棕色发色,专注且略带笑意的眼神,严谨认真,女性,28岁,白皙肤色,粉色围裙,长卷发,浅金色发色,笑盈盈,温暖甜美",
"画面描述词": "Under the bright lights of their cozy apartment after work, at a computer desk in modern, indoor settings, sits \"Clean Cut Guy,\" a 30-year-old male programmer dressed in a casual plaid shirt and denim jeans. His short, deep brown hair frames his focused yet slightly amused gaze as he meticulously taps away at the code editor. Suddenly, his girlfriend, a radiant 28-year-old woman with fair skin and long, wavy golden locks tied back in a pink apron, breezes into his line of sight. She carries a tray of freshly baked chocolate chip cookies, her eyes sparkling with warmth and sweetness as she grins and says, \"Hey there, Clean Cut Guy, why don't you take a break and try my latest baking adventure?\" Her presence infuses the room with an added layer of homely comfort, interrupting the digital world momentarily with the aroma of fresh-baked goodness.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240218223401728/img/2.png?v=20240218223514940",
"local_image_path": "assets/outputs/20240218223401728/img/2.png"
},
{
"编号": "3",
"场景描述": "小明每天放学后都会去公园看动物,有时候还会和它们互动",
"场景关键词": "放学后, 公园, 动物, 互动",
"角色": "小明",
"角色关键词": "男孩, 年龄: 小, 肤色: 未提及, 衣服: 未提及, 发型: 未提及, 发色: 未提及, 脸色: 未提及, 五官特点: 未提及, 体态: 未提及, 情绪: 兴奋, 肢体动作:未提及",
"画面描述词": "Every day after school, little Ming goes to the park to watch the animals. Sometimes, he even interacts with them. Little Ming is a young boy who is full of excitement when he sees the animals. He doesn't mention his skin color, clothes, hairstyle, hair color, facial expressions, facial features, body posture, or specific body actions.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240216181518705/img/3.png?v=20240216181559204",
"local_image_path": "assets/outputs/20240216181518705/img/3.png"
"场景描述": "他欣然接过,甜蜜的味道在舌尖绽放,就像他们的爱情一样,平淡却温暖人心",
"场景关键词": "现代,室内,下班后,客厅,温馨小窝,傍晚,曲奇饼干,甜点",
"角色": "干净哥(程序员),女友",
"角色关键词": "男性,30岁,中等肤色,休闲格子衬衫,牛仔裤,深棕色短发,专注且略带笑意的眼神,女性,28岁,白皙肤色,粉色围裙,浅金色长卷发,笑起来像弯月的眼睛",
"画面描述词": "In the cozy living room of their modern, intimate apartment on a dusky evening after work, Clean-Cut Guy (a 30-year-old programmer with a medium skin tone, clad in a casual plaid shirt and denim jeans, his deep brown hair cut short and eyes focused yet twinkling with a subtle smile) sits comfortably. Across from him, his girlfriend, a radiant 28-year-old woman with fair skin and luscious, light golden curly locks cascading down her shoulders, dons a pink apron that contrasts beautifully against her beaming smile, her eyes curved like a crescent moon when she laughs. She presents him with a plate of freshly baked cookies. He accepts them eagerly, the sweetness exploding on his taste buds – an allegory for their relationship, unassuming yet profoundly heartwarming. As he savors the buttery crunch of the homemade chocolate chip cookies, the atmosphere fills with warmth and affection, encapsulating the essence of their shared life together in this温馨 haven.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240218223401728/img/3.png?v=20240218223555504",
"local_image_path": "assets/outputs/20240218223401728/img/3.png"
},
{
"编号": "4",
"场景描述": "他最喜欢的是一只叫小乖的小狗",
"场景关键词": "小公园,动物,尾巴摇摆,玩耍",
"角色": "小明,小乖",
"角色关键词": "男孩,动物喜爱者,尾巴摇摆示意,追逐,玩耍,担心,好朋友",
"画面描述词": "His favorite thing in the world was a small dog named Xiao Guai. Xiao Guai was a playful and energetic pup that always loved going to the nearby small park. It was a peaceful place where he could run freely and meet other animals. Whenever he saw Xiao Guai, his tail would wag vigorously, expressing his excitement. One sunny day, Xiao Ming, a young boy who had a deep love for animals, decided to take Xiao Guai to the small park. As soon as they arrived, Xiao Guai's tail started wagging in anticipation. The two friends spent the whole afternoon playing and chasing each other around. It was a heartwarming sight to see the joy they shared. However, in the midst of their fun, Xiao Ming noticed that Xiao Guai seemed a bit tired and worried. He immediately stopped and carefully observed his furry companion. Worried that something might be wrong, Xiao Ming gently approached Xiao Guai and asked if he was feeling okay. Xiao Guai, with his tail still wagging, assured his friend that he was just a little tired from all the playing. Relieved by Xiao Guai's response, Xiao Ming sat down beside him, and they both enjoyed the serenity of the small park. The bond between this little boy and his furry friend grew stronger with each passing day. Xiao Ming cherished their time together in the small park, watching Xiao Guai's tail wagging with delight as they played and explored their surroundings. They truly were the best of friends.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240216181518705/img/4.png?v=20240216181646796",
"local_image_path": "assets/outputs/20240216181518705/img/4.png"
},
{
"编号": "5",
"场景描述": "每次小明去公园,小乖总是迎接他的到来,它用尾巴摇摆着示意小明过去玩耍",
"场景关键词": "公园,尾巴摇摆",
"角色": "小明,小乖",
"角色关键词": "小明:男孩,年龄不详,衣服不详,发型不详,发色不详,脸色不详,五官特点不详,体态不详,情绪开心,肢体动作不详; 小乖:小狗,年龄不详,肤色不详,衣服不详,发型不详,发色不详,脸色不详,五官特点不详,体态不详,情绪开心,肢体动作摇摆尾巴",
"画面描述词": "Every time when Xiao Ming goes to the park, Xiao Guai always greets his arrival. With its tail wagging, it signals Xiao Ming to come and play. Xiao Ming, a boy whose age, clothes, hairstyle, hair color, face expression, facial features, body posture, and limb movements are unspecified, feels happy in his emotions. On the other hand, Xiao Guai, a small dog whose age, skin color, clothes, hairstyle, hair color, face expression, facial features, body posture, and limb movements are unspecified, shows its happiness by wagging its tail.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240216181518705/img/5.png?v=20240216181613343",
"local_image_path": "assets/outputs/20240216181518705/img/5.png"
},
{
"编号": "6",
"场景描述": "小明和小乖玩得非常开心,他们一起追逐、玩耍,仿佛成了最好的朋友",
"场景关键词": "公园,追逐,玩耍,最好的朋友",
"角色": "小明,小乖",
"角色关键词": "男孩,小狗",
"画面描述词": "Little Ming and Little Guai were having a blast at the park. They were running after each other, chasing and playing, as if they were the best of friends. Little Ming, a young boy, and Little Guai, a little dog, were enjoying their time together to the fullest.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240216181518705/img/6.png?v=20240216181540297",
"local_image_path": "assets/outputs/20240216181518705/img/6.png"
},
{
"编号": "7",
"场景描述": "有一天,小明发现小乖不见了",
"场景关键词": "找不见,担心,寻找,清晨,窗户前,狗叫声,家门,捡到,找回来,高兴,互相照顾",
"角色": "小明,小乖,阿姨",
"角色关键词": "男孩,男孩,女性,担心,兴奋,高兴,外貌,主人,一路才能找到",
"画面描述词": "One day, little Ming woke up in the early morning and noticed that his beloved dog, Xiao Guai, was nowhere to be found. He began to feel worried and immediately started searching for him. He went outside and stood in front of the window, hoping to catch a glimpse of Xiao Guai. Suddenly, he heard a dog barking nearby. Excitedly, he rushed towards the sound and arrived at the front gate of his house. To his relief, he saw Auntie standing there, holding Xiao Guai in her arms. Little Ming's face lit up with joy. It turned out that Auntie had found Xiao Guai wandering outside and brought him back home. Little Ming thanked Auntie profusely and hugged Xiao Guai tightly. He was immensely relieved to have found his furry friend. From that day onward, they took care of each other even more, realizing the true value of their bond. Both of them knew that they couldn't survive without one another and that they would always be there for each other, through thick and thin.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240216181518705/img/7.png?v=20240216181710358",
"local_image_path": "assets/outputs/20240216181518705/img/7.png"
},
{
"编号": "8",
"场景描述": "他非常担心,到处寻找,却找不到小乖的踪影",
"场景关键词": "担心,寻找",
"角色": "小明",
"角色关键词": "男孩,年龄:12岁,衣服:校服,发型:短发,脸色:焦虑,情绪:担心,肢体动作:匆忙地四处寻找",
"画面描述词": "He was extremely worried, searching everywhere, but couldn't find any trace of Little Guai. The boy named Xiaoming, who was 12 years old, wore his school uniform with short hair. His face was filled with anxiety as he hurriedly looked around, desperately trying to find Little Guai.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240216181518705/img/8.png?v=20240216181608615",
"local_image_path": "assets/outputs/20240216181518705/img/8.png"
},
{
"编号": "9",
"场景描述": "他整夜没睡,很担心他的好朋友",
"场景关键词": "晚上,担心",
"角色": "小明",
"角色关键词": "男孩,年龄较小,焦虑,不眠",
"画面描述词": "Little Ming couldn't sleep all night, consumed by worry for his good friend. The darkness of the night only heightened his anxiety. Being a young boy, his mind was filled with troubled thoughts. He tossed and turned, restless and sleepless, unable to shake off his apprehension.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240216181518705/img/9.png?v=20240216181622725",
"local_image_path": "assets/outputs/20240216181518705/img/9.png"
},
{
"编号": "10",
"场景描述": "第二天清晨,小明突然被一阵狗叫声吵醒",
"场景关键词": "清晨,狗叫声",
"角色": "小明",
"角色关键词": "男孩,睡眼惺忪的,短发,睡衣,兴奋,穿上衣服,冲出家门",
"画面描述词": "One early morning, as the first rays of sunlight started to peek through the window, a boy named Xiao Ming was abruptly awoken by the sound of dogs barking outside. Rubbing his half-closed eyes and with tousled short hair, he sluggishly got out of bed, still clad in his pajamas. However, the excitement in his voice was evident as he quickly dressed himself and rushed out of the house to investigate the source of the commotion.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240216181518705/img/10.png?v=20240216181700850",
"local_image_path": "assets/outputs/20240216181518705/img/10.png"
},
{
"编号": "11",
"场景描述": "他赶紧跑到窗户前,发现小乖在外面叫着喊着",
"场景关键词": "窗户,叫喊,外面",
"角色": "小明,小乖",
"角色关键词": "男孩,小狗",
"画面描述词": "He quickly ran to the window and saw that outside, Little Guai was calling and barking. The boy, Little Ming, could hear the urgent cries from his loyal dog standing outside the window.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240216181518705/img/11.png?v=20240216181636972",
"local_image_path": "assets/outputs/20240216181518705/img/11.png"
},
{
"编号": "12",
"场景描述": "小明兴奋地穿上衣服,冲出家门,抱住小乖",
"场景关键词": "兴奋,家门",
"角色": "小明,小乖",
"角色关键词": "小明(性别:男,年龄:小孩,衣服:上衣,情绪:兴奋,肢体动作:冲出家门),小乖(肢体动作:抱住)",
"画面描述词": "Excitedly, little Ming put on his shirt and dashed out of the house. He couldn't contain his joy as he rushed towards little Guai, embracing him tightly.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240216181518705/img/12.png?v=20240216181651505",
"local_image_path": "assets/outputs/20240216181518705/img/12.png"
},
{
"编号": "13",
"场景描述": "原来小乖走失了,被一个好心的阿姨捡到并带回了家",
"场景关键词": "走失,好心的阿姨,家",
"角色": "小乖",
"角色关键词": "小狗,性别:无,年龄:未知,肤色:未知,衣服:无,发型:无,发色:无,脸色:未知,五官特点:无,体态:无,情绪:走失后担心,肢体动作:叫喊",
"画面描述词": "Once upon a time, little Rover got lost and was wandering alone in the streets. Feeling scared and anxious, he let out loud cries for help. Luckily, a kind-hearted lady noticed the distressed puppy and immediately went to his rescue. She gently picked him up, holding him close to her and comforting him with soothing words. The lady knew that he must have a worried family waiting for him, so she decided to take him to her home. Little Rover felt a sense of relief and gratitude as he was carried into a warm and safe environment.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240216181518705/img/13.png?v=20240216181724274",
"local_image_path": "assets/outputs/20240216181518705/img/13.png"
},
{
"编号": "14",
"场景描述": "小乖想着主人的样子,一路才能找到小明",
"场景关键词": "寻找,道路,早晨",
"角色": "小乖,小明",
"角色关键词": "小乖:主人,失踪,喊叫,外面,阿姨,找到,高兴;小明:男孩,担心,窗户前,衣服,家门,抱住",
"画面描述词": "In the early morning, little Guaiguai, a lost dog, was wandering around outside, desperately searching for his owner. He roamed the streets, sniffing the air and hoping to catch a familiar scent. Suddenly, he heard his owner's voice calling out for him from a distance. Excitedly, he followed the sound and arrived at a small house. There, he saw a boy named Xiaoming standing near the window, wearing his favorite clothes. Overwhelmed with joy, little Guaiguai dashed towards Xiaoming and jumped into his arms. They hugged tightly, both relieved to have found each other.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240216181518705/img/14.png?v=20240216181733728",
"local_image_path": "assets/outputs/20240216181518705/img/14.png"
},
{
"编号": "15",
"场景描述": "小明感到非常高兴,他对小乖说:“以后我们要互相照顾,不再分开",
"场景关键词": "高兴,照顾,分开",
"角色": "小明,小乖",
"角色关键词": "小明:男孩,年龄较小,情绪高兴,肢体动作兴奋;小乖:小狗,对应的男孩的宠物,迎接主人,被捡到过,对主人的亲密",
"画面描述词": "Little Ming felt extremely happy, and he said to Little Guai, \"From now on, we will take care of each other and never be apart again.\" Little Ming, a young boy full of excitement and joy, expressed his feelings to Little Guai, his beloved pet dog. Little Guai, who was once abandoned but later picked up by Little Ming, always greeted his owner warmly and had formed a close bond with him. Together, they vowed to always be there for each other and never go their separate ways again.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240216181518705/img/15.png?v=20240216181743168",
"local_image_path": "assets/outputs/20240216181518705/img/15.png"
},
{
"编号": "16",
"场景描述": "”从那天起,小乖成为了小明最忠实的伙伴,他们在一起经历了许多快乐的时光",
"场景关键词": "那天,快乐的时光",
"角色": "小乖,小明",
"角色关键词": "小乖:忠实的伙伴,走失,好心的阿姨,找回,狗叫声,高兴,互相照顾;小明:主人,担心,寻找,高兴",
"画面描述词": "From that day on, Xiao Guai became Xiao Ming's most loyal companion. They shared many happy moments together. It all started when Xiao Guai got lost in a crowded market. Xiao Ming was worried sick and searched frantically for his beloved pet. Just when he was about to lose hope, a kind-hearted auntie found Xiao Guai and returned him to Xiao Ming. The joyful barks of the dog echoed through the air as they were reunited. From that moment, they became inseparable. They took care of each other, always watching out for one another. Xiao Ming was thrilled to have his furry friend back, and Xiao Guai wagged his tail happily, grateful for the love and care he received from his loyal master. Together, they created countless happy memories filled with laughter and companionship.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240216181518705/img/16.png?v=20240216181752806",
"local_image_path": "assets/outputs/20240216181518705/img/16.png"
"场景描述": "在充满代码与爱的世界里,干净哥的生活因这份日常小确幸而更加美好",
"场景关键词": "现代,室内,下班后,温馨小窝,电脑桌前,曲奇饼干,代码屏幕",
"角色": "干净哥(程序员),女友",
"角色关键词": "男性,30岁,中等肤色,休闲格子衬衫和牛仔裤,深棕色短发,专注且略带笑意,严谨认真,女性,28岁,白皙肤色,粉色围裙,浅金色长卷发,笑容温暖甜美",
"画面描述词": "In a modern indoor setting, post-work hours have descended upon a cozy little nest where the atmosphere is infused with love and lines of code. At the heart of this scene sits Clean-Guy, a 30-year-old programmer dressed in his casual plaid shirt and denim jeans, his deep brown hair trimmed short. His focused gaze dances across the illuminated screen filled with code, yet there's a subtle smile playing at the corners of his lips - an expression that reflects both his dedication and contentment. Beside him, his girlfriend stands as a vision of warmth and comfort. She's a 28-year-old woman with a fair complexion, donning a pink apron over her attire, her golden locks cascading in soft curls down to her shoulders. Her presence radiates a tender sweetness as she watches him work, a warm and affectionate smile lighting up her features. On the desk, nestled between the keyboard and the glowing monitor, rests a plate of freshly baked cookies – a small but significant daily delight that adds to the richness of Clean-Guy's life. The mingling aromas of computer circuits and homemade chocolate chip cookies create a unique symphony of their shared world, encapsulating the blend of technology and tenderness that defines their evenings together.",
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240218223401728/img/4.png?v=20240218223640906",
"local_image_path": "assets/outputs/20240218223401728/img/4.png"
}
],
final_video: "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240216181518705/final_video.mp4",
final_video: `http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240218223401728/final_video.mp4`,
};
......
......@@ -14,6 +14,7 @@ const form = reactive({
if_need_subtitle: default_data.if_need_subtitle,
chatgpt_prompt: "",
chatgpt_answer: "",
chatgpt_answer_roles: <Wm.RolesItem[]>[],
adapt_result_json: <Wm.ScriptsItem[]>[],
task_id: "",
final_video: "",
......@@ -26,12 +27,11 @@ onMounted(() => {
});
const onSubmitGpt = () => {
form.task_id = utils.genDateTimeStr();
console.log(form.task_id)
text2videoService
.submitGpt(form.chatgpt_prompt)
.then((result: string) => {
// console.log(result);
console.log(form.chatgpt_prompt);
console.log(result);
form.chatgpt_answer = result;
})
.catch((error: any) => {
......@@ -43,6 +43,49 @@ const onSubmitGpt = () => {
});
};
const onAdaptRoles = async () => {
if (!form.chatgpt_answer || form.chatgpt_answer.length == 0) {
ElMessage({
message: "文案不能为空",
type: "error",
});
return;
}
loading.value = true;
// 推理角色
try {
const adapt_restrict = `
指令:
请理解这个故事,给出这个故事的所有角色、角色关键词(性别(可以发挥想象进行补充,但一定要明确),年龄(可以发挥想象进行补充,但一定要明确),
肤色(可以发挥想象进行补充,但一定要明确),衣服(可以发挥想象进行补充,但一定要明确),发型(可以发挥想象进行补充,但一定要明确),发色(可以发挥想象进行补充,但一定要明确),
脸色(可以发挥想象进行补充,但一定要明确),五官特点(可以发挥想象进行补充,但一定要明确))。\n
要求:
角色和角色关键词要对应。
严格以如下格式返回:[{"角色":"","角色关键词":""}]`;
const keywords = await text2videoService.submitGpt(form.chatgpt_answer + "\n" + adapt_restrict);
console.log(keywords)
const keywords_obj = utils.formatJsonObj(keywords)
console.log(keywords_obj)
form.chatgpt_answer_roles = []
for (let item of keywords_obj) {
let newObjItem = {
"角色": JSON.stringify(item["角色"]).replace(/"/g, ''),
"角色关键词": JSON.stringify(item["角色关键词"]).replace(/"/g, '')
};
form.chatgpt_answer_roles.push(newObjItem);
}
console.log(form.chatgpt_answer_roles)
} catch (error) {
ElMessage({
message: String(error),
type: "error",
});
} finally {
// 最终关闭loading(无论成功或失败)
loading.value = false;
}
};
const onAdapt = async () => {
if (!form.chatgpt_answer || form.chatgpt_answer.length == 0) {
ElMessage({
......@@ -72,29 +115,33 @@ const onAdapt = async () => {
});
}
console.log(form.adapt_result_json)
// 循环处理每个分镜
const taskPromises = form.adapt_result_json.map(async (item) => {
const delay = (ms: any) => new Promise(res => setTimeout(res, ms));
async function processScenes() {
for (const item of form.adapt_result_json) {
await onAdaptOne(item);
await onDrawOne(item);
});
await delay(1000);
}
}
try {
// 等待所有请求都返回
await Promise.all(taskPromises);
await processScenes();
ElMessage({
message: String("all scene ok"),
type: "success",
message: "all scene ok",
type: "success"
});
console.log(form.adapt_result_json);
} catch (error) {
// 处理错误
ElMessage({
message: String(error),
type: "error",
type: "error"
});
} finally {
// 最终关闭loading(无论成功或失败)
loading.value = false;
loading.value = false; // 最终关闭loading(无论成功或失败)
}
};
const onAdaptOne = async (item: any) => {
......@@ -107,19 +154,22 @@ const onAdaptOne = async (item: any) => {
}
// 推理关键词
try {
const adapt_restrict = `请理解这个故事,针对其中的这个场景:“${item.场景描述}”,给出这个场景的:
const adapt_restrict = `
指令:
请理解这个故事,针对其中的这个场景:“${item.场景描述}”,给出这个场景的:
场景关键词(年代,空间,时间段,地理环境,天气,物品,人物,镜头角度)、
角色、
角色关键词(性别,年龄,肤色,衣服,发型,发色,脸色,五官特点,体态,情绪,肢体动作)。
角色(从所有角色中选择本场景的角色)、
角色关键词(从所有角色中选择本场景的角色关键字,原样拷贝)。
要求:
角色和角色关键词要对应。
以如下json字符串的格式返回:{"场景关键词":"(多个词以逗号分隔)","角色":"(角色以逗号分隔)","角色关键词":"(分别给予对应角色的关键词,多个词以逗号分隔)"}`;
const keywords = await text2videoService.submitGpt(form.chatgpt_answer + "\n" + adapt_restrict);
严格以如下格式返回:[{"场景关键词":"(多个词以逗号分隔)","角色":"(角色以逗号分隔)","角色关键词":"(分别给予对应角色的关键词,多个词以逗号分隔)"}]`;
const keywords = await text2videoService.submitGpt("故事:\n" + form.chatgpt_answer + "\n所有角色:\n"+ JSON.stringify(form.chatgpt_answer_roles)+"\n" + adapt_restrict);
// console.log(keywords)
const keywords_obj = utils.formatJsonObj(keywords)
// console.log(keywords_obj)
item.场景关键词 = JSON.stringify(keywords_obj.场景关键词).replace(/"/g, '');
item.角色 = JSON.stringify(keywords_obj.角色).replace(/"/g, '');
item.角色关键词 = JSON.stringify(keywords_obj.角色关键词).replace(/"/g, '');
item.场景关键词 = JSON.stringify(keywords_obj[0].场景关键词).replace(/"/g, '');
item.角色 = JSON.stringify(keywords_obj[0].角色).replace(/"/g, '');
item.角色关键词 = JSON.stringify(keywords_obj[0].角色关键词).replace(/"/g, '');
} catch (error) {
ElMessage({
message: String(error),
......@@ -143,7 +193,9 @@ const onDrawOne = async (item: any) => {
}
try {
const sd_describe = await text2videoService.submitGpt(
`场景描述为:${item.场景描述}\n场景关键词为:${item.场景关键词}\n场景中的角色有:${item.角色}\n角色关键词为:${item.角色关键词}\n请理解以上内容,并返回一段英文的描述。`
`场景描述为:${item.场景描述}\n场景关键词为:${item.场景关键词}\n场景中的角色有:${item.角色}\n角色关键词为:${item.角色关键词}\n
指令:
请理解以上内容,并返回一段英文的镜头描述。`
);
item.画面描述词 = sd_describe;
const sd_prompt = item.画面描述词 + "," + sd_prompt_prefix;
......@@ -153,6 +205,8 @@ const onDrawOne = async (item: any) => {
width = "540";
height = "960";
}
console.log(sd_prompt);
console.log(sd_negative_prompt_prefix);
const sd_img = await text2videoService.submitSD(form.task_id, item.编号, sd_prompt, sd_negative_prompt_prefix, width, height);
item.本镜配图 = sd_img.domain_image_path+"?v="+utils.genDateTimeStr();
item.local_image_path = sd_img.local_image_path;
......@@ -215,6 +269,7 @@ const onGenVideo = () => {
const clean_demo = () => {
form.chatgpt_prompt = "";
form.chatgpt_answer = "";
form.chatgpt_answer_roles = <Wm.RolesItem[]>[];
form.adapt_result_json = <Wm.ScriptsItem[]>[];
form.task_id = "";
form.final_video = "";
......@@ -226,17 +281,23 @@ const onChangeScreen = (val: string) => {
form.task_id = default_data.horizontal_data.task_id;
form.chatgpt_prompt = default_data.horizontal_data.chatgpt_prompt;
form.chatgpt_answer = default_data.horizontal_data.chatgpt_answer;
form.chatgpt_answer_roles = default_data.horizontal_data.chatgpt_answer_roles;
form.adapt_result_json = default_data.horizontal_data.adapt_result_json;
form.final_video = default_data.horizontal_data.final_video;
} else {
form.task_id = default_data.vertical_data.task_id;
form.chatgpt_prompt = default_data.vertical_data.chatgpt_prompt;
form.chatgpt_answer = default_data.vertical_data.chatgpt_answer;
form.chatgpt_answer_roles = default_data.vertical_data.chatgpt_answer_roles;
form.adapt_result_json = default_data.vertical_data.adapt_result_json;
form.final_video = default_data.vertical_data.final_video;
}
}
}
const showsdpromt = (item: any) => {
alert(item.画面描述词)
}
</script>
<template>
......@@ -256,15 +317,33 @@ const onChangeScreen = (val: string) => {
<el-button type="success" @click="clean_demo">清除示例数据</el-button>
</el-form-item>
<!-- Prompt到文案 -->
<el-form-item label="Promt">
<el-form-item label="Prompt">
<el-input v-model="form.chatgpt_prompt" :autosize="true" type="textarea" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmitGpt">提交gpt,生成文案</el-button>
<el-button type="primary" @click="onSubmitGpt">生成文案</el-button>
</el-form-item>
<el-form-item label="文案">
<el-input v-model="form.chatgpt_answer" :autosize="true" type="textarea" />
</el-form-item>
<!-- 角色 -->
<el-form-item>
<el-button type="primary" @click="onAdaptRoles">推理所有角色</el-button>
</el-form-item>
<el-form-item label="角色">
<el-table :data="form.chatgpt_answer_roles" border style="width: 100%; z-index: calc(var(--el-table-index) -1)">
<el-table-column prop="角色" label="角色">
<template v-slot="scope">
<el-input v-model="scope.row.角色" :autosize="true" type="textarea"></el-input>
</template>
</el-table-column>
<el-table-column prop="角色关键词" label="角色关键词">
<template v-slot="scope">
<el-input v-model="scope.row.角色关键词" :autosize="true" type="textarea"></el-input>
</template>
</el-table-column>
</el-table>
</el-form-item>
<!-- 分镜 -->
<el-form-item>
<el-button type="primary" @click="onAdapt">分镜、推理关键词、绘图</el-button>
......@@ -310,6 +389,7 @@ const onChangeScreen = (val: string) => {
<template v-slot="scope">
<div style="margin: 10px 0"><el-button type="primary" size="default" @click="onAdaptOne(scope.row)">重新推理<br />关键字</el-button></div>
<div style="margin: 10px 0"><el-button type="primary" size="default" @click="onDrawOne(scope.row)">重绘本镜</el-button></div>
<div style="margin: 10px 0"><el-button type="primary" size="small" @click="showsdpromt(scope.row)">show sd promt</el-button></div>
</template>
</el-table-column>
</el-table>
......
......@@ -21,4 +21,9 @@ declare namespace Wm {
"img_path": string,
}
interface RolesItem {
"角色": string,
"角色关键词": string,
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment