169 lines
3.4 KiB
TypeScript
169 lines
3.4 KiB
TypeScript
import { apiUrl } from "@/define/api/apiUrlDefine"
|
||
import { MJRobotType, MJSpeed } from "@/define/enum/mjEnum"
|
||
|
||
/**
|
||
* 获取MJ的请求模式列表
|
||
* @returns
|
||
*/
|
||
function GetMJRequestModelOptions() {
|
||
let mjRequstModel = [
|
||
{
|
||
label: "API模式",
|
||
value: "api_mj",
|
||
disable: false
|
||
}, {
|
||
label: "本地代理模式",
|
||
value: "local_mj",
|
||
disable: false
|
||
},
|
||
{
|
||
label: "代理MJ(token)",
|
||
value: "remote_mj",
|
||
disable: false
|
||
},
|
||
{
|
||
label: "浏览器模式",
|
||
value: "browser_mj",
|
||
disable: true
|
||
}]
|
||
return mjRequstModel.filter(item => !item.disable)
|
||
}
|
||
|
||
/**
|
||
* 获取MJ的机器人列表
|
||
* @returns
|
||
*/
|
||
function GetMJRobotOptions() {
|
||
return [{
|
||
label: 'MJ',
|
||
value: MJRobotType.MJ
|
||
},
|
||
{
|
||
label: 'NIJI',
|
||
value: MJRobotType.NIJI
|
||
}]
|
||
}
|
||
|
||
/**
|
||
* 获取机器人对应的出图模型
|
||
*/
|
||
function GetMJRobotModelOptions(mjRobot?: MJRobotType) {
|
||
let allRobotModel = [
|
||
{
|
||
label: "MJ V6.0",
|
||
text: "v 6",
|
||
type: MJRobotType.MJ,
|
||
value: "3e6473ab-9a64-4574-9a38-f5c75af552b6"
|
||
},
|
||
{
|
||
label: "MJ V5.2",
|
||
text: "v 5.2",
|
||
type: MJRobotType.MJ,
|
||
value: "27a0d30e-f46c-4684-96c8-d91334deb94f"
|
||
},
|
||
{
|
||
label: "MJ V5.1",
|
||
text: "v 5.1",
|
||
type: MJRobotType.MJ,
|
||
value: "e1226715-e969-44c4-b18b-f2ad5dae5d2f"
|
||
}, {
|
||
label: "MJ V5.0",
|
||
text: "v 5",
|
||
type: MJRobotType.MJ,
|
||
value: "afb7bea1-4eda-46ea-8165-34701b4566bf"
|
||
}, {
|
||
label: "MJ V4.0",
|
||
text: "v 4",
|
||
type: MJRobotType.MJ,
|
||
value: "d05b8497-7f4a-4890-8fac-89f1803984d2"
|
||
}, {
|
||
label: "NIJI V6",
|
||
text: "niji 6",
|
||
type: MJRobotType.NIJI,
|
||
value: "99377cad-c103-4cee-a958-86a104879328"
|
||
}, {
|
||
label: "NIJI V5",
|
||
text: "niji 5",
|
||
type: MJRobotType.NIJI,
|
||
value: "53cec077-9885-4635-ab18-e021066b2c4c"
|
||
}, {
|
||
label: "NIJI V4",
|
||
text: "niji 4",
|
||
type: MJRobotType.NIJI,
|
||
value: "6a7199fe-6e0d-40a9-9772-b5eb3d2e2e66"
|
||
},
|
||
]
|
||
|
||
switch (mjRobot) {
|
||
case MJRobotType.MJ:
|
||
return allRobotModel.filter(item => item.type == MJRobotType.MJ)
|
||
case MJRobotType.NIJI:
|
||
return allRobotModel.filter(item => item.type == MJRobotType.NIJI)
|
||
default:
|
||
return allRobotModel
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 获取MJ出图的比例Options
|
||
* @returns
|
||
*/
|
||
function GetMJImageScaleOptions() {
|
||
return [{
|
||
label: "1:1",
|
||
text: "1:1",
|
||
value: "3e2772f2-041c-49c6-ba13-d0ed120310b8"
|
||
}, {
|
||
label: "4:3",
|
||
text: "4:3",
|
||
value: "fcef555c-1958-4082-88fe-434782aa8151"
|
||
}, {
|
||
label: "3:4",
|
||
text: "3:4",
|
||
value: "13f71d53-73a3-4c9b-9c1e-6e7e939aee73"
|
||
}, {
|
||
label: "16:9",
|
||
text: "16:9",
|
||
value: "bf33ce1a-15cd-4901-b38e-89543cf14a1f"
|
||
}, {
|
||
label: "9:16",
|
||
text: "9:16",
|
||
value: "fd4641e2-97f4-4a86-8616-4965e05f3348"
|
||
}]
|
||
}
|
||
|
||
/**
|
||
* 获取MJ API 可用的URL Options
|
||
* @returns
|
||
*/
|
||
function GetMJAPIUrlOptions() {
|
||
return apiUrl.filter((item) => item.mj_url)
|
||
}
|
||
|
||
/**
|
||
* 获取MJ的速度Options
|
||
* @returns
|
||
*/
|
||
function GetMJSpeedOptions() {
|
||
return [{
|
||
label: "FAST",
|
||
value: MJSpeed.FAST
|
||
}, {
|
||
label: "RELAXED",
|
||
value: MJSpeed.RELAX
|
||
}]
|
||
}
|
||
|
||
/**
|
||
* MJ的一些数据的定义
|
||
*/
|
||
let MJDefine = {
|
||
GetMJRequestModelOptions,
|
||
GetMJRobotOptions,
|
||
GetMJRobotModelOptions,
|
||
GetMJImageScaleOptions,
|
||
GetMJAPIUrlOptions,
|
||
GetMJSpeedOptions
|
||
}
|
||
|
||
export default MJDefine |