Commit 93ea9bbc by Archer Committed by GitHub

fix: reduce base64 image payloads (#6897)

* fix: reduce base64 image payloads

* doc

* doc
parent 63d4b417
...@@ -62,6 +62,7 @@ FILE_TOKEN_KEY= ...@@ -62,6 +62,7 @@ FILE_TOKEN_KEY=
6. codex-sandbox 加强 AST 检查,防止绕过安全检查。 6. codex-sandbox 加强 AST 检查,防止绕过安全检查。
7. 站点同步限流错误提示,重复提示。 7. 站点同步限流错误提示,重复提示。
8. 加强 IP 检测,避免伪造绕过。 8. 加强 IP 检测,避免伪造绕过。
9. 图片处理线程,支持配置是否转化成 base64 发送给模型。
## 🐛 修复 ## 🐛 修复
......
...@@ -157,8 +157,8 @@ ...@@ -157,8 +157,8 @@
"content/openapi/intro.mdx": "2026-04-26T21:08:47+08:00", "content/openapi/intro.mdx": "2026-04-26T21:08:47+08:00",
"content/openapi/share.en.mdx": "2026-04-26T21:08:47+08:00", "content/openapi/share.en.mdx": "2026-04-26T21:08:47+08:00",
"content/openapi/share.mdx": "2026-04-26T21:08:47+08:00", "content/openapi/share.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/config/env.en.mdx": "2026-05-06T18:25:24+08:00", "content/self-host/config/env.en.mdx": "2026-05-08T20:36:05+08:00",
"content/self-host/config/env.mdx": "2026-05-06T18:25:24+08:00", "content/self-host/config/env.mdx": "2026-05-08T20:36:05+08:00",
"content/self-host/config/json.en.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/config/json.en.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/config/json.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/config/json.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/config/model/intro.en.mdx": "2026-05-07T15:06:40+08:00", "content/self-host/config/model/intro.en.mdx": "2026-05-07T15:06:40+08:00",
...@@ -167,8 +167,8 @@ ...@@ -167,8 +167,8 @@
"content/self-host/config/model/minimax.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/config/model/minimax.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/config/model/siliconCloud.en.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/config/model/siliconCloud.en.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/config/model/siliconCloud.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/config/model/siliconCloud.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/config/object-storage.en.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/config/object-storage.en.mdx": "2026-05-08T20:36:05+08:00",
"content/self-host/config/object-storage.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/config/object-storage.mdx": "2026-05-08T20:36:05+08:00",
"content/self-host/config/signoz.en.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/config/signoz.en.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/config/signoz.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/config/signoz.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/custom-models/bge-rerank.en.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/custom-models/bge-rerank.en.mdx": "2026-04-26T21:08:47+08:00",
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
"content/self-host/upgrading/4-14/41481.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/upgrading/4-14/41481.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/upgrading/4-14/4149.en.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/upgrading/4-14/4149.en.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/upgrading/4-14/4149.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/upgrading/4-14/4149.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/upgrading/4-15/4150.mdx": "2026-05-06T22:27:15+08:00", "content/self-host/upgrading/4-15/4150.mdx": "2026-05-09T11:28:39+08:00",
"content/self-host/upgrading/outdated/40.en.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/upgrading/outdated/40.en.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/upgrading/outdated/40.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/upgrading/outdated/40.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/upgrading/outdated/41.en.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/upgrading/outdated/41.en.mdx": "2026-04-26T21:08:47+08:00",
......
...@@ -21,12 +21,13 @@ export default { ...@@ -21,12 +21,13 @@ export default {
files.length === 0 files.length === 0
? [] ? []
: [ : [
'pnpm -C ./document run format-doc', 'pnpm -C ./document run format-doc',
'pnpm -C ./document run initDocTime', 'pnpm -C ./document run initDocTime',
'pnpm -C ./document run initDocToc', 'pnpm -C ./document run initDocToc',
'pnpm -C ./document run checkDocRefs', 'pnpm -C ./document run checkDocRefs',
'pnpm -C ./document run removeInvalidImg' 'pnpm -C ./document run removeInvalidImg',
], 'git add .'
],
'**/*.{ts,tsx}': (files) => { '**/*.{ts,tsx}': (files) => {
const lintFiles = withoutIgnoredPaths(files); const lintFiles = withoutIgnoredPaths(files);
if (lintFiles.length === 0) return []; if (lintFiles.length === 0) return [];
......
...@@ -12,7 +12,6 @@ import { ChatCompletionRequestMessageRoleEnum } from '@fastgpt/global/core/ai/co ...@@ -12,7 +12,6 @@ import { ChatCompletionRequestMessageRoleEnum } from '@fastgpt/global/core/ai/co
import { i18nT } from '../../../../web/i18n/utils'; import { i18nT } from '../../../../web/i18n/utils';
import { getImageBase64 } from '../../../common/file/image/utils'; import { getImageBase64 } from '../../../common/file/image/utils';
import { getS3ChatSource } from '../../../common/s3/sources/chat'; import { getS3ChatSource } from '../../../common/s3/sources/chat';
import { isInternalAddress } from '../../../common/system/utils';
import { getErrText } from '@fastgpt/global/common/error/utils'; import { getErrText } from '@fastgpt/global/common/error/utils';
import { getLogger, LogCategories } from '../../../common/logger'; import { getLogger, LogCategories } from '../../../common/logger';
import { serviceEnv } from '../../../env'; import { serviceEnv } from '../../../env';
...@@ -165,11 +164,7 @@ export const loadRequestMessages = async ({ ...@@ -165,11 +164,7 @@ export const loadRequestMessages = async ({
try { try {
// If imgUrl is a local path, load image from local, and set url to base64 // If imgUrl is a local path, load image from local, and set url to base64
if ( if (imgUrl.startsWith('/') || serviceEnv.MULTIPLE_DATA_TO_BASE64) {
imgUrl.startsWith('/') ||
serviceEnv.MULTIPLE_DATA_TO_BASE64 ||
(await isInternalAddress(imgUrl))
) {
try { try {
const url = await (async () => { const url = await (async () => {
if (item.key) { if (item.key) {
......
Subproject commit ede09e6cbe630281918eebe2b3c696eb7bc58a65 Subproject commit 958c6c7b27f6e3b8d04213b60e41d7ac75a605c7
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment