feat: add task type params for add new mj task

This commit is contained in:
RockYang 2023-09-16 14:01:53 +08:00
parent ae135b89d6
commit c37b3d3df5
7 changed files with 56 additions and 56 deletions

View File

@ -22,25 +22,25 @@ func NewMidJourneyFunc(mjService *service.MjService) FuncMidJourney {
func (f FuncMidJourney) Invoke(params map[string]interface{}) (string, error) { func (f FuncMidJourney) Invoke(params map[string]interface{}) (string, error) {
logger.Infof("MJ 绘画参数:%+v", params) logger.Infof("MJ 绘画参数:%+v", params)
prompt := utils.InterfaceToString(params["prompt"]) prompt := utils.InterfaceToString(params["prompt"])
if !utils.IsEmptyValue(params["--ar"]) { if !utils.IsEmptyValue(params["ar"]) {
prompt = fmt.Sprintf("%s --ar %s", prompt, params["--ar"]) prompt = fmt.Sprintf("%s --ar %s", prompt, params["ar"])
delete(params, "--ar") delete(params, "ar")
} }
if !utils.IsEmptyValue(params["--s"]) { if !utils.IsEmptyValue(params["s"]) {
prompt = fmt.Sprintf("%s --s %s", prompt, params["--s"]) prompt = fmt.Sprintf("%s --s %s", prompt, params["s"])
delete(params, "--s") delete(params, "s")
} }
if !utils.IsEmptyValue(params["--seed"]) { if !utils.IsEmptyValue(params["seed"]) {
prompt = fmt.Sprintf("%s --seed %s", prompt, params["--seed"]) prompt = fmt.Sprintf("%s --seed %s", prompt, params["seed"])
delete(params, "--seed") delete(params, "seed")
} }
if !utils.IsEmptyValue(params["--no"]) { if !utils.IsEmptyValue(params["no"]) {
prompt = fmt.Sprintf("%s --no %s", prompt, params["--no"]) prompt = fmt.Sprintf("%s --no %s", prompt, params["no"])
delete(params, "--no") delete(params, "no")
} }
if !utils.IsEmptyValue(params["--niji"]) { if !utils.IsEmptyValue(params["niji"]) {
prompt = fmt.Sprintf("%s --niji %s", prompt, params["--niji"]) prompt = fmt.Sprintf("%s --niji %s", prompt, params["niji"])
delete(params, "--niji") delete(params, "niji")
} else { } else {
prompt = prompt + " --v 5.2" prompt = prompt + " --v 5.2"
} }

View File

@ -242,25 +242,6 @@
} }
} }
} }
.el-image {
width 100%
height 100%
.image-slot {
display flex
flex-flow column
justify-content center
align-items center
height 100%
color #ffffff
.iconfont {
font-size 50px
margin-bottom 10px
}
}
}
} }
} }
@ -302,6 +283,26 @@
} }
} }
.el-image {
width 100%
height 100%
max-height 240px
.image-slot {
display flex
flex-flow column
justify-content center
align-items center
height 100%
color #ffffff
.iconfont {
font-size 50px
margin-bottom 10px
}
}
}
} }
} }

View File

@ -58,8 +58,6 @@
</template> </template>
<script setup> <script setup>
import {computed, onMounted, ref} from "vue" import {computed, onMounted, ref} from "vue"
import {httpGet, httpPost} from "@/utils/http"; import {httpGet, httpPost} from "@/utils/http";
import {ElMessage} from "element-plus"; import {ElMessage} from "element-plus";
@ -107,7 +105,7 @@ const afterRead = (file) => {
// //
httpPost('/api/upload', formData).then((res) => { httpPost('/api/upload', formData).then((res) => {
form.value.avatar = res.data form.value.avatar = res.data
ElMessage.success('上传成功') ElMessage.success({message: "上传成功", duration: 500})
}).catch((e) => { }).catch((e) => {
ElMessage.error('上传失败:' + e.message) ElMessage.error('上传失败:' + e.message)
}) })
@ -124,6 +122,7 @@ const save = function () {
httpPost('/api/user/profile/update', form.value).then(() => { httpPost('/api/user/profile/update', form.value).then(() => {
ElMessage.success({ ElMessage.success({
message: '更新成功', message: '更新成功',
duration: 500,
onClose: () => emits('hide', false) onClose: () => emits('hide', false)
}) })
// //

View File

@ -1,11 +1,11 @@
<template> <template>
<div class="waterfall" ref="container"> <div class="list-box" ref="container">
<div class="waterfall-inner"> <div class="list-inner">
<div <div
class="waterfall-item" class="list-item"
v-for="(item, index) in items" v-for="(item, index) in items"
:key="index" :key="index"
:style="{width:itemWidth + 'px', height:height+'px', marginBottom: margin*2+'px'}" :style="{width:itemWidth + 'px', marginBottom: margin*2+'px'}"
> >
<div :style="{marginLeft: margin+'px', marginRight: margin+'px'}"> <div :style="{marginLeft: margin+'px', marginRight: margin+'px'}">
<div class="item-wrapper"> <div class="item-wrapper">
@ -51,10 +51,10 @@ onMounted(() => {
const computeSize = () => { const computeSize = () => {
const w = container.value.offsetWidth - 10 // const w = container.value.offsetWidth - 10 //
let cols = Math.floor(w / props.width) let cols = Math.floor(w / props.width)
itemWidth.value = w / cols itemWidth.value = Math.floor(w / cols) - 1
while (itemWidth.value < props.width && cols > 1) { while (itemWidth.value < props.width && cols > 1) {
cols -= 1 cols -= 1
itemWidth.value = w / cols itemWidth.value = Math.floor(w / cols) - 1
} }
if (props.gap > 0) { if (props.gap > 0) {
@ -69,13 +69,13 @@ window.onresize = () => {
<style scoped lang="stylus"> <style scoped lang="stylus">
.waterfall { .list-box {
.waterfall-inner { .list-inner {
display flex display flex
flex-wrap wrap flex-wrap wrap
.waterfall-item { .list-item {
div { div {
display flex display flex

View File

@ -11,7 +11,7 @@
<div>小试牛刀</div> <div>小试牛刀</div>
</div> </div>
<div class="item-list"> <div class="list-box">
<ul> <ul>
<li v-for="item in samples" :key="item"><a @click="send(item)">{{ item }}</a></li> <li v-for="item in samples" :key="item"><a @click="send(item)">{{ item }}</a></li>
</ul> </ul>
@ -25,7 +25,7 @@
<div>插件增强</div> <div>插件增强</div>
</div> </div>
<div class="item-list"> <div class="list-box">
<ul> <ul>
<li v-for="item in plugins" :key="item.value"><a @click="send(item.value)">{{ item.text }}</a></li> <li v-for="item in plugins" :key="item.value"><a @click="send(item.value)">{{ item.text }}</a></li>
</ul> </ul>
@ -39,7 +39,7 @@
<div>能力扩展</div> <div>能力扩展</div>
</div> </div>
<div class="item-list"> <div class="list-box">
<ul> <ul>
<li v-for="item in capabilities" :key="item"> <li v-for="item in capabilities" :key="item">
<span v-if="item.value === ''">{{ item.text }}</span> <span v-if="item.value === ''">{{ item.text }}</span>
@ -139,7 +139,7 @@ const send = (text) => {
} }
} }
.item-list { .list-box {
ul { ul {
padding 10px; padding 10px;

View File

@ -543,7 +543,7 @@ const connect = function (chat_id, role_id) {
content: _role['hello_msg'], content: _role['hello_msg'],
orgContent: _role['hello_msg'], orgContent: _role['hello_msg'],
}) })
ElMessage.success("对话连接成功!") ElMessage.success({message: "对话连接成功!", duration: 500})
} else { // } else { //
loadChatHistory(chat_id); loadChatHistory(chat_id);
} }

View File

@ -215,7 +215,7 @@
<div class="task-list-inner" :style="{ height: listBoxHeight + 'px' }"> <div class="task-list-inner" :style="{ height: listBoxHeight + 'px' }">
<h2>任务列表</h2> <h2>任务列表</h2>
<div class="running-job-list"> <div class="running-job-list">
<waterfall :items="runningJobs" v-if="runningJobs.length > 0"> <ItemList :items="runningJobs" v-if="runningJobs.length > 0">
<template #default="scope"> <template #default="scope">
<div class="job-item"> <div class="job-item">
<el-popover <el-popover
@ -272,12 +272,12 @@
</div> </div>
</template> </template>
</waterfall> </ItemList>
<el-empty :image-size="100" v-else/> <el-empty :image-size="100" v-else/>
</div> </div>
<h2>创作记录</h2> <h2>创作记录</h2>
<div class="finish-job-list"> <div class="finish-job-list">
<waterfall :items="finishedJobs" height="350" v-if="finishedJobs.length > 0"> <ItemList :items="finishedJobs" v-if="finishedJobs.length > 0">
<template #default="scope"> <template #default="scope">
<div class="job-item"> <div class="job-item">
<el-popover <el-popover
@ -339,7 +339,7 @@
</div> </div>
</div> </div>
</template> </template>
</waterfall> </ItemList>
</div> <!-- end finish job list--> </div> <!-- end finish job list-->
</div> </div>
@ -356,7 +356,7 @@ import {DeleteFilled, DocumentCopy, InfoFilled, Picture, Plus} from "@element-pl
import Compressor from "compressorjs"; import Compressor from "compressorjs";
import {httpGet, httpPost} from "@/utils/http"; import {httpGet, httpPost} from "@/utils/http";
import {ElMessage} from "element-plus"; import {ElMessage} from "element-plus";
import Waterfall from "@/components/ItemList.vue"; import ItemList from "@/components/ItemList.vue";
import Clipboard from "clipboard"; import Clipboard from "clipboard";
const listBoxHeight = window.innerHeight - 40 const listBoxHeight = window.innerHeight - 40