mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-19 20:20:16 +09:00
use a variable to represent the max number of images
This commit is contained in:
parent
b6735bffe4
commit
251d6920d5
@ -99,6 +99,8 @@ import { getClientConfig } from "../config/client";
|
|||||||
import { useAllModels } from "../utils/hooks";
|
import { useAllModels } from "../utils/hooks";
|
||||||
import { MultimodalContent } from "../client/api";
|
import { MultimodalContent } from "../client/api";
|
||||||
|
|
||||||
|
const maxImagesNumber = 3;
|
||||||
|
|
||||||
const Markdown = dynamic(async () => (await import("./markdown")).Markdown, {
|
const Markdown = dynamic(async () => (await import("./markdown")).Markdown, {
|
||||||
loading: () => <LoadingIcon />,
|
loading: () => <LoadingIcon />,
|
||||||
});
|
});
|
||||||
@ -1150,8 +1152,8 @@ function _Chat() {
|
|||||||
);
|
);
|
||||||
const imagesLength = images.length;
|
const imagesLength = images.length;
|
||||||
|
|
||||||
if (imagesLength > 3) {
|
if (imagesLength > maxImagesNumber) {
|
||||||
images.splice(3, imagesLength - 3);
|
images.splice(maxImagesNumber, imagesLength - maxImagesNumber);
|
||||||
}
|
}
|
||||||
setAttachImages(images);
|
setAttachImages(images);
|
||||||
}
|
}
|
||||||
@ -1182,7 +1184,7 @@ function _Chat() {
|
|||||||
.then((dataUrl) => {
|
.then((dataUrl) => {
|
||||||
imagesData.push(dataUrl);
|
imagesData.push(dataUrl);
|
||||||
if (
|
if (
|
||||||
imagesData.length === 3 ||
|
imagesData.length === maxImagesNumber ||
|
||||||
imagesData.length === files.length
|
imagesData.length === files.length
|
||||||
) {
|
) {
|
||||||
setUploading(false);
|
setUploading(false);
|
||||||
@ -1200,8 +1202,8 @@ function _Chat() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const imagesLength = images.length;
|
const imagesLength = images.length;
|
||||||
if (imagesLength > 3) {
|
if (imagesLength > maxImagesNumber) {
|
||||||
images.splice(3, imagesLength - 3);
|
images.splice(maxImagesNumber, imagesLength - maxImagesNumber);
|
||||||
}
|
}
|
||||||
setAttachImages(images);
|
setAttachImages(images);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user