Detailed changes Backend • `controller/pricing.go` now includes `auto_groups` in `/api/pricing` response, sourced from `setting.AutoGroups`. Frontend • `useModelPricingData.js` – Parses `auto_groups` and exposes `autoGroups` state. • `PricingPage.jsx` → `ModelDetailSideSheet.jsx` → `ModelPricingTable.jsx` – Thread `autoGroups` through component tree. • `ModelPricingTable.jsx` – Removes deprecated `getGroupDescription` / `Tooltip`. – Filters out `auto` when building price table rows. – Renders a descriptive banner: “auto 分组调用链路 → auto → group1 → …”, clarifying fallback order without showing prices. • Minor i18n tweak: adds `auto分组调用链路` key for the banner text. Why Users were confused by the “auto” tag appearing alongside regular groups with no price. This change: 1. Makes the routing chain explicit. 2. Keeps the pricing table focused on billable groups. No breaking API changes; existing clients can ignore the new `auto_groups` field.
90 lines
2.8 KiB
JavaScript
90 lines
2.8 KiB
JavaScript
/*
|
|
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
|
|
*/
|
|
|
|
import React from 'react';
|
|
import { Layout, ImagePreview } from '@douyinfe/semi-ui';
|
|
import PricingSidebar from './PricingSidebar';
|
|
import PricingContent from './content/PricingContent';
|
|
import ModelDetailSideSheet from '../modal/ModelDetailSideSheet';
|
|
import { useModelPricingData } from '../../../../hooks/model-pricing/useModelPricingData';
|
|
import { useIsMobile } from '../../../../hooks/common/useIsMobile';
|
|
|
|
const PricingPage = () => {
|
|
const pricingData = useModelPricingData();
|
|
const { Sider, Content } = Layout;
|
|
const isMobile = useIsMobile();
|
|
const [showRatio, setShowRatio] = React.useState(false);
|
|
const [viewMode, setViewMode] = React.useState('card');
|
|
const allProps = {
|
|
...pricingData,
|
|
showRatio,
|
|
setShowRatio,
|
|
viewMode,
|
|
setViewMode
|
|
};
|
|
|
|
return (
|
|
<div className="bg-white">
|
|
<Layout className="pricing-layout">
|
|
{!isMobile && (
|
|
<Sider
|
|
className="pricing-scroll-hide pricing-sidebar"
|
|
width={460}
|
|
>
|
|
<PricingSidebar {...allProps} />
|
|
</Sider>
|
|
)}
|
|
|
|
<Content
|
|
className="pricing-scroll-hide pricing-content"
|
|
>
|
|
<PricingContent
|
|
{...allProps}
|
|
isMobile={isMobile}
|
|
sidebarProps={allProps}
|
|
/>
|
|
</Content>
|
|
</Layout>
|
|
|
|
<ImagePreview
|
|
src={pricingData.modalImageUrl}
|
|
visible={pricingData.isModalOpenurl}
|
|
onVisibleChange={(visible) => pricingData.setIsModalOpenurl(visible)}
|
|
/>
|
|
|
|
<ModelDetailSideSheet
|
|
visible={pricingData.showModelDetail}
|
|
onClose={pricingData.closeModelDetail}
|
|
modelData={pricingData.selectedModel}
|
|
groupRatio={pricingData.groupRatio}
|
|
usableGroup={pricingData.usableGroup}
|
|
currency={pricingData.currency}
|
|
tokenUnit={pricingData.tokenUnit}
|
|
displayPrice={pricingData.displayPrice}
|
|
showRatio={allProps.showRatio}
|
|
vendorsMap={pricingData.vendorsMap}
|
|
endpointMap={pricingData.endpointMap}
|
|
autoGroups={pricingData.autoGroups}
|
|
t={pricingData.t}
|
|
/>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default PricingPage;
|