constants.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. import { type TFunction } from 'i18next'
  2. import type { TokenUnit } from './types'
  3. // ----------------------------------------------------------------------------
  4. // Pricing Constants
  5. // ----------------------------------------------------------------------------
  6. /** Sort options for pricing models */
  7. export const SORT_OPTIONS = {
  8. NAME: 'name',
  9. PRICE_LOW: 'price-low',
  10. PRICE_HIGH: 'price-high',
  11. } as const
  12. export type SortOption = (typeof SORT_OPTIONS)[keyof typeof SORT_OPTIONS]
  13. export function getSortLabels(t: TFunction): Record<SortOption, string> {
  14. return {
  15. [SORT_OPTIONS.NAME]: t('Name'),
  16. [SORT_OPTIONS.PRICE_LOW]: t('Price: Low to High'),
  17. [SORT_OPTIONS.PRICE_HIGH]: t('Price: High to Low'),
  18. }
  19. }
  20. /** Filter values */
  21. export const FILTER_ALL = 'all'
  22. /** Quota type options */
  23. export const QUOTA_TYPES = {
  24. ALL: 'all',
  25. TOKEN: 'token',
  26. REQUEST: 'request',
  27. } as const
  28. export type QuotaTypeOption = (typeof QUOTA_TYPES)[keyof typeof QUOTA_TYPES]
  29. /** Quota type labels */
  30. export function getQuotaTypeLabels(
  31. t: TFunction
  32. ): Record<QuotaTypeOption, string> {
  33. return {
  34. [QUOTA_TYPES.ALL]: t('All Models'),
  35. [QUOTA_TYPES.TOKEN]: t('Token-based'),
  36. [QUOTA_TYPES.REQUEST]: t('Per Request'),
  37. }
  38. }
  39. /** Endpoint type options */
  40. export const ENDPOINT_TYPES = {
  41. ALL: 'all',
  42. OPENAI: 'openai',
  43. OPENAI_RESPONSE: 'openai-response',
  44. ANTHROPIC: 'anthropic',
  45. GEMINI: 'gemini',
  46. JINA_RERANK: 'jina-rerank',
  47. IMAGE_GENERATION: 'image-generation',
  48. EMBEDDINGS: 'embeddings',
  49. OPENAI_VIDEO: 'openai-video',
  50. } as const
  51. export type EndpointTypeOption =
  52. (typeof ENDPOINT_TYPES)[keyof typeof ENDPOINT_TYPES]
  53. /** Endpoint type labels */
  54. export function getEndpointTypeLabels(
  55. t: TFunction
  56. ): Record<EndpointTypeOption, string> {
  57. return {
  58. [ENDPOINT_TYPES.ALL]: t('All Types'),
  59. [ENDPOINT_TYPES.OPENAI]: 'Chat',
  60. [ENDPOINT_TYPES.OPENAI_RESPONSE]: 'Response',
  61. [ENDPOINT_TYPES.ANTHROPIC]: 'Anthropic',
  62. [ENDPOINT_TYPES.GEMINI]: 'Gemini',
  63. [ENDPOINT_TYPES.JINA_RERANK]: 'Rerank',
  64. [ENDPOINT_TYPES.IMAGE_GENERATION]: t('Image'),
  65. [ENDPOINT_TYPES.EMBEDDINGS]: t('Embeddings'),
  66. [ENDPOINT_TYPES.OPENAI_VIDEO]: t('Video'),
  67. }
  68. }
  69. /** Filter section keys */
  70. export const FILTER_SECTIONS = {
  71. PRICING_TYPE: 'pricingType',
  72. ENDPOINT_TYPE: 'endpointType',
  73. VENDOR: 'vendor',
  74. GROUP: 'group',
  75. TAG: 'tag',
  76. } as const
  77. /** Maximum number of tags to display in model row */
  78. export const MAX_TAGS_DISPLAY = 5
  79. /** Maximum number of filter items to display before showing "More..." */
  80. export const MAX_FILTER_ITEMS = 5
  81. /** Sidebar width */
  82. export const SIDEBAR_WIDTH = 'w-64'
  83. /** Excluded groups */
  84. export const EXCLUDED_GROUPS = ['', 'auto']
  85. /** Quota type values */
  86. export const QUOTA_TYPE_VALUES = {
  87. TOKEN: 0,
  88. REQUEST: 1,
  89. } as const
  90. /** Token unit divisors */
  91. export const TOKEN_UNIT_DIVISORS = {
  92. M: 1,
  93. K: 1000,
  94. } as const
  95. /** Default token unit for pricing display */
  96. export const DEFAULT_TOKEN_UNIT: TokenUnit = 'M'
  97. /** View mode options */
  98. export const VIEW_MODES = {
  99. LIST: 'list',
  100. TABLE: 'table',
  101. } as const
  102. export type ViewMode = (typeof VIEW_MODES)[keyof typeof VIEW_MODES]
  103. /** Default page size for pricing table */
  104. export const DEFAULT_PRICING_PAGE_SIZE = 20