Skip to content

Commit e11ff7b

Browse files
committed
feat: 混图支持2~5张图及U/V操作 #47
1 parent 514fb4f commit e11ff7b

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

app/components/chat.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ export function Chat() {
907907
{!isUser &&
908908
message.model == "midjourney" &&
909909
message.attr?.finished &&
910-
["VARIATION", "IMAGINE"].includes(message.attr?.action) && (
910+
["VARIATION", "IMAGINE", "BLEND"].includes(message.attr?.action) && (
911911
<div
912912
className={[
913913
styles["chat-message-actions"],
@@ -1027,8 +1027,8 @@ export function Chat() {
10271027
onSearch("");
10281028
}}
10291029
imageSelected={(img: any) => {
1030-
if (useImages.length >= 2) {
1031-
alert(Locale.Midjourney.SelectImgMax(2));
1030+
if (useImages.length >= 5) {
1031+
alert(Locale.Midjourney.SelectImgMax(5));
10321032
return;
10331033
}
10341034
setUseImages([...useImages, img]);

app/locales/cn.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ const cn = {
1717
SelectImgMax: (max: number) => `最多可选择 ${max} 张图片`,
1818
InputDisabled: "该模式下不支持输入内容",
1919
HasImgTip:
20-
"提示:垫图模式/识图(describe)模式只会使用第一张图片,混图(blend)模式会按顺序使用选中的两张图片(点击图片可以移除)",
20+
"提示:垫图模式/识图(describe)模式只会使用第一张图片,混图(blend)模式会按顺序使用选中的5张图片(点击图片可以移除)",
2121
ModeImagineUseImg: "垫图(图生图)模式",
2222
ModeBlend: "混图模式",
2323
ModeDescribe: "识图(图生文)模式",
2424
NeedInputUseImgPrompt:
2525
"垫图模式下需要输入内容才能使用图片,请以“/mj”开头输入内容",
26-
BlendMinImg: (min: number) => `混图模式下至少需要 ${min} 张图片`,
26+
BlendMinImg: (min: number,max:number) => `混图模式下至少需要 ${min} 张图片,至多 ${max} 张图片`,
2727
TaskErrUnknownType: "任务提交失败:未知的任务类型",
2828
TaskErrNotSupportType: (type: string) =>
2929
`任务提交失败:不支持的任务类型 -> ${type}`,

app/locales/en.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@ const en: RequiredLocaleType = {
1818
SelectImgMax: (max: number) => `Select up to ${max} images`,
1919
InputDisabled: "Input is disabled in this mode",
2020
HasImgTip:
21-
"Tip: In the mask mode, only the first image will be used. In the blend mode, the two selected images will be used in order (click the image to remove it)",
21+
"Tip: In the mask mode, only the first image will be used. In the blend mode, the five selected images will be used in order (click the image to remove it)",
2222
ModeImagineUseImg: "Mask Mode",
2323
ModeBlend: "Blend Mode",
2424
ModeDescribe: "Describe Mode",
2525
NeedInputUseImgPrompt:
2626
'You need to enter content to use the image in the mask mode, please enter the content starting with "/mj"',
27-
BlendMinImg: (min: number) =>
28-
`At least ${min} images are required in the blend mode`,
27+
BlendMinImg: (min: number,max:number) => `At least ${min} images are required in the mixed image mode, and up to ${max} images are required`,
2928
TaskErrUnknownType: "Task submission failed: unknown task type",
3029
TaskErrNotSupportType: (type: string) =>
3130
`Task submission failed: unsupported task type -> ${type}`,

app/store/chat.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ export const useChatStore = create<ChatStore>()(
349349
(extAttr?.useImages?.length ?? 0) > 0 &&
350350
extAttr.mjImageMode !== "IMAGINE"
351351
) {
352-
if (extAttr.mjImageMode === "BLEND" && extAttr.useImages.length < 2) {
353-
alert(Locale.Midjourney.BlendMinImg(2));
352+
if (extAttr.mjImageMode === "BLEND" && (extAttr.useImages.length < 2 || extAttr.useImages.length > 5)) {
353+
alert(Locale.Midjourney.BlendMinImg(2, 5));
354354
return new Promise((resolve: any, reject) => {
355355
resolve(false);
356356
});

0 commit comments

Comments
 (0)