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) {
logger.Infof("MJ 绘画参数:%+v", params)
prompt := utils.InterfaceToString(params["prompt"])
if !utils.IsEmptyValue(params["--ar"]) {
prompt = fmt.Sprintf("%s --ar %s", prompt, params["--ar"])
delete(params, "--ar")
if !utils.IsEmptyValue(params["ar"]) {
prompt = fmt.Sprintf("%s --ar %s", prompt, params["ar"])
delete(params, "ar")
}
if !utils.IsEmptyValue(params["--s"]) {
prompt = fmt.Sprintf("%s --s %s", prompt, params["--s"])
delete(params, "--s")
if !utils.IsEmptyValue(params["s"]) {
prompt = fmt.Sprintf("%s --s %s", prompt, params["s"])
delete(params, "s")
}
if !utils.IsEmptyValue(params["--seed"]) {
prompt = fmt.Sprintf("%s --seed %s", prompt, params["--seed"])
delete(params, "--seed")
if !utils.IsEmptyValue(params["seed"]) {
prompt = fmt.Sprintf("%s --seed %s", prompt, params["seed"])
delete(params, "seed")
}
if !utils.IsEmptyValue(params["--no"]) {
prompt = fmt.Sprintf("%s --no %s", prompt, params["--no"])
delete(params, "--no")
if !utils.IsEmptyValue(params["no"]) {
prompt = fmt.Sprintf("%s --no %s", prompt, params["no"])
delete(params, "no")
}
if !utils.IsEmptyValue(params["--niji"]) {
prompt = fmt.Sprintf("%s --niji %s", prompt, params["--niji"])
delete(params, "--niji")
if !utils.IsEmptyValue(params["niji"]) {
prompt = fmt.Sprintf("%s --niji %s", prompt, params["niji"])
delete(params, "niji")
} else {
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>
<script setup>
import {computed, onMounted, ref} from "vue"
import {httpGet, httpPost} from "@/utils/http";
import {ElMessage} from "element-plus";
@ -107,7 +105,7 @@ const afterRead = (file) => {
//
httpPost('/api/upload', formData).then((res) => {
form.value.avatar = res.data
ElMessage.success('上传成功')
ElMessage.success({message: "上传成功", duration: 500})
}).catch((e) => {
ElMessage.error('上传失败:' + e.message)
})
@ -124,6 +122,7 @@ const save = function () {
httpPost('/api/user/profile/update', form.value).then(() => {
ElMessage.success({
message: '更新成功',
duration: 500,
onClose: () => emits('hide', false)
})
//

View File

@ -1,11 +1,11 @@
<template>
<div class="waterfall" ref="container">
<div class="waterfall-inner">
<div class="list-box" ref="container">
<div class="list-inner">
<div
class="waterfall-item"
class="list-item"
v-for="(item, index) in items"
: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 class="item-wrapper">
@ -51,10 +51,10 @@ onMounted(() => {
const computeSize = () => {
const w = container.value.offsetWidth - 10 //
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) {
cols -= 1
itemWidth.value = w / cols
itemWidth.value = Math.floor(w / cols) - 1
}
if (props.gap > 0) {
@ -69,13 +69,13 @@ window.onresize = () => {
<style scoped lang="stylus">
.waterfall {
.list-box {
.waterfall-inner {
.list-inner {
display flex
flex-wrap wrap
.waterfall-item {
.list-item {
div {
display flex

View File

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

View File

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

View File

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