diff --git a/frontend/providers/aiproxy/app/[lng]/(user)/layout.tsx b/frontend/providers/aiproxy/app/[lng]/(user)/layout.tsx index 1de240c7627..11fcb755d05 100644 --- a/frontend/providers/aiproxy/app/[lng]/(user)/layout.tsx +++ b/frontend/providers/aiproxy/app/[lng]/(user)/layout.tsx @@ -22,7 +22,7 @@ export default function UserLayout({ children }: { children: React.ReactNode }) const handleI18nChange = useCallback( (data: { currentLanguage: string }) => { - const currentLng = i18n.resolvedLanguage // 这里会获取最新的 resolvedLanguage + const currentLng = i18n.resolvedLanguage // get the latest resolvedLanguage const newLng = data.currentLanguage if (currentLng !== newLng) { diff --git a/frontend/providers/aiproxy/app/[lng]/globals.css b/frontend/providers/aiproxy/app/[lng]/globals.css index 0c6c75c67c5..e6e10f493dd 100644 --- a/frontend/providers/aiproxy/app/[lng]/globals.css +++ b/frontend/providers/aiproxy/app/[lng]/globals.css @@ -152,11 +152,11 @@ div.rdp { --rdp-cell-size: 40px; --rdp-accent-color: black; --rdp-background-color: #f4f6f8; - /* 深色主题颜色 */ + /* black theme color */ --rdp-accent-color-dark: #3003e1; --rdp-background-color-dark: #180270; - /* 聚焦元素的轮廓边框 */ + /* focus element outline border */ --rdp-outline: 2px solid var(--rdp-accent-color); - /* 聚焦且选中元素的轮廓边框 */ + /* focus and selected element outline border */ --rdp-outline-selected: 2px solid rgba(0, 0, 0, 0.75); } diff --git a/frontend/providers/aiproxy/components/user/KeyList.tsx b/frontend/providers/aiproxy/components/user/KeyList.tsx index b082d643805..5c5787113ce 100644 --- a/frontend/providers/aiproxy/components/user/KeyList.tsx +++ b/frontend/providers/aiproxy/components/user/KeyList.tsx @@ -16,7 +16,6 @@ import { Th, Thead, Tr, - Tooltip, Modal, ModalOverlay, ModalContent, diff --git a/frontend/providers/aiproxy/components/user/ModelList.tsx b/frontend/providers/aiproxy/components/user/ModelList.tsx index ac833669c8f..e58eca70739 100644 --- a/frontend/providers/aiproxy/components/user/ModelList.tsx +++ b/frontend/providers/aiproxy/components/user/ModelList.tsx @@ -26,13 +26,13 @@ const getIdentifier = (modelName: string): ModelIdentifier => { } const sortModels = (models: string[]): string[] => { - // 使用 Map 进行分组 + // group by identifier const groupMap = new Map() - // 分组 + // group by identifier models.forEach((model) => { const identifier = getIdentifier(model) - // 特殊处理 gpt 和 o1,将它们归为同一组 'openai' + // special handle gpt and o1, group them as 'openai' const groupKey = identifier === 'gpt' || identifier === 'o' ? 'openai' : identifier if (!groupMap.has(groupKey)) { groupMap.set(groupKey, []) @@ -40,15 +40,13 @@ const sortModels = (models: string[]): string[] => { groupMap.get(groupKey)?.push(model) }) - // 按照 identifier 排序并扁平化结果 + // sort by identifier and flatten the result return Array.from(groupMap.entries()) - .sort((a, b) => a[0].localeCompare(b[0])) // 按 identifier 排序 - .flatMap(([_, models]) => models.sort()) // 扁平化并保持每组内的排序 + .sort((a, b) => a[0].localeCompare(b[0])) // sort by identifier + .flatMap(([_, models]) => models.sort()) // flatten and keep the order in each group } -// 模型组件 const ModelComponent = ({ modelName }: { modelName: string }) => { - // 图标映射和标识符关系 const modelGroups = { openai: { icon: OpenAIIcon, @@ -88,7 +86,7 @@ const ModelComponent = ({ modelName }: { modelName: string }) => { } } - // 获取模型图标 + // get model icon const getModelIcon = (modelName: string): StaticImageData => { const identifier = getIdentifier(modelName) const group = Object.values(modelGroups).find((group) => group.identifiers.includes(identifier)) @@ -150,7 +148,6 @@ const ModelComponent = ({ modelName }: { modelName: string }) => { ) } -// 模型列表组件 const ModelList: React.FC = () => { const { lng } = useI18n() const { t } = useTranslationClientSide(lng, 'common') diff --git a/frontend/providers/aiproxy/middleware.ts b/frontend/providers/aiproxy/middleware.ts index 940f7536c77..97bae24a108 100644 --- a/frontend/providers/aiproxy/middleware.ts +++ b/frontend/providers/aiproxy/middleware.ts @@ -32,15 +32,15 @@ export function middleware(req: NextRequest): NextResponse { return NextResponse.next() } - // 从路径中获取语言设置 + // get language from pathname let lng = req.nextUrl.pathname.split('/')[1] - // 如果路径中没有有效的语言代码,则使用默认语言 + // if pathname does not contain valid language code, use fallback language if (!languages.includes(lng)) { lng = fallbackLng } - // 处理根路径和语言路径的重定向 + // handle root path and language path redirect if ( req.nextUrl.pathname === '/' || languages.some((lang) => req.nextUrl.pathname === `/${lang}`) @@ -49,7 +49,7 @@ export function middleware(req: NextRequest): NextResponse { return NextResponse.redirect(newUrl) } - // 处理其他需要添加语言前缀的路径 + // handle other paths that need to add language prefix if (!languages.some((loc) => req.nextUrl.pathname.startsWith(`/${loc}`))) { const newUrl = new URL(`/${lng}${req.nextUrl.pathname}${req.nextUrl.search}`, req.url) return NextResponse.redirect(newUrl)