Commit 4ddd03e7 authored by 周成波's avatar 周成波

v20240203-fix-ok2

parent 081fd0bd
......@@ -5,13 +5,58 @@ import { ElMessage, ElLoading } from "element-plus";
import text2videoService from "@/api/service/text2videoService";
import utils from "@/utils/utils";
const debug = ref(false);
const loading = ref(false);
const form = reactive({
chatgpt_prompt: "帮我生成一个在丧尸横行的末世中,一个特种兵大杀四方,最后成为新世界的王,拥有无数女人的爽文故事,约200字左右",
chatgpt_answer:
`在丧尸横行的末世中,特种兵杨轩犹如一道闪电,横扫四方。他身负着研制的特殊型丧尸武器,每次出击都是血雨腥风。杨轩的勇猛无畏深深震撼了其他幸存者,他们纷纷投靠于他的旗下。 逐渐地,杨轩建立起一座摇摇欲坠的王城“无敌之城”,成为了希望的象征。他带领着军队与丧尸们战斗,一次次逆袭,最终统一了丧尸肆虐的土地。 在这个新世界,杨轩成为了王者,摄政了数万女人的心。他英勇无敌的战绩和无私的领导才能令女人们痴迷。杨轩学会了爱护她们,温情细腻地照顾着每一个人。他们被他的坚毅与温柔深深吸引,陶醉在他的怀抱中。 然而,杨轩却不为无尽的女人所动,因为他深爱着一个人——那是他在丧尸横行时遇见的纯真灵魂。她是唯一敢与他争论,却又唯一能让他动心的存在。 杨轩的故事成为了末世传说,他的王朝将永远被世人传颂。他用自己的力量创造了新的世界,不再有恐惧和黑暗,取而代之的是和平与繁荣。 这是一个故事,关于一个特种兵,杀戮如潮,却为了寻找爱情而战斗。他成为了新世界的王,但他最终明白,真正让他心驰神往的不是权势与财富,而是那个平凡而温暖的女孩。`,
// adapt_result_json: <Wm.ScriptsItem[]>[],
adapt_result_json: [
chatgpt_prompt: "",
chatgpt_answer: "",
adapt_result_json: <Wm.ScriptsItem[]>[],
task_id: "",
final_video: "",
});
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,`;
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,`;
onMounted(() => {
if (debug.value == true) {
form.chatgpt_prompt = `帮我生成一个在丧尸横行的末世中,一个特种兵大杀四方,最后成为新世界的王,拥有无数女人的爽文故事,约200字左右`;
form.chatgpt_answer = `在丧尸横行的末世中,特种兵杨轩犹如一道闪电,横扫四方。他身负着研制的特殊型丧尸武器,每次出击都是血雨腥风。杨轩的勇猛无畏深深震撼了其他幸存者,他们纷纷投靠于他的旗下。 逐渐地,杨轩建立起一座摇摇欲坠的王城“无敌之城”,成为了希望的象征。他带领着军队与丧尸们战斗,一次次逆袭,最终统一了丧尸肆虐的土地。 在这个新世界,杨轩成为了王者,摄政了数万女人的心。他英勇无敌的战绩和无私的领导才能令女人们痴迷。杨轩学会了爱护她们,温情细腻地照顾着每一个人。他们被他的坚毅与温柔深深吸引,陶醉在他的怀抱中。 然而,杨轩却不为无尽的女人所动,因为他深爱着一个人——那是他在丧尸横行时遇见的纯真灵魂。她是唯一敢与他争论,却又唯一能让他动心的存在。 杨轩的故事成为了末世传说,他的王朝将永远被世人传颂。他用自己的力量创造了新的世界,不再有恐惧和黑暗,取而代之的是和平与繁荣。 这是一个故事,关于一个特种兵,杀戮如潮,却为了寻找爱情而战斗。他成为了新世界的王,但他最终明白,真正让他心驰神往的不是权势与财富,而是那个平凡而温暖的女孩。`;
form.adapt_result_json = [
{
"编号": "1",
"场景描述": "在丧尸横行的末世中,特种兵杨轩犹如一道闪电,横扫四方",
......@@ -162,59 +207,42 @@ const form = reactive({
"本镜配图": "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240203010153059/img/15.png?v=20240203010921369",
"local_image_path": "assets/outputs/20240203010153059/img/15.png"
}
],
final_video: "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240203010153059/final_video.mp4",
];
form.task_id = "20240203010153059";
form.final_video = "http://wm_tools_backend.frp.wmdigit.com:8888/assets/outputs/20240203010153059/final_video.mp4";
}
});
const task_id = ref("20240203010153059")
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,`;
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,`;
onMounted(() => { });
const onSubmitGpt = () => {
task_id.value = utils.genDateTimeStr();
console.log(task_id.value)
form.task_id = utils.genDateTimeStr();
console.log(form.task_id)
text2videoService
.submitGpt(form.chatgpt_prompt)
.then((result: string) => {
// console.log(result);
form.chatgpt_answer = result;
})
.catch((error: any) => {
// console.error(error);
ElMessage({
message: error,
type: "error",
});
});
};
const onAdapt = async () => {
if (!form.chatgpt_answer || form.chatgpt_answer.length == 0) {
ElMessage({
message: "文案不能为空",
type: "error",
});
return;
}
loading.value = true;
form.task_id = utils.genDateTimeStr();
console.log(form.task_id)
// 按标点拆分成分镜
const sentences = utils.splitText(form.chatgpt_answer);
console.log(sentences.length)
......@@ -233,27 +261,6 @@ const onSubmitGpt = () => {
});
}
console.log(form.adapt_result_json)
})
.catch((error: any) => {
// console.error(error);
ElMessage({
message: error,
type: "error",
});
});
};
const onAdapt = async () => {
if (!form.adapt_result_json || form.adapt_result_json.length == 0) {
ElMessage({
message: "分镜不能为空",
type: "error",
});
return;
}
loading.value = true;
task_id.value = utils.genDateTimeStr();
console.log(task_id.value)
// 循环处理每个分镜
const taskPromises = form.adapt_result_json.map(async (item) => {
await onAdaptOne(item);
......@@ -263,9 +270,10 @@ const onAdapt = async () => {
// 等待所有请求都返回
await Promise.all(taskPromises);
ElMessage({
message: String("all over"),
message: String("all scene ok"),
type: "success",
});
console.log(form.adapt_result_json);
} catch (error) {
// 处理错误
ElMessage({
......@@ -299,9 +307,9 @@ const onAdaptOne = async (item: any) => {
// console.log(keywords)
const keywords_obj = utils.formatJsonObj(keywords)
// console.log(keywords_obj)
item.场景关键词 = JSON.stringify(keywords_obj.场景关键词);
item.角色 = JSON.stringify(keywords_obj.角色);
item.角色关键词 = JSON.stringify(keywords_obj.角色关键词);
item.场景关键词 = JSON.stringify(keywords_obj.场景关键词).replace(/"/g, '');
item.角色 = JSON.stringify(keywords_obj.角色).replace(/"/g, '');
item.角色关键词 = JSON.stringify(keywords_obj.角色关键词).replace(/"/g, '');
} catch (error) {
ElMessage({
message: String(error),
......@@ -320,17 +328,17 @@ const onDrawOne = async (item: any) => {
return;
}
// 翻译+画图
if (!task_id.value) {
task_id.value = utils.genDateTimeStr();
console.log(task_id.value)
if (!form.task_id) {
form.task_id = utils.genDateTimeStr();
console.log(form.task_id)
}
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;
const sd_img = await text2videoService.submitSD(task_id.value, item.编号, sd_prompt, sd_negative_prompt_prefix);
const sd_img = await text2videoService.submitSD(form.task_id, item.编号, sd_prompt, sd_negative_prompt_prefix);
item.本镜配图 = sd_img.domain_image_path+"?v="+utils.genDateTimeStr();
item.local_image_path = sd_img.local_image_path;
} catch (error) {
......@@ -361,7 +369,7 @@ const onGenVideo = () => {
}
});
if (!is_all_ok) return;
console.log(form.adapt_result_json)
console.log(form.adapt_result_json);
const video_param_detail = form.adapt_result_json.map(item => {
return {
idx: item.编号,
......@@ -370,7 +378,7 @@ const onGenVideo = () => {
};
});
const video_param = {
task_id: task_id.value,
task_id: form.task_id,
task_info: video_param_detail
}
text2videoService
......@@ -396,7 +404,7 @@ const onGenVideo = () => {
<el-divider content-position="left">text2video</el-divider>
<el-form :model="form" label-width="114px" v-loading="loading">
<!-- Prompt到文案 -->
<el-form-item label="Text">
<el-form-item label="Promt">
<el-input v-model="form.chatgpt_prompt" :autosize="true" type="textarea" />
</el-form-item>
<el-form-item>
......@@ -407,7 +415,7 @@ const onGenVideo = () => {
</el-form-item>
<!-- 分镜 -->
<el-form-item>
<el-button type="primary" @click="onAdapt">推理关键词,并绘图</el-button>
<el-button type="primary" @click="onAdapt">分镜、推理关键词、绘图</el-button>
</el-form-item>
<el-form-item label="分镜">
<el-table :data="form.adapt_result_json" border style="width: 100%; z-index: calc(var(--el-table-index) -1)">
......
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