2025-07-19 03:30:44 +08:00
|
|
|
/*
|
|
|
|
|
Copyright (C) 2025 QuantumNous
|
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General Public License as
|
|
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
For commercial licensing, please contact support@quantumnous.com
|
|
|
|
|
*/
|
|
|
|
|
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
import React, { useState, useEffect, forwardRef, useImperativeHandle } from 'react';
|
2025-08-18 04:14:35 +08:00
|
|
|
import { useIsMobile } from '../../hooks/common/useIsMobile';
|
2025-06-19 08:57:34 +08:00
|
|
|
import {
|
|
|
|
|
Modal,
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
Table,
|
2025-06-19 08:57:34 +08:00
|
|
|
Input,
|
|
|
|
|
Space,
|
2025-06-19 16:05:50 +08:00
|
|
|
Highlight,
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
Select,
|
|
|
|
|
Tag,
|
2025-06-19 08:57:34 +08:00
|
|
|
} from '@douyinfe/semi-ui';
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
import { IconSearch } from '@douyinfe/semi-icons';
|
|
|
|
|
import { CheckCircle, XCircle, AlertCircle, HelpCircle } from 'lucide-react';
|
2025-06-19 08:57:34 +08:00
|
|
|
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
const ChannelSelectorModal = forwardRef(({
|
2025-06-19 08:57:34 +08:00
|
|
|
visible,
|
|
|
|
|
onCancel,
|
|
|
|
|
onOk,
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
allChannels,
|
|
|
|
|
selectedChannelIds,
|
2025-06-19 08:57:34 +08:00
|
|
|
setSelectedChannelIds,
|
|
|
|
|
channelEndpoints,
|
|
|
|
|
updateChannelEndpoint,
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
t,
|
|
|
|
|
}, ref) => {
|
2025-06-19 16:05:50 +08:00
|
|
|
const [searchText, setSearchText] = useState('');
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
const [currentPage, setCurrentPage] = useState(1);
|
|
|
|
|
const [pageSize, setPageSize] = useState(10);
|
š± refactor(web): remove legacy isMobile util and migrate to useIsMobile hook
BREAKING CHANGE:
helpers/utils.js no longer exports `isMobile()`.
Any external code that relied on this function must switch to the `useIsMobile` React hook.
Summary
-------
1. Deleted the obsolete `isMobile()` function from helpers/utils.js.
2. Introduced `MOBILE_BREAKPOINT` constant and `matchMedia`-based detection for non-React contexts.
3. Reworked toast positioning logic in utils.js to rely on `matchMedia`.
4. Updated render.js:
⢠Removed isMobile import.
⢠Added MOBILE_BREAKPOINT detection in `truncateText`.
5. Migrated every page/component to the `useIsMobile` hook:
⢠Layout: HeaderBar, PageLayout, SiderBar
⢠Pages: Home, Detail, Playground, User (Add/Edit), Token, Channel, Redemption, Ratio Sync
⢠Components: ChannelsTable, ChannelSelectorModal, ConflictConfirmModal
6. Purged all remaining `isMobile()` calls and legacy imports.
7. Added missing `const isMobile = useIsMobile()` declarations where required.
Benefits
--------
⢠Unifies mobile detection with a React-friendly hook.
⢠Eliminates duplicated logic and improves maintainability.
⢠Keeps non-React helpers lightweight by using `matchMedia` directly.
2025-07-16 02:54:58 +08:00
|
|
|
const isMobile = useIsMobile();
|
2025-06-19 16:05:50 +08:00
|
|
|
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
const [filteredData, setFilteredData] = useState([]);
|
2025-06-19 08:57:34 +08:00
|
|
|
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
useImperativeHandle(ref, () => ({
|
|
|
|
|
resetPagination: () => {
|
|
|
|
|
setCurrentPage(1);
|
|
|
|
|
setSearchText('');
|
|
|
|
|
},
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (!allChannels) return;
|
|
|
|
|
|
|
|
|
|
const searchLower = searchText.trim().toLowerCase();
|
|
|
|
|
const matched = searchLower
|
|
|
|
|
? allChannels.filter((item) => {
|
|
|
|
|
const name = (item.label || '').toLowerCase();
|
|
|
|
|
const baseUrl = (item._originalData?.base_url || '').toLowerCase();
|
|
|
|
|
return name.includes(searchLower) || baseUrl.includes(searchLower);
|
|
|
|
|
})
|
|
|
|
|
: allChannels;
|
|
|
|
|
|
|
|
|
|
setFilteredData(matched);
|
|
|
|
|
}, [allChannels, searchText]);
|
|
|
|
|
|
|
|
|
|
const total = filteredData.length;
|
|
|
|
|
|
|
|
|
|
const paginatedData = filteredData.slice(
|
|
|
|
|
(currentPage - 1) * pageSize,
|
|
|
|
|
currentPage * pageSize,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const updateEndpoint = (channelId, endpoint) => {
|
|
|
|
|
if (typeof updateChannelEndpoint === 'function') {
|
|
|
|
|
updateChannelEndpoint(channelId, endpoint);
|
|
|
|
|
}
|
2025-06-19 16:05:50 +08:00
|
|
|
};
|
|
|
|
|
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
const renderEndpointCell = (text, record) => {
|
|
|
|
|
const channelId = record.key || record.value;
|
|
|
|
|
const currentEndpoint = channelEndpoints[channelId] || '';
|
|
|
|
|
|
|
|
|
|
const getEndpointType = (ep) => {
|
|
|
|
|
if (ep === '/api/ratio_config') return 'ratio_config';
|
|
|
|
|
if (ep === '/api/pricing') return 'pricing';
|
|
|
|
|
return 'custom';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const currentType = getEndpointType(currentEndpoint);
|
|
|
|
|
|
|
|
|
|
const handleTypeChange = (val) => {
|
|
|
|
|
if (val === 'ratio_config') {
|
|
|
|
|
updateEndpoint(channelId, '/api/ratio_config');
|
|
|
|
|
} else if (val === 'pricing') {
|
|
|
|
|
updateEndpoint(channelId, '/api/pricing');
|
|
|
|
|
} else {
|
|
|
|
|
if (currentType !== 'custom') {
|
|
|
|
|
updateEndpoint(channelId, '');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-06-19 16:05:50 +08:00
|
|
|
return (
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
|
|
|
|
<Select
|
|
|
|
|
size="small"
|
|
|
|
|
value={currentType}
|
|
|
|
|
onChange={handleTypeChange}
|
|
|
|
|
style={{ width: 120 }}
|
|
|
|
|
optionList={[
|
|
|
|
|
{ label: 'ratio_config', value: 'ratio_config' },
|
|
|
|
|
{ label: 'pricing', value: 'pricing' },
|
|
|
|
|
{ label: 'custom', value: 'custom' },
|
|
|
|
|
]}
|
|
|
|
|
/>
|
|
|
|
|
{currentType === 'custom' && (
|
|
|
|
|
<Input
|
|
|
|
|
size="small"
|
|
|
|
|
value={currentEndpoint}
|
|
|
|
|
onChange={(val) => updateEndpoint(channelId, val)}
|
|
|
|
|
placeholder="/your/endpoint"
|
|
|
|
|
style={{ width: 160, fontSize: 12 }}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
2025-06-19 08:57:34 +08:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
const renderStatusCell = (status) => {
|
|
|
|
|
switch (status) {
|
|
|
|
|
case 1:
|
|
|
|
|
return (
|
2025-07-12 03:35:19 +08:00
|
|
|
<Tag color='green' shape='circle' prefixIcon={<CheckCircle size={14} />}>
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
{t('å·²åÆēØ')}
|
|
|
|
|
</Tag>
|
|
|
|
|
);
|
|
|
|
|
case 2:
|
|
|
|
|
return (
|
2025-07-12 03:35:19 +08:00
|
|
|
<Tag color='red' shape='circle' prefixIcon={<XCircle size={14} />}>
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
{t('å·²ē¦ēØ')}
|
|
|
|
|
</Tag>
|
|
|
|
|
);
|
|
|
|
|
case 3:
|
|
|
|
|
return (
|
2025-07-12 03:35:19 +08:00
|
|
|
<Tag color='yellow' shape='circle' prefixIcon={<AlertCircle size={14} />}>
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
{t('čŖåØē¦ēØ')}
|
|
|
|
|
</Tag>
|
|
|
|
|
);
|
|
|
|
|
default:
|
|
|
|
|
return (
|
2025-07-12 03:35:19 +08:00
|
|
|
<Tag color='grey' shape='circle' prefixIcon={<HelpCircle size={14} />}>
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
{t('ęŖē„ē¶ę')}
|
|
|
|
|
</Tag>
|
|
|
|
|
);
|
|
|
|
|
}
|
2025-06-19 08:57:34 +08:00
|
|
|
};
|
|
|
|
|
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
const renderNameCell = (text) => (
|
|
|
|
|
<Highlight sourceString={text} searchWords={[searchText]} />
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const renderBaseUrlCell = (text) => (
|
|
|
|
|
<Highlight sourceString={text} searchWords={[searchText]} />
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const columns = [
|
|
|
|
|
{
|
|
|
|
|
title: t('åē§°'),
|
|
|
|
|
dataIndex: 'label',
|
|
|
|
|
render: renderNameCell,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: t('ęŗå°å'),
|
|
|
|
|
dataIndex: '_originalData.base_url',
|
|
|
|
|
render: (_, record) => renderBaseUrlCell(record._originalData?.base_url || ''),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: t('ē¶ę'),
|
|
|
|
|
dataIndex: '_originalData.status',
|
|
|
|
|
render: (_, record) => renderStatusCell(record._originalData?.status || 0),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: t('åę„ę„å£'),
|
|
|
|
|
dataIndex: 'endpoint',
|
|
|
|
|
fixed: 'right',
|
|
|
|
|
render: renderEndpointCell,
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const rowSelection = {
|
|
|
|
|
selectedRowKeys: selectedChannelIds,
|
|
|
|
|
onChange: (keys) => setSelectedChannelIds(keys),
|
2025-06-19 16:05:50 +08:00
|
|
|
};
|
2025-06-19 08:57:34 +08:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Modal
|
|
|
|
|
visible={visible}
|
|
|
|
|
onCancel={onCancel}
|
|
|
|
|
onOk={onOk}
|
|
|
|
|
title={<span className="text-lg font-semibold">{t('éę©åę„ęø é')}</span>}
|
š± refactor(web): remove legacy isMobile util and migrate to useIsMobile hook
BREAKING CHANGE:
helpers/utils.js no longer exports `isMobile()`.
Any external code that relied on this function must switch to the `useIsMobile` React hook.
Summary
-------
1. Deleted the obsolete `isMobile()` function from helpers/utils.js.
2. Introduced `MOBILE_BREAKPOINT` constant and `matchMedia`-based detection for non-React contexts.
3. Reworked toast positioning logic in utils.js to rely on `matchMedia`.
4. Updated render.js:
⢠Removed isMobile import.
⢠Added MOBILE_BREAKPOINT detection in `truncateText`.
5. Migrated every page/component to the `useIsMobile` hook:
⢠Layout: HeaderBar, PageLayout, SiderBar
⢠Pages: Home, Detail, Playground, User (Add/Edit), Token, Channel, Redemption, Ratio Sync
⢠Components: ChannelsTable, ChannelSelectorModal, ConflictConfirmModal
6. Purged all remaining `isMobile()` calls and legacy imports.
7. Added missing `const isMobile = useIsMobile()` declarations where required.
Benefits
--------
⢠Unifies mobile detection with a React-friendly hook.
⢠Eliminates duplicated logic and improves maintainability.
⢠Keeps non-React helpers lightweight by using `matchMedia` directly.
2025-07-16 02:54:58 +08:00
|
|
|
size={isMobile ? 'full-width' : 'large'}
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
keepDOM
|
|
|
|
|
lazyRender={false}
|
2025-06-19 08:57:34 +08:00
|
|
|
>
|
|
|
|
|
<Space vertical style={{ width: '100%' }}>
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
<Input
|
|
|
|
|
prefix={<IconSearch size={14} />}
|
|
|
|
|
placeholder={t('ęē“¢ęø éåē§°ęå°å')}
|
|
|
|
|
value={searchText}
|
|
|
|
|
onChange={setSearchText}
|
|
|
|
|
showClear
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<Table
|
|
|
|
|
columns={columns}
|
|
|
|
|
dataSource={paginatedData}
|
|
|
|
|
rowKey="key"
|
|
|
|
|
rowSelection={rowSelection}
|
|
|
|
|
pagination={{
|
|
|
|
|
currentPage: currentPage,
|
|
|
|
|
pageSize: pageSize,
|
|
|
|
|
total: total,
|
|
|
|
|
showSizeChanger: true,
|
|
|
|
|
showQuickJumper: true,
|
|
|
|
|
pageSizeOptions: ['10', '20', '50', '100'],
|
|
|
|
|
onChange: (page, size) => {
|
|
|
|
|
setCurrentPage(page);
|
|
|
|
|
setPageSize(size);
|
|
|
|
|
},
|
|
|
|
|
onShowSizeChange: (curr, size) => {
|
|
|
|
|
setCurrentPage(1);
|
|
|
|
|
setPageSize(size);
|
|
|
|
|
},
|
2025-06-19 08:57:34 +08:00
|
|
|
}}
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
size="small"
|
2025-06-19 08:57:34 +08:00
|
|
|
/>
|
|
|
|
|
</Space>
|
|
|
|
|
</Modal>
|
|
|
|
|
);
|
⨠feat(ratio-sync): support /api/pricing parsing, confidence verification & UI enhancements
Backend
- controller/ratio_sync.go
⢠Parse /api/pricing response and convert to ratio / price maps.
⢠Introduce confidence heuristic (model_ratio = 37.5 && completion_ratio = 1) to flag unreliable data.
⢠Include confidence map when building differences and filter āsameā/empty entries.
- dto/ratio_sync.go
⢠Add `ID` to UpstreamDTO, `upstreams` to UpstreamRequest, and `Confidence` to DifferenceItem.
Frontend
- ChannelSelectorModal.js
⢠Re-implement with table layout, pagination, search, endpoint-type selector and mobile support.
- UpstreamRatioSync.js
⢠Send full upstream objects, add ratio-type filter, confidence badges/tooltips, retain endpoints.
⢠Leverage ChannelSelectorModalās pagination reset.
- ChannelsTable.js ā fix tag color for disabled status.
- en.json ā add translations for new UI labels.
Motivation
These changes let users sync model ratiosā/āprices from different upstream endpoints and visually identify potentially unreliable data, improving operational safety and flexibility.
2025-06-21 20:24:52 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export default ChannelSelectorModal;
|