Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

156 строки
3.9 KiB

  1. /*
  2. Copyright (C) 2025 QuantumNous
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <https://www.gnu.org/licenses/>.
  13. For commercial licensing, please contact support@quantumnous.com
  14. */
  15. import React from 'react';
  16. import { Button } from '@douyinfe/semi-ui';
  17. import PricingGroups from '../filter/PricingGroups';
  18. import PricingQuotaTypes from '../filter/PricingQuotaTypes';
  19. import PricingEndpointTypes from '../filter/PricingEndpointTypes';
  20. import PricingVendors from '../filter/PricingVendors';
  21. import PricingTags from '../filter/PricingTags';
  22. import { resetPricingFilters } from '../../../../helpers/utils';
  23. import { usePricingFilterCounts } from '../../../../hooks/model-pricing/usePricingFilterCounts';
  24. const PricingSidebar = ({
  25. showWithRecharge,
  26. setShowWithRecharge,
  27. currency,
  28. setCurrency,
  29. handleChange,
  30. setActiveKey,
  31. showRatio,
  32. setShowRatio,
  33. viewMode,
  34. setViewMode,
  35. filterGroup,
  36. setFilterGroup,
  37. handleGroupClick,
  38. filterQuotaType,
  39. setFilterQuotaType,
  40. filterEndpointType,
  41. setFilterEndpointType,
  42. filterVendor,
  43. setFilterVendor,
  44. filterTag,
  45. setFilterTag,
  46. currentPage,
  47. setCurrentPage,
  48. tokenUnit,
  49. setTokenUnit,
  50. loading,
  51. t,
  52. ...categoryProps
  53. }) => {
  54. const {
  55. quotaTypeModels,
  56. endpointTypeModels,
  57. vendorModels,
  58. tagModels,
  59. groupCountModels,
  60. } = usePricingFilterCounts({
  61. models: categoryProps.models,
  62. filterGroup,
  63. filterQuotaType,
  64. filterEndpointType,
  65. filterVendor,
  66. filterTag,
  67. searchValue: categoryProps.searchValue,
  68. });
  69. const handleResetFilters = () =>
  70. resetPricingFilters({
  71. handleChange,
  72. setShowWithRecharge,
  73. setCurrency,
  74. setShowRatio,
  75. setViewMode,
  76. setFilterGroup,
  77. setFilterQuotaType,
  78. setFilterEndpointType,
  79. setFilterVendor,
  80. setFilterTag,
  81. setCurrentPage,
  82. setTokenUnit,
  83. });
  84. return (
  85. <div className='p-2'>
  86. <div className='flex items-center justify-between mb-6'>
  87. <div className='text-lg font-semibold text-gray-800'>{t('筛选')}</div>
  88. <Button
  89. theme='outline'
  90. type='tertiary'
  91. onClick={handleResetFilters}
  92. className='text-gray-500 hover:text-gray-700'
  93. >
  94. {t('重置')}
  95. </Button>
  96. </div>
  97. <PricingVendors
  98. filterVendor={filterVendor}
  99. setFilterVendor={setFilterVendor}
  100. models={vendorModels}
  101. allModels={categoryProps.models}
  102. loading={loading}
  103. t={t}
  104. />
  105. {/* <PricingTags
  106. filterTag={filterTag}
  107. setFilterTag={setFilterTag}
  108. models={tagModels}
  109. allModels={categoryProps.models}
  110. loading={loading}
  111. t={t}
  112. /> */}
  113. <PricingGroups
  114. filterGroup={filterGroup}
  115. setFilterGroup={handleGroupClick}
  116. usableGroup={categoryProps.usableGroup}
  117. groupRatio={categoryProps.groupRatio}
  118. models={groupCountModels}
  119. loading={loading}
  120. t={t}
  121. />
  122. <PricingQuotaTypes
  123. filterQuotaType={filterQuotaType}
  124. setFilterQuotaType={setFilterQuotaType}
  125. models={quotaTypeModels}
  126. loading={loading}
  127. t={t}
  128. />
  129. {/* <PricingEndpointTypes
  130. filterEndpointType={filterEndpointType}
  131. setFilterEndpointType={setFilterEndpointType}
  132. models={endpointTypeModels}
  133. allModels={categoryProps.models}
  134. loading={loading}
  135. t={t}
  136. /> */}
  137. </div>
  138. );
  139. };
  140. export default PricingSidebar;