diff --git a/docSite/content/docs/installation/upgrading/463.md b/docSite/content/docs/installation/upgrading/463.md index d57967378..c9d5f5e3b 100644 --- a/docSite/content/docs/installation/upgrading/463.md +++ b/docSite/content/docs/installation/upgrading/463.md @@ -30,3 +30,4 @@ curl --location --request POST 'https://{{host}}/api/admin/initv463' \ 4. 优化 - 流读取文件,防止内存溢出 5. 优化 - 4v模型自动将 url 转 base64,本地也可调试 6. 优化 - 图片压缩等级 +7. 修复 - 图片压缩失败报错,防止文件读取过程卡死。 diff --git a/projects/app/src/pages/api/core/chat/update.ts b/projects/app/src/pages/api/core/chat/update.ts index 6f0b2a59d..428cab250 100644 --- a/projects/app/src/pages/api/core/chat/update.ts +++ b/projects/app/src/pages/api/core/chat/update.ts @@ -13,10 +13,13 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) await authChat({ req, authToken: true, chatId }); - await MongoChat.findOneAndUpdate({ chatId }, { - ...(customTitle && { customTitle }), - ...(top && { top }) - }); + await MongoChat.findOneAndUpdate( + { chatId }, + { + ...(customTitle !== undefined && { customTitle }), + ...(top !== undefined && { top }) + } + ); jsonRes(res); } catch (err) { jsonRes(res, { diff --git a/projects/app/src/pages/chat/index.tsx b/projects/app/src/pages/chat/index.tsx index a4f35e67f..f6a94b672 100644 --- a/projects/app/src/pages/chat/index.tsx +++ b/projects/app/src/pages/chat/index.tsx @@ -328,7 +328,7 @@ const Chat = ({ appId, chatId }: { appId: string; chatId: string }) => { }} onSetCustomTitle={async (e) => { try { - await putChatHistory({ + putChatHistory({ chatId: e.chatId, customTitle: e.title }); diff --git a/projects/app/src/pages/dataset/detail/components/Import/ImportModal.tsx b/projects/app/src/pages/dataset/detail/components/Import/ImportModal.tsx index f50df67dc..ca71f3c54 100644 --- a/projects/app/src/pages/dataset/detail/components/Import/ImportModal.tsx +++ b/projects/app/src/pages/dataset/detail/components/Import/ImportModal.tsx @@ -84,8 +84,8 @@ const ImportData = ({ title={{t('dataset.data.File import')}} isOpen isCentered - maxW={['90vw', '85vw']} - w={['90vw', '85vw']} + maxW={['90vw', 'min(1440px,85vw)']} + w={['90vw', 'min(1440px,85vw)']} h={'90vh'} > diff --git a/projects/app/src/web/common/file/controller.ts b/projects/app/src/web/common/file/controller.ts index 38502f7c2..ad144e6e6 100644 --- a/projects/app/src/web/common/file/controller.ts +++ b/projects/app/src/web/common/file/controller.ts @@ -92,6 +92,7 @@ export const compressBase64ImgAndUpload = ({ reject(error); } }; + img.onerror = reject; }); }; export const compressImgFileAndUpload = async ({ diff --git a/projects/app/src/web/common/file/utils.ts b/projects/app/src/web/common/file/utils.ts index 83c957b5d..4a4ddb7e0 100644 --- a/projects/app/src/web/common/file/utils.ts +++ b/projects/app/src/web/common/file/utils.ts @@ -187,6 +187,7 @@ export const formatMarkdown = async (rawText: string = '') => { maxH: 4329, maxSize: 1024 * 1024 * 5 }); + rawText = rawText.replace(base64, str); } catch (error) { rawText = rawText.replace(base64, ''); @@ -194,6 +195,7 @@ export const formatMarkdown = async (rawText: string = '') => { } }) ); + // Remove white space on both sides of the picture const trimReg = /\s*(!\[.*\]\(.*\))\s*/g; if (trimReg.test(rawText)) {