fix: add warning for pass through body
This commit is contained in:
@@ -26,6 +26,7 @@ import {
|
||||
showSuccess,
|
||||
loadChannelModels,
|
||||
copy,
|
||||
toBoolean,
|
||||
} from '../../helpers';
|
||||
import {
|
||||
CHANNEL_OPTIONS,
|
||||
@@ -85,6 +86,26 @@ export const useChannelsData = () => {
|
||||
const [isBatchTesting, setIsBatchTesting] = useState(false);
|
||||
const [modelTablePage, setModelTablePage] = useState(1);
|
||||
const [selectedEndpointType, setSelectedEndpointType] = useState('');
|
||||
const [globalPassThroughEnabled, setGlobalPassThroughEnabled] =
|
||||
useState(false);
|
||||
|
||||
const fetchGlobalPassThroughEnabled = async () => {
|
||||
try {
|
||||
const res = await API.get('/api/option/');
|
||||
const { success, data } = res?.data || {};
|
||||
if (!success || !Array.isArray(data)) {
|
||||
return;
|
||||
}
|
||||
const option = data.find(
|
||||
(item) => item?.key === 'global.pass_through_request_enabled',
|
||||
);
|
||||
if (option) {
|
||||
setGlobalPassThroughEnabled(toBoolean(option.value));
|
||||
}
|
||||
} catch (error) {
|
||||
setGlobalPassThroughEnabled(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 使用 ref 来避免闭包问题,类似旧版实现
|
||||
const shouldStopBatchTestingRef = useRef(false);
|
||||
@@ -140,6 +161,7 @@ export const useChannelsData = () => {
|
||||
});
|
||||
fetchGroups().then();
|
||||
loadChannelModels().then();
|
||||
fetchGlobalPassThroughEnabled().then();
|
||||
}, []);
|
||||
|
||||
// Column visibility management
|
||||
@@ -1026,6 +1048,7 @@ export const useChannelsData = () => {
|
||||
enableBatchDelete,
|
||||
statusFilter,
|
||||
compactMode,
|
||||
globalPassThroughEnabled,
|
||||
|
||||
// UI states
|
||||
showEdit,
|
||||
|
||||
Reference in New Issue
Block a user