Ver Fonte

feat:8服务器上更新的最新版代码

韩洋 há 3 semanas atrás
pai
commit
0589bcefd5

BIN
default/dist.zip


+ 1 - 1
default/src/features/auth/sign-in/components/user-auth-form.tsx

@@ -61,7 +61,7 @@ function getTenantUniqueIdFromPath() {
   if (
     tokenPrefix !== 'token' ||
     !tenantUniqueId ||
-    tenantUniqueId === 'token_main'
+    tenantUniqueId === 'token_main' 
   ) {
     return ''
   }

+ 6 - 6
default/src/features/dashboard/components/users/user-charts.tsx

@@ -88,8 +88,8 @@ export function UserCharts(props: UserChartsProps) {
     () =>
       isTenantView
         ? {
-            rank: 'Tenant Consumption Ranking',
-            trend: 'Tenant Consumption Trend',
+            rank: 'Enterprise Consumption Ranking',
+            trend: 'Enterprise Consumption Trend',
           }
         : {
             rank: 'User Consumption Ranking',
@@ -182,12 +182,12 @@ export function UserCharts(props: UserChartsProps) {
         t,
         topUserLimit,
         {
-          entityLabelKey: isTenantView ? 'Tenant' : 'User',
+          entityLabelKey: isTenantView ? 'Enterprise' : 'User',
           rankTitleKey: isTenantView
-            ? 'Tenant Consumption Ranking'
+            ? 'Enterprise Consumption Ranking'
             : 'User Consumption Ranking',
           trendTitleKey: isTenantView
-            ? 'Tenant Consumption Trend'
+            ? 'Enterprise Consumption Trend'
             : 'User Consumption Trend',
         }
       ),
@@ -260,7 +260,7 @@ export function UserCharts(props: UserChartsProps) {
         >
           <TabsList>
             <span className='text-muted-foreground px-2 text-xs font-medium whitespace-nowrap'>
-              {isTenantView ? t('Top Tenants') : t('Top Users')}
+              {isTenantView ? t('Top Enterprises') : t('Top Users')}
             </span>
             {TOP_USER_LIMIT_OPTIONS.map((limit) => (
               <TabsTrigger

+ 2 - 2
default/src/features/dashboard/constants.ts

@@ -51,8 +51,8 @@ export const TIME_RANGE_PRESETS = [
 ] as const
 
 export const DASHBOARD_DATA_TYPE_OPTIONS = [
-  { label: 'Platform', value: 'platform' },
-  { label: 'Tenant', value: 'tenant' },
+  { label: 'User', value: 'platform' },
+  { label: 'Enterprise', value: 'tenant' },
 ] as const
 
 export const CONSUMPTION_DISTRIBUTION_CHART_OPTIONS = [

+ 1 - 7
default/src/features/dashboard/index.tsx

@@ -158,7 +158,6 @@ export function Dashboard() {
   const { t } = useTranslation()
   const navigate = useNavigate()
   const params = route.useParams()
-  const userRole = useAuthStore((state) => state.auth.user?.role)
   const activeSection = (params.section ??
     DASHBOARD_DEFAULT_SECTION) as DashboardSectionId
 
@@ -200,12 +199,7 @@ export function Dashboard() {
   )
 
   const meta = SECTION_META[activeSection] ?? SECTION_META.models
-  const isAdmin = Boolean(userRole && userRole >= ROLE.ADMIN)
-  const visibleSections = useMemo(
-    () =>
-      DASHBOARD_SECTION_IDS.filter((section) => section !== 'users' || isAdmin),
-    [isAdmin]
-  )
+  const visibleSections = useMemo(() => DASHBOARD_SECTION_IDS, [])
   const handleSectionChange = useCallback(
     (section: string) => {
       void navigate({

+ 2 - 12
default/src/features/dashboard/section-registry.tsx

@@ -42,15 +42,12 @@ const DASHBOARD_SECTIONS = [
   {
     id: 'users',
     titleKey: 'User Analytics',
-    adminOnly: true,
     build: () => null,
   },
 ] as const
 
 export type DashboardSectionId = (typeof DASHBOARD_SECTIONS)[number]['id']
 
-const ADMIN_ONLY_SECTIONS = new Set<string>(['users'])
-
 const dashboardRegistry = createSectionRegistry<
   DashboardSectionId,
   Record<string, never>,
@@ -65,13 +62,6 @@ const dashboardRegistry = createSectionRegistry<
 export const DASHBOARD_SECTION_IDS = dashboardRegistry.sectionIds
 export const DASHBOARD_DEFAULT_SECTION = dashboardRegistry.defaultSection
 
-export function getDashboardSectionNavItems(
-  t: TFunction,
-  options?: { isAdmin?: boolean }
-) {
-  const all = dashboardRegistry.getSectionNavItems(t)
-  if (options?.isAdmin) return all
-  return all.filter(
-    (_, idx) => !ADMIN_ONLY_SECTIONS.has(DASHBOARD_SECTIONS[idx].id)
-  )
+export function getDashboardSectionNavItems(t: TFunction) {
+  return dashboardRegistry.getSectionNavItems(t)
 }

+ 68 - 8
default/src/features/quota/api.ts

@@ -1,10 +1,69 @@
-import { api } from '@/lib/api'
+// import { api } from '@/lib/api'
 
-import type { QuotaListResponse, QuotaListScope, QuotaOverviewResponse } from './types'
+import type { QuotaListResponse, QuotaListData, QuotaListScope, QuotaOverviewResponse } from './types'
+
+// ============================================================================
+// Mock 数据(临时)
+// ============================================================================
+
+const MOCK_OVERVIEW: QuotaOverviewResponse = {
+  success: true,
+  data: {
+    quota_total: 10000000,
+    consumed_quota: 6250000,
+    remaining_quota: 3750000,
+    allocated_to_children: 8000000,
+  },
+}
+
+function buildMockList(scope: QuotaListScope, page: number, pageSize: number): QuotaListResponse {
+  const names =
+    scope === 'platform'
+      ? ['Alice', 'Bob', 'Charlie', 'David', 'Eve', 'Frank', 'Grace', 'Henry', 'Ivy', 'Jack']
+      : ['Acme Corp', 'Globex', 'Initech', 'Umbrella', 'Stark Industries', 'Wayne Enterprises']
+  const total = 47
+  const start = (page - 1) * pageSize
+  const end = Math.min(start + pageSize, total)
+  const items = Array.from({ length: end - start }, (_, i) => {
+    const idx = start + i
+    const name = names[idx % names.length] + (idx >= names.length ? ` ${Math.floor(idx / names.length) + 1}` : '')
+    const allocated = [500000, 1000000, -1, 200000, 800000][idx % 5]
+    const consumed = [120000, 340000, 56000, 89000, 230000][idx % 5]
+    const remaining = allocated === -1 ? -1 : allocated - consumed
+    return {
+      tenant_id: idx + 1,
+      tenant_name: name,
+      unique_id: `t-${idx + 1}`,
+      allocated_quota: allocated,
+      consumed_quota: consumed,
+      remaining_quota: remaining,
+    }
+  })
+
+  const data: QuotaListData = {
+    items,
+    total,
+    page,
+    page_size: pageSize,
+    summary: {
+      total_count: total,
+      total_allocated: 9800000,
+      total_consumed: 6250000,
+      total_remaining: 3550000,
+    },
+  }
+
+  return { success: true, data }
+}
+
+// ============================================================================
+// API
+// ============================================================================
 
 export async function getQuotaOverview() {
-  const res = await api.get<QuotaOverviewResponse>('/api/tenants/quota/overview')
-  return res.data
+  // const res = await api.get<QuotaOverviewResponse>('/api/tenants/quota/overview')
+  // return res.data
+  return Promise.resolve(MOCK_OVERVIEW)
 }
 
 export async function getQuotaList(params: {
@@ -13,8 +72,9 @@ export async function getQuotaList(params: {
   page_size?: number
 } = {}) {
   const { scope = 'tenant', p = 1, page_size = 20 } = params
-  const res = await api.get<QuotaListResponse>('/api/tenants/quota/list', {
-    params: { scope, p, page_size },
-  })
-  return res.data
+  // const res = await api.get<QuotaListResponse>('/api/tenants/quota/list', {
+  //   params: { scope, p, page_size },
+  // })
+  // return res.data
+  return Promise.resolve(buildMockList(scope, p, page_size))
 }

+ 5 - 13
default/src/features/quota/index.tsx

@@ -42,10 +42,8 @@ import {
   TableHeader,
   TableRow,
 } from '@/components/ui/table'
-import { ROLE } from '@/lib/roles'
 import { stringToColor } from '@/lib/format'
 import { cn, getPageNumbers } from '@/lib/utils'
-import { useAuthStore } from '@/stores/auth-store'
 
 import { getQuotaList, getQuotaOverview } from './api'
 import type { QuotaListItem, QuotaListScope, QuotaOverview } from './types'
@@ -327,13 +325,9 @@ function useQuotaListData(
 
 function QuotaList() {
   const { t } = useTranslation()
-  const user = useAuthStore((state) => state.auth.user)
-  const isRoot = user?.role === ROLE.SUPER_ADMIN
 
   // scope toggle state
-  const [scope, setScope] = useState<QuotaListScope>(
-    isRoot ? 'platform' : 'tenant'
-  )
+  const [scope, setScope] = useState<QuotaListScope>('tenant')
   const [page, setPage] = useState(1)
   const [pageSize, setPageSize] = useState(DEFAULT_PAGE_SIZE)
 
@@ -377,12 +371,10 @@ function QuotaList() {
     [visibleColumns]
   )
 
-  const scopeOptions: { value: QuotaListScope; label: string }[] = isRoot
-    ? [
-        { value: 'platform', label: t('Platform Quota') },
-        { value: 'tenant', label: t('Tenant Quota') },
-      ]
-    : [{ value: 'tenant', label: t('Tenant Quota') }]
+  const scopeOptions: { value: QuotaListScope; label: string }[] = [
+    { value: 'platform', label: t('User Quota') },
+    { value: 'tenant', label: t('Enterprise Quota') },
+  ]
 
   return (
     <section className='space-y-3'>

+ 2 - 2
default/src/features/usage-logs/components/columns/common-logs-columns.tsx

@@ -288,7 +288,7 @@ export function useCommonLogsColumns(
   consumeType?: 'platform' | 'tenant'
 ): ColumnDef<UsageLog>[] {
   const { t } = useTranslation()
-  const userColumnHeader = consumeType === 'tenant' ? t('Tenant') : t('User')
+  const userColumnHeader = consumeType === 'tenant' ? t('Enterprise') : t('User')
   const columns: ColumnDef<UsageLog>[] = [
     {
       accessorKey: 'created_at',
@@ -694,7 +694,7 @@ export function useAuditLogsColumns(
   consumeType?: 'platform' | 'tenant'
 ): ColumnDef<UsageLog>[] {
   const { t } = useTranslation()
-  const userColumnHeader = consumeType === 'tenant' ? t('Tenant') : t('User')
+  const userColumnHeader = consumeType === 'tenant' ? t('Enterprise') : t('User')
   const columns: ColumnDef<UsageLog>[] = [
     {
       accessorKey: 'created_at',

+ 3 - 3
default/src/features/usage-logs/components/common-logs-filter-bar.tsx

@@ -277,12 +277,12 @@ export function CommonLogsFilterBar<TData>(
   ].filter(Boolean).length
   const sensitiveType = sensitiveVisible ? 'text' : 'password'
   const consumeTypeItems = [
-    { value: 'platform', label: t('Platform') },
-    { value: 'tenant', label: t('Tenant') },
+    { value: 'platform', label: t('User') },
+    { value: 'tenant', label: t('Enterprise') },
   ]
   const consumeTypeLabel =
     consumeTypeItems.find((item) => item.value === filters.consumeType)?.label ??
-    t('Platform')
+    t('User')
   const auditLogTypeLabel =
     t(
       auditLogTypeItems.find((item) => item.value === filters.logType)?.label ??

+ 31 - 27
default/src/i18n/locales/en.json

@@ -628,7 +628,7 @@
     "Batch testing models...": "Batch testing models...",
     "Batch upstream model update": "Batch upstream model update",
     "Batch upstream model updates applied: {{channels}} channels, {{added}} added, {{removed}} removed, {{fails}} failed": "Batch upstream model updates applied: {{channels}} channels, {{added}} added, {{removed}} removed, {{fails}} failed",
-    "Best for single-tenant deployments. Pricing and billing options stay hidden.": "Best for single-tenant deployments. Pricing and billing options stay hidden.",
+    "Best for single-tenant deployments. Pricing and billing options stay hidden.": "Best for single-Tenant deployments. Pricing and billing options stay hidden.",
     "Best TTFT": "Best TTFT",
     "Billable input tokens": "Billable input tokens",
     "Billable output tokens": "Billable output tokens",
@@ -1608,7 +1608,7 @@
     "Enable FunctionCall thoughtSignature Fill": "Enable FunctionCall thoughtSignature Fill",
     "Enable GitHub OAuth": "Enable GitHub OAuth",
     "Enable Groups": "Enable Groups",
-    "Enable if this is an OpenRouter enterprise account with special response format": "Enable if this is an OpenRouter enterprise account with special response format",
+    "Enable if this is an OpenRouter enterprise account with special response format": "Enable if this is an OpenRouter Tenant account with special response format",
     "Enable io.net deployments": "Enable io.net deployments",
     "Enable io.net model deployment service in console": "Enable io.net model deployment service in console",
     "Enable LinuxDO OAuth": "Enable LinuxDO OAuth",
@@ -1730,8 +1730,11 @@
     "Enter your registered email and we will send you a link to reset your password.": "Enter your registered email and we will send you a link to reset your password.",
     "Enter your username": "Enter your username",
     "Enter your username or email": "Enter your username or email",
-    "Enterprise Account": "Enterprise Account",
-    "Enterprise-grade security with comprehensive permission management": "Enterprise-grade security with comprehensive permission management",
+    "Enterprise": "Tenant",
+    "Enterprise Account": "Tenant Account",
+    "Enterprise Consumption Ranking": "Tenant Consumption Ranking",
+    "Enterprise Consumption Trend": "Tenant Consumption Trend",
+    "Enterprise-grade security with comprehensive permission management": "Tenant-grade security with comprehensive permission management",
     "Entrypoint (space separated)": "Entrypoint (space separated)",
     "Env (JSON object)": "Env (JSON object)",
     "Environment variables": "Environment variables",
@@ -3338,7 +3341,7 @@
     "Pay with Balance": "Pay with Balance",
     "Pay-as-you-go with real-time usage monitoring": "Pay-as-you-go with real-time usage monitoring",
     "Payment": "Payment",
-    "Payment aggregator mode — onboard with your own registered company (offshore entity). Built for Enterprise.": "Payment aggregator mode — onboard with your own registered company (offshore entity). Built for Enterprise.",
+    "Payment aggregator mode — onboard with your own registered company (offshore entity). Built for Enterprise.": "Payment aggregator mode — onboard with your own registered company (offshore entity). Built for Tenant.",
     "Payment Channel": "Payment Channel",
     "Payment Gateway": "Payment Gateway",
     "Payment initiated": "Payment initiated",
@@ -3414,7 +3417,7 @@
     "Plan title is required": "Plan title is required",
     "Planned maintenance on Friday at 22:00 UTC...": "Planned maintenance on Friday at 22:00 UTC...",
     "Platform": "Platform",
-    "Platform Quota": "Platform Quota",
+    "User Quota": "User Quota",
     "Platform Management": "Platform Management",
     "Platform Users": "Platform Users",
     "Personal Management": "Personal Management",
@@ -4742,7 +4745,7 @@
     "Top P": "Top P",
     "Top up balance and view billing history.": "Top up balance and view billing history.",
     "Top Users": "Top Users",
-    "Top Tenants": "Top Tenants",
+    "Top Enterprises": "Top Tenants",
     "Top vendors": "Top vendors",
     "Top-up": "Top-up",
     "Top-up amount options": "Top-up amount options",
@@ -5190,7 +5193,7 @@
     "Weighted by request count": "Weighted by request count",
     "Welcome back!": "Welcome back!",
     "Welcome to register": "Welcome to register",
-    "Welcome to register · {{tenantName}}": "Welcome to register · {{tenantName}}",
+    "Welcome to register · {{tenantName}}": "Welcome to register · {{TenantName}}",
     "Welcome to our New API...": "Welcome to our New API...",
     "Well-Known URL": "Well-Known URL",
     "Well-Known URL must start with http:// or https://": "Well-Known URL must start with http:// or https://",
@@ -5328,7 +5331,7 @@
     "All permission modules and actions assigned to this role.": "All permission modules and actions assigned to this role.",
     "No permissions assigned": "No permissions assigned",
     "Select available modules and actions for this role.": "Select available modules and actions for this role.",
-    "Select available modules and actions for this tenant.": "View available modules and actions for this tenant.",
+    "Select available modules and actions for this tenant.": "View available modules and actions for this Tenant.",
     "Manage channel list, test channels, and update channel settings": "Manage channel list, test channels, and update channel settings",
     "Model Management": "Model Management",
     "Manage model metadata, pricing, and upstream model mappings": "Manage model metadata, pricing, and upstream model mappings",
@@ -5342,6 +5345,7 @@
     "Are you sure you want to delete role {{name}}?": "Are you sure you want to delete role {{name}}?",
     "Keys": "Keys",
     "Tenant Management": "Tenant Management",
+    "Enterprise Quota": "Tenant Quota",
     "Tenant List": "Tenant List",
     "Tenants": "Tenants",
     "Tenant Name": "Tenant Name",
@@ -5362,18 +5366,18 @@
     "Create Tenant": "Create Tenant",
     "Edit Tenant": "Edit Tenant",
     "Delete Tenant": "Delete Tenant",
-    "Enter tenant name": "Enter tenant name",
-    "Enter tenant code": "Enter tenant code",
+    "Enter tenant name": "Enter Tenant name",
+    "Enter tenant code": "Enter Tenant code",
     "Enter group": "Enter group",
     "Enter administrator name": "Enter administrator name",
     "Enter administrator email": "Enter administrator email",
     "Enter remark": "Enter remark",
     "Select status": "Select status",
     "Select administrator status": "Select administrator status",
-    "Configure tenant identity and administrator information.": "Configure tenant identity and administrator information.",
-    "Manage status, quota limit and time range for this tenant.": "Manage status, quota limit and time range for this tenant.",
-    "Create a new tenant and assign initial resource settings.": "Create a new tenant and assign initial resource settings.",
-    "Update tenant information and resource settings.": "Update tenant information and resource settings.",
+    "Configure tenant identity and administrator information.": "Configure Tenant identity and administrator information.",
+    "Manage status, quota limit and time range for this tenant.": "Manage status, quota limit and time range for this Tenant.",
+    "Create a new tenant and assign initial resource settings.": "Create a new Tenant and assign initial resource settings.",
+    "Update tenant information and resource settings.": "Update Tenant information and resource settings.",
     "Tenant name is required": "Tenant name is required",
     "Tenant code is required": "Tenant code is required",
     "Administrator is required": "Administrator is required",
@@ -5382,18 +5386,18 @@
     "Tenant created successfully": "Tenant created successfully",
     "Tenant deleted successfully": "Tenant deleted successfully",
     "No Tenants Found": "No Tenants Found",
-    "No tenants available. Try adjusting your search.": "No tenants available. Try adjusting your search.",
-    "Filter by tenant name, code, group or administrator...": "Filter by tenant name, code, group or administrator...",
-    "Are you sure you want to delete tenant {{name}}?": "Are you sure you want to delete tenant {{name}}?",
+    "No tenants available. Try adjusting your search.": "No Tenants available. Try adjusting your search.",
+    "Filter by tenant name, code, group or administrator...": "Filter by Tenant name, code, group or administrator...",
+    "Are you sure you want to delete tenant {{name}}?": "Are you sure you want to delete Tenant {{name}}?",
     "Invalid email address": "Invalid email address",
     "End date cannot be earlier than start date": "End date cannot be earlier than start date",
     "Invitation sent to {{email}}": "Invitation sent to {{email}}",
     "Tenant enabled successfully": "Tenant enabled successfully",
     "Tenant disabled successfully": "Tenant disabled successfully",
-    "Are you sure you want to disable tenant {{name}}?": "Are you sure you want to disable tenant {{name}}?",
-    "Are you sure you want to enable tenant {{name}}?": "Are you sure you want to enable tenant {{name}}?",
-    "View tenant information and administrator details.": "View tenant information and administrator details.",
-    "View tenant information and permission parameter details.": "View tenant information and permission parameter details.",
+    "Are you sure you want to disable tenant {{name}}?": "Are you sure you want to disable Tenant {{name}}?",
+    "Are you sure you want to enable tenant {{name}}?": "Are you sure you want to enable Tenant {{name}}?",
+    "View tenant information and administrator details.": "View Tenant information and administrator details.",
+    "View tenant information and permission parameter details.": "View Tenant information and permission parameter details.",
     "Invite administrator to register": "Invite administrator to register",
     "Tenant Details": "Tenant Details",
     "Administrator Information": "Administrator Information",
@@ -5409,15 +5413,15 @@
     "Select group": "Select group",
     "Permission Configuration": "Permission Configuration",
     "Permissions will be loaded from the API and displayed as a tree.": "Permissions will be loaded from the API and displayed as a tree.",
-    "Configure tenant identity and contact information.": "Configure tenant identity and contact information.",
-    "Manage quota limit and time range for this tenant.": "Manage quota limit and time range for this tenant.",
+    "Configure tenant identity and contact information.": "Configure Tenant identity and contact information.",
+    "Manage quota limit and time range for this tenant.": "Manage quota limit and time range for this Tenant.",
     "Save and invite administrator": "Save and invite administrator",
     "Invite Administrator": "Invite Administrator",
-    "Send an invitation email to the tenant administrator.": "Send an invitation email to the tenant administrator.",
+    "Send an invitation email to the tenant administrator.": "Send an invitation email to the Tenant administrator.",
     "Send Invitation": "Send Invitation",
     "Administrator Registration": "Administrator Registration",
-    "Send the link below to the administrator of {{tenantName}}. After opening the link, the administrator enters the welcome registration page and only needs to fill in the account and password to complete registration and enter the institution portal. They will automatically see the menu and button permissions you assigned.": "Send the link below to the administrator of {{tenantName}}. After opening the link, the administrator enters the welcome registration page and only needs to fill in the account and password to complete registration and enter the institution portal. They will automatically see the menu and button permissions you assigned.",
-    "Send the link below to the administrator of {{tenantName}}": "Send the link below to the administrator of {{tenantName}}",
+    "Send the link below to the administrator of {{tenantName}}. After opening the link, the administrator enters the welcome registration page and only needs to fill in the account and password to complete registration and enter the institution portal. They will automatically see the menu and button permissions you assigned.": "Send the link below to the administrator of {{TenantName}}. After opening the link, the administrator enters the welcome registration page and only needs to fill in the account and password to complete registration and enter the institution portal. They will automatically see the menu and button permissions you assigned.",
+    "Send the link below to the administrator of {{tenantName}}": "Send the link below to the administrator of {{TenantName}}",
     "After opening the link, the administrator enters the welcome registration page and only needs to fill in the account and password to complete registration and enter the institution portal. They will automatically see the menu and button permissions you assigned.": "After opening the link, the administrator enters the welcome registration page and only needs to fill in the account and password to complete registration and enter the institution portal. They will automatically see the menu and button permissions you assigned.",
     "Copy invitation link": "Copy invitation link",
     "Invitation link copied": "Invitation link copied",

+ 41 - 40
default/src/i18n/locales/zh.json

@@ -1732,6 +1732,7 @@
     "Enter your registered email and we will send you a link to reset your password.": "输入您注册的邮箱,我们将向您发送一个重置密码的链接。",
     "Enter your username": "输入您的用户名",
     "Enter your username or email": "输入您的用户名或电子邮件",
+    "Enterprise": "企业",
     "Enterprise Account": "企业账户",
     "Enterprise-grade security with comprehensive permission management": "企业级安全性,提供全面的权限管理",
     "Entrypoint (space separated)": "入口点 (空格分隔)",
@@ -3417,7 +3418,7 @@
     "Plan title is required": "套餐标题为必填项",
     "Planned maintenance on Friday at 22:00 UTC...": "计划于周五 22:00 UTC 进行维护...",
     "Platform": "平台",
-    "Platform Quota": "平台配额",
+    "User Quota": "用户配额",
     "Platform Management": "平台管理",
     "Platform Users": "用户管理",
     "Personal Management": "个人管理",
@@ -5003,8 +5004,8 @@
     "User Analytics": "用户统计",
     "User Consumption Ranking": "用户消耗排行",
     "User Consumption Trend": "用户消耗趋势",
-    "Tenant Consumption Ranking": "租户消耗排行",
-    "Tenant Consumption Trend": "租户消耗趋势",
+    "Enterprise Consumption Ranking": "企业消耗排行",
+    "Enterprise Consumption Trend": "企业消耗趋势",
     "User created successfully": "用户创建成功",
     "User dashboard and quota controls.": "用户仪表板和配额控制。",
     "User deleted successfully": "用户删除成功",
@@ -5325,13 +5326,13 @@
     "Enable this role for assignment": "允许将该角色分配给用户",
     "Data Scope": "数据范围",
     "Current platform data": "当前平台数据",
-    "Tenant": "租户",
+    "Tenant": "企业",
     "Permission Parameters": "权限参数",
     "All Permissions": "全部权限",
     "All permission modules and actions assigned to this role.": "该角色已分配的全部权限模块和操作。",
     "No permissions assigned": "未分配权限",
     "Select available modules and actions for this role.": "选择该角色可用的模块和操作权限。",
-    "Select available modules and actions for this tenant.": "查看该租户可用的模块和操作权限。",
+    "Select available modules and actions for this tenant.": "查看该企业可用的模块和操作权限。",
     "Manage channel list, test channels, and update channel settings": "管理渠道列表、测试渠道和更新渠道设置",
     "Model Management": "模型管理",
     "Manage model metadata, pricing, and upstream model mappings": "管理模型元数据、价格和上游模型映射",
@@ -5345,13 +5346,13 @@
     "Are you sure you want to delete role {{name}}?": "确定要删除角色“{{name}}”吗?",
     "Keys": "API 密钥",
     "Tenant Management": "企业管理",
-    "Tenant Quota Management": "租户配额管理",
-    "Tenant Quota": "租户配额",
+    "Tenant Quota Management": "企业配额管理",
+    "Enterprise Quota": "企业配额",
     "Tenant List": "企业列表",
     "Tenants": "企业列表",
-    "Tenant Name": "租户名称",
-    "Tenant Code": "租户编码",
-    "Tenant Status": "租户状态",
+    "Tenant Name": "企业名称",
+    "Tenant Code": "企业编码",
+    "Tenant Status": "企业状态",
     "Administrator": "管理员",
     "Administrator Email": "管理员邮箱",
     "Administrator Status": "管理员状态",
@@ -5361,50 +5362,50 @@
     "Quota Limit": "额度上限",
     "Authorization Time": "授权时间",
     "Time Range": "时间区间",
-    "Tenant Settings": "租户设置",
+    "Tenant Settings": "企业设置",
     "Start Date": "开始日期",
     "End Date": "结束日期",
-    "Create Tenant": "创建租户",
-    "Edit Tenant": "编辑租户",
-    "Delete Tenant": "删除租户",
-    "Enter tenant name": "输入租户名称",
-    "Enter tenant code": "输入租户编码",
+    "Create Tenant": "创建企业",
+    "Edit Tenant": "编辑企业",
+    "Delete Tenant": "删除企业",
+    "Enter tenant name": "输入企业名称",
+    "Enter tenant code": "输入企业编码",
     "Enter group": "输入分组",
     "Enter administrator name": "输入管理员姓名",
     "Enter administrator email": "输入管理员邮箱",
     "Enter remark": "输入备注",
     "Select status": "选择状态",
     "Select administrator status": "选择管理员状态",
-    "Configure tenant identity and administrator information.": "配置租户身份和管理员信息。",
-    "Manage status, quota limit and time range for this tenant.": "管理该租户的状态、额度上限和时间区间。",
-    "Create a new tenant and assign initial resource settings.": "创建新租户并分配初始资源设置。",
-    "Update tenant information and resource settings.": "更新租户信息和资源设置。",
-    "Tenant name is required": "租户名称不能为空",
-    "Tenant code is required": "租户编码不能为空",
+    "Configure tenant identity and administrator information.": "配置企业身份和管理员信息。",
+    "Manage status, quota limit and time range for this tenant.": "管理该企业的状态、额度上限和时间区间。",
+    "Create a new tenant and assign initial resource settings.": "创建新企业并分配初始资源设置。",
+    "Update tenant information and resource settings.": "更新企业信息和资源设置。",
+    "Tenant name is required": "企业名称不能为空",
+    "Tenant code is required": "企业编码不能为空",
     "Administrator is required": "管理员不能为空",
     "Quota must be greater than or equal to 0": "额度必须大于或等于 0",
-    "Tenant updated successfully": "租户更新成功",
-    "Tenant created successfully": "租户创建成功",
-    "Tenant deleted successfully": "租户删除成功",
-    "No Tenants Found": "暂无租户",
-    "No tenants available. Try adjusting your search.": "暂无租户,请尝试调整搜索条件。",
-    "Filter by tenant name, code, group or administrator...": "按租户名称、编码、分组或管理员筛选...",
-    "Are you sure you want to delete tenant {{name}}?": "确定要删除租户“{{name}}”吗?",
+    "Tenant updated successfully": "企业更新成功",
+    "Tenant created successfully": "企业创建成功",
+    "Tenant deleted successfully": "企业删除成功",
+    "No Tenants Found": "暂无企业",
+    "No tenants available. Try adjusting your search.": "暂无企业,请尝试调整搜索条件。",
+    "Filter by tenant name, code, group or administrator...": "按企业名称、编码、分组或管理员筛选...",
+    "Are you sure you want to delete tenant {{name}}?": "确定要删除企业“{{name}}”吗?",
     "Invalid email address": "邮箱地址格式不正确",
     "End date cannot be earlier than start date": "结束时间不能早于开始时间",
     "Invitation sent to {{email}}": "邀请已发送至 {{email}}",
-    "Tenant enabled successfully": "租户启用成功",
-    "Tenant disabled successfully": "租户禁用成功",
-    "Are you sure you want to disable tenant {{name}}?": "确定要禁用租户“{{name}}”吗?",
-    "Are you sure you want to enable tenant {{name}}?": "确定要启用租户“{{name}}”吗?",
-    "View tenant information and administrator details.": "查看租户信息和管理员详情。",
-    "View tenant information and permission parameter details.": "查看租户信息和权限参数详情。",
+    "Tenant enabled successfully": "企业启用成功",
+    "Tenant disabled successfully": "企业禁用成功",
+    "Are you sure you want to disable tenant {{name}}?": "确定要禁用企业“{{name}}”吗?",
+    "Are you sure you want to enable tenant {{name}}?": "确定要启用企业“{{name}}”吗?",
+    "View tenant information and administrator details.": "查看企业信息和管理员详情。",
+    "View tenant information and permission parameter details.": "查看企业信息和权限参数详情。",
     "Invite administrator to register": "邀请管理员注册",
-    "Tenant Details": "租户详情",
+    "Tenant Details": "企业详情",
     "Administrator Information": "管理员信息",
     "Resource Settings": "资源设置",
     "No remark": "暂无备注",
-    "Tenant ID": "租户 ID",
+    "Tenant ID": "企业 ID",
     "Contact Person": "联系人",
     "Contact Phone": "联系电话",
     "Contact Email": "联系邮箱",
@@ -5414,11 +5415,11 @@
     "Select group": "请选择分组",
     "Permission Configuration": "权限配置",
     "Permissions will be loaded from the API and displayed as a tree.": "权限会从接口获取,并以树状结构展示。",
-    "Configure tenant identity and contact information.": "配置租户身份和联系人信息。",
-    "Manage quota limit and time range for this tenant.": "管理该租户的额度上限和时间区间。",
+    "Configure tenant identity and contact information.": "配置企业身份和联系人信息。",
+    "Manage quota limit and time range for this tenant.": "管理该企业的额度上限和时间区间。",
     "Save and invite administrator": "保存并邀请管理员",
     "Invite Administrator": "邀请管理员",
-    "Send an invitation email to the tenant administrator.": "向租户管理员发送邀请邮件。",
+    "Send an invitation email to the tenant administrator.": "向企业管理员发送邀请邮件。",
     "Send Invitation": "发送邀请",
     "Administrator Registration": "管理员注册",
     "Send the link below to the administrator of {{tenantName}}. After opening the link, the administrator enters the welcome registration page and only needs to fill in the account and password to complete registration and enter the institution portal. They will automatically see the menu and button permissions you assigned.": "将下方链接发送给「{{tenantName}}」的管理员,管理员打开链接后进入欢迎注册界面,只需填写账号与密码即可完成注册并进入机构端,自动看到您为其分配的菜单与按钮权限。",

+ 1 - 12
default/src/routes/_authenticated/groups/index.tsx

@@ -17,12 +17,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
 For commercial licensing, please contact support@quantumnous.com
 */
 
-import { createFileRoute, redirect } from '@tanstack/react-router'
+import { createFileRoute } from '@tanstack/react-router'
 import z from 'zod'
 
 import { Groups } from '@/features/groups'
-import { PERMISSION_CODES, hasPermissionCode } from '@/lib/admin-permissions'
-import { useAuthStore } from '@/stores/auth-store'
 
 const groupsSearchSchema = z.object({
   page: z.number().optional().catch(1),
@@ -31,15 +29,6 @@ const groupsSearchSchema = z.object({
 })
 
 export const Route = createFileRoute('/_authenticated/groups/')({
-  beforeLoad: () => {
-    const { auth } = useAuthStore.getState()
-
-    if (!hasPermissionCode(auth.user, PERMISSION_CODES.GROUP_VIEW)) {
-      throw redirect({
-        to: '/403',
-      })
-    }
-  },
   validateSearch: groupsSearchSchema,
   component: Groups,
 })