1. 新增MJ V7 模型
2. 添加MJ生图包
This commit is contained in:
2025-04-08 14:37:35 +08:00
parent c43abd6908
commit 863ac4d7f4
19 changed files with 320 additions and 44 deletions
@@ -137,4 +137,27 @@ defineProps({
.clickable-link:hover {
color: #0055cc;
}
</style>
</style>
<style>
/* 这些样式类将全局可用,可以在插槽内容中使用 */
.clickable-link {
color: #0077ff;
text-decoration: underline;
cursor: pointer;
transition: color 0.2s ease;
}
.clickable-link:hover {
color: #0055cc;
}
.notes-content p {
margin: 4px 0;
color: #5c3c10;
}
.notes-content strong {
font-weight: bold;
}
</style>
@@ -134,6 +134,3 @@ function openExternalLink(url) {
window.api.OpenUrl(url)
}
</script>
<style scoped>
@import '../../../assets//css//note.less';
</style>
@@ -0,0 +1,106 @@
<template>
<n-card title="生图包设置" hoverable style="margin-top: 10px; min-width: 850px" size="medium">
<n-form inline>
<n-space align="center" :size="12">
<n-form-item label="套餐选择">
<n-select
v-model:value="optionStore.MJ_GlobalSetting.mj_imagePackageSetting.selectPackage"
:options="GetMJUrlOptions('package')"
placeholder="选择套餐"
style="min-width: 200px"
/>
</n-form-item>
<n-form-item>
<n-button type="primary" @click="handleBuy"> 购买 </n-button>
</n-form-item>
<n-form-item label="Token">
<n-input
type="password"
v-model:value="optionStore.MJ_GlobalSetting.mj_imagePackageSetting.token"
placeholder="输入Token"
show-password-on="mousedown"
style="min-width: 200px"
/>
</n-form-item>
<n-form-item label="出图代理">
<n-select
v-model:value="optionStore.MJ_GlobalSetting.mj_imagePackageSetting.selectedProxy"
:options="ImagePackageProxyOptions"
placeholder="选择出图代理"
style="min-width: 200px"
/>
</n-form-item>
<!-- <n-form-item>
<n-button @click="handleQuery"> 查询 </n-button>
</n-form-item> -->
</n-space>
</n-form>
<NotesCollapse title="注意事项">
<p>
1. 使用生图包前请确保您已完成套餐购买<strong>未购买套餐将无法使用相关功能</strong>
</p>
<p>2. 标准生图包最大并发数为3具体并发数量以您所购买的套餐规格为准</p>
<p>3. 出图代理支持香港和美国节点选择也兼容系统默认代理设置与代理模式保持一致</p>
<p>
4. 您可随时点击 <strong>"查询"</strong> 按钮实时查看当前套餐已使用的出图数量及剩余额度
</p>
</NotesCollapse>
</n-card>
</template>
<script setup>
import { useMessage, NCard, NForm, NFormItem, NButton, NSelect, NInput, NSpace } from 'naive-ui'
import { GetMJUrlOptions } from '@/define/api/apiUrlDefine'
import { useOptionStore } from '@/stores/option'
import { ImagePackageProxyOptions } from '@/define/data/settingData'
import { isEmpty } from 'lodash'
import NotesCollapse from '../../Common/NotesCollapse.vue'
const optionStore = useOptionStore()
const message = useMessage()
/**
* 打开购买网址
*/
const handleBuy = async () => {
let selectAPIUrl = GetMJUrlOptions('package').filter(
(item) => item.value == optionStore.MJ_GlobalSetting.mj_imagePackageSetting.selectPackage
)
if (selectAPIUrl.length == 0) {
message.error('当前选择的服务商没有购买地址!')
return
}
let buy_url = selectAPIUrl[0].buy_url
if (isEmpty(buy_url)) {
message.error('当前选择的服务商没有购买地址!')
} else {
window.api.OpenUrl(buy_url)
}
}
/**
* 查询地址
*/
const handleQuery = () => {
let selectAPIUrl = GetMJUrlOptions('package').filter(
(item) => item.value == optionStore.MJ_GlobalSetting.mj_imagePackageSetting.selectPackage
)
if (selectAPIUrl.length == 0) {
message.error('当前选择的服务商没有购买地址!')
return
}
let queryUrl = selectAPIUrl[0]?.mj_url?.query_url
if (isEmpty(queryUrl)) {
message.error('当前选择的服务商没有查询地址!')
} else {
window.api.OpenUrl(queryUrl)
}
}
</script>
<style scoped>
/* 可以添加自定义样式 */
</style>
@@ -1,6 +1,10 @@
<template>
<div class="mj-remote-setting">
<n-card title="本地代理模式设置-自行部署服务" hoverable style="margin-top: 10px; min-width: 850px">
<n-card
title="本地代理模式设置-自行部署服务"
hoverable
style="margin-top: 10px; min-width: 850px"
>
<n-form inline :model="optionStore.MJ_GlobalSetting.mj_localRemoteSimpleSetting">
<n-form-item label="服务地址" path="baseUrl">
<n-input
@@ -53,7 +57,9 @@
<p>
1. 本地代理模式支持本地部署和服务器部署需要自己进行部署<span
class="clickable-link"
@click="openExternalLink('https://rvgyir5wk1c.feishu.cn/wiki/N7uuwsO5piB8F6kpvDScUNBGnpd')"
@click="
openExternalLink('https://rvgyir5wk1c.feishu.cn/wiki/N7uuwsO5piB8F6kpvDScUNBGnpd')
"
>
本地代理模式部署教程
</span>
@@ -76,24 +82,13 @@
<script setup>
import { ref, h } from 'vue'
import {
NCard,
NButton,
useDialog,
NForm,
NFormItem,
NInput,
useMessage,
NTooltip,
NIcon
} from 'naive-ui'
import { NCard, NButton, useDialog, NForm, NFormItem, NInput, NTooltip, NIcon } from 'naive-ui'
import AddMultiRemoteMj from '../Components/AddMultiRemoteMj.vue'
import { useOptionStore } from '@/stores/option'
import NotesCollapse from '../../Common/NotesCollapse.vue'
const optionStore = useOptionStore()
const dialog = useDialog()
const message = useMessage()
/**
* 添加多个账号,这样可以同时跑多个账号
@@ -118,7 +113,3 @@ function openExternalLink(url) {
window.api.OpenUrl(url)
}
</script>
<style scoped>
@import '../../../assets//css//note.less';
</style>
@@ -71,7 +71,3 @@ function openExternalLink(url) {
window.api.OpenUrl(url)
}
</script>
<style scoped>
@import '../../../assets//css//note.less';
</style>
@@ -3,6 +3,7 @@
<MJSimpleSetting />
<MJAPISetting />
<MJRemoteSetting />
<MJImagePackage />
<!-- <MJBrowserSetting /> -->
<MJLocalRemoteSetting />
<n-button type="info" @click="SaveMjSetting" style="margin-top: 10px">保存MJ配置</n-button>
@@ -10,7 +11,7 @@
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { onMounted } from 'vue'
import { useMessage, NButton } from 'naive-ui'
import { useSoftwareStore } from '@/stores/software'
import { useOptionStore } from '@/stores/option'
@@ -19,10 +20,12 @@ import { OptionKeyName, OptionType } from '@/define/enum/option'
import MJSimpleSetting from './MJSimpleSetting.vue'
import MJAPISetting from './MJAPISetting.vue'
import MJRemoteSetting from './MJRemoteSetting.vue'
import MJBrowserSetting from './MJBrowserSetting.vue'
import MJLocalRemoteSetting from './MJLocalRemoteSetting.vue'
import MJImagePackage from './MJImagePackage.vue'
import { MJImageType } from '@/define/enum/mjEnum'
import { isEmpty } from 'lodash'
import { GetMJUrlOptions } from '@/define/api/apiUrlDefine'
import { GetImageProxyUrlOptions, ImagePackageProxyOptions } from '@/define/data/settingData'
let softwareStore = useSoftwareStore()
let optionStore = useOptionStore()
@@ -37,6 +40,7 @@ onMounted(async () => {
*/
async function InitMJSettingData() {
try {
debugger
softwareStore.spin.spinning = true
softwareStore.spin.tip = '正在加载数据,请稍等...'
@@ -112,6 +116,14 @@ async function InitMJSettingData() {
token: 'admin'
}
}
if (optionStore.MJ_GlobalSetting.mj_imagePackageSetting == null) {
optionStore.MJ_GlobalSetting.mj_imagePackageSetting = {
selectPackage: GetMJUrlOptions('package')[0].value,
token: '',
selectedProxy: GetImageProxyUrlOptions(GetMJUrlOptions('package')[0].value)[0].value
}
}
message.success('加载MJSetting信息成功')
}
await TimeDelay(1000)
@@ -178,6 +190,19 @@ async function SaveMjSetting() {
}
}
if (request_model == MJImageType.PACKAGE_MJ) {
// 检查生图包设置是不是存在
if (
optionStore.MJ_GlobalSetting.mj_imagePackageSetting == null ||
isEmpty(optionStore.MJ_GlobalSetting.mj_imagePackageSetting.selectPackage) ||
isEmpty(optionStore.MJ_GlobalSetting.mj_imagePackageSetting.token) ||
isEmpty(optionStore.MJ_GlobalSetting.mj_imagePackageSetting.selectedProxy)
) {
message.error('请检查生图包设置的必填字段,生图包选择,token,代理地址等')
return
}
}
optionStore.MJ_GlobalSetting.mj_simpleSetting.type =
optionStore.MJ_GlobalSetting.mj_simpleSetting.requestModel
@@ -72,7 +72,7 @@
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { ref, onMounted, computed } from 'vue'
import { NCard, NForm, NFormItem, NInputNumber, NSelect, NInput } from 'naive-ui'
import { useOptionStore } from '@/stores/option'
import MJDefine from '@/main/Service/MJ/mjDefine'
@@ -92,6 +92,10 @@ let sampleRules = {
selectRobot: [{ required: true, message: '请选择生图机器人', trigger: 'blur' }]
}
mjRobotModelOptions.value = computed(() =>
MJDefine.GetMJRobotModelOptions(optionStore.MJ_GlobalSetting.mj_simpleSetting.selectRobot)
)
onMounted(() => {
mjRequestModelOptions.value = MJDefine.GetMJRequestModelOptions()
mjRobotOptions.value = MJDefine.GetMJRobotOptions()