mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-05-20 04:30:17 +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 { MultimodalContent } from "../client/api";
|
||||
|
||||
const maxImagesNumber = 3;
|
||||
|
||||
const Markdown = dynamic(async () => (await import("./markdown")).Markdown, {
|
||||
loading: () => <LoadingIcon />,
|
||||
});
|
||||
@ -1150,8 +1152,8 @@ function _Chat() {
|
||||
);
|
||||
const imagesLength = images.length;
|
||||
|
||||
if (imagesLength > 3) {
|
||||
images.splice(3, imagesLength - 3);
|
||||
if (imagesLength > maxImagesNumber) {
|
||||
images.splice(maxImagesNumber, imagesLength - maxImagesNumber);
|
||||
}
|
||||
setAttachImages(images);
|
||||
}
|
||||
@ -1182,7 +1184,7 @@ function _Chat() {
|
||||
.then((dataUrl) => {
|
||||
imagesData.push(dataUrl);
|
||||
if (
|
||||
imagesData.length === 3 ||
|
||||
imagesData.length === maxImagesNumber ||
|
||||
imagesData.length === files.length
|
||||
) {
|
||||
setUploading(false);
|
||||
@ -1200,8 +1202,8 @@ function _Chat() {
|
||||
);
|
||||
|
||||
const imagesLength = images.length;
|
||||
if (imagesLength > 3) {
|
||||
images.splice(3, imagesLength - 3);
|
||||
if (imagesLength > maxImagesNumber) {
|
||||
images.splice(maxImagesNumber, imagesLength - maxImagesNumber);
|
||||
}
|
||||
setAttachImages(images);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user