* fix: http tool

* fix: http tool

* fix: test

* fix: test

* fix: test

* fix: test
This commit is contained in:
Archer
2026-03-13 17:24:15 +08:00
committed by GitHub
parent df04515b1c
commit dbc443a770
15 changed files with 494 additions and 93 deletions
@@ -1,4 +1,4 @@
import { isInternalAddress } from '../../../../../../../common/system/utils';
import { isInternalAddress, PRIVATE_URL_TEXT } from '../../../../../../../common/system/utils';
import axios from 'axios';
import { serverRequestBaseUrl } from '../../../../../../../common/api/serverRequest';
import { parseFileExtensionFromUrl } from '@fastgpt/global/common/string/tools';
@@ -59,7 +59,7 @@ export const dispatchFileRead = async ({
return {
index,
name: '',
content: Promise.reject('Url is invalid')
content: Promise.reject(PRIVATE_URL_TEXT)
};
}
// Get file buffer data
@@ -26,7 +26,7 @@ import type { StoreSecretValueType } from '@fastgpt/global/common/secret/type';
import { getLogger, LogCategories } from '../../../../common/logger';
import { SERVICE_LOCAL_HOST } from '../../../../common/system/tools';
import { formatHttpError } from '../utils';
import { isInternalAddress } from '../../../../common/system/utils';
import { isInternalAddress, PRIVATE_URL_TEXT } from '../../../../common/system/utils';
import { serviceRequestMaxContentLength } from '../../../../common/system/constants';
import { axios } from '../../../../common/api/axios';
@@ -496,7 +496,7 @@ async function fetchData({
timeout: number;
}) {
if (await isInternalAddress(url)) {
return Promise.reject('Url is invalid');
return Promise.reject(PRIVATE_URL_TEXT);
}
const { data: response } = await axios({
@@ -13,7 +13,7 @@ import { ChatRoleEnum } from '@fastgpt/global/core/chat/constants';
import { type ChatItemType } from '@fastgpt/global/core/chat/type';
import { addDays } from 'date-fns';
import { getNodeErrResponse } from '../utils';
import { isInternalAddress } from '../../../../common/system/utils';
import { isInternalAddress, PRIVATE_URL_TEXT } from '../../../../common/system/utils';
import { replaceS3KeyToPreviewUrl } from '../../../dataset/utils';
import { getFileS3Key } from '../../../../common/s3/utils';
import { S3ChatSource } from '../../../../common/s3/sources/chat';
@@ -188,7 +188,7 @@ export const getFileContentFromLinks = async ({
try {
if (await isInternalAddress(url)) {
return Promise.reject('Url is invalid');
return Promise.reject(PRIVATE_URL_TEXT);
}
// Get file buffer data