Repository navigation
feat(channel): 使用表单配置获取上游模型 #5947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,8 +21,10 @@ import { | |
| type Header, | ||
| type Table as TanstackTable, | ||
| } from '@tanstack/react-table' | ||
| import { useTranslation } from 'react-i18next' | ||
|
|
||
| import { TableHead, TableHeader, TableRow } from '@/components/ui/table' | ||
| import { cn } from '@/lib/utils' | ||
|
|
||
| import { DataTableColumnHeader } from './column-header' | ||
| import { isContentSizedColumn } from './content-sized-columns' | ||
|
|
@@ -43,6 +45,8 @@ export function DataTableHeader<TData>({ | |
| rowClassName, | ||
| getColumnClassName, | ||
| }: DataTableHeaderProps<TData>) { | ||
| const { t } = useTranslation() | ||
|
|
||
| return ( | ||
| <TableHeader className={className}> | ||
| {table.getHeaderGroups().map((headerGroup) => ( | ||
|
|
@@ -51,10 +55,28 @@ export function DataTableHeader<TData>({ | |
| <TableHead | ||
| key={header.id} | ||
| colSpan={header.colSpan} | ||
| className={getColumnClassName?.(header.column.id, 'header')} | ||
| className={cn( | ||
| 'relative', | ||
| getColumnClassName?.(header.column.id, 'header') | ||
| )} | ||
| style={getHeaderSizeStyle(header, applyHeaderSize)} | ||
| > | ||
| {renderHeaderContent(header)} | ||
| {shouldRenderColumnResizer(table, header) && ( | ||
| <div | ||
| role='separator' | ||
| aria-orientation='vertical' | ||
| aria-label={t('Resize column')} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
fd -e json . web/default/src/i18n/locales --exec rg -l '"Resize column"' {}Repository: QuantumNous/new-api Length of output: 157 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n== locale files ==\n'
fd -a -t f '.*\.json$' web/default/src/i18n/locales
printf '\n== search for Resize column (case-sensitive) ==\n'
rg -n '"Resize column"|Resize column' web/default/src/i18n/locales || true
printf '\n== inspect i18n config ==\n'
fd -a -t f 'i18n' web/default/src | sed -n '1,20p'
rg -n "fallbackLng|lng|keySeparator|nsSeparator|returnNull|returnEmptyString|fallbackNS" web/default/src/i18n web/default/src --glob '!**/*.map' || trueRepository: QuantumNous/new-api Length of output: 1000 Add 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| onDoubleClick={() => header.column.resetSize()} | ||
| onMouseDown={header.getResizeHandler()} | ||
| onTouchStart={header.getResizeHandler()} | ||
| className={cn( | ||
| 'absolute top-0 right-0 h-full w-2 cursor-col-resize touch-none select-none', | ||
| 'after:bg-border hover:after:bg-primary after:absolute after:top-2 after:right-0 after:h-[calc(100%-1rem)] after:w-px after:transition-colors', | ||
| header.column.getIsResizing() && 'after:bg-primary' | ||
| )} | ||
| /> | ||
| )} | ||
|
Comment on lines
+58
to
+79
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Resize handle is mouse/touch-only; no keyboard support. The resizer As per coding guidelines, Consider adding Also applies to: 88-99 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| </TableHead> | ||
| ))} | ||
| </TableRow> | ||
|
|
@@ -63,6 +85,18 @@ export function DataTableHeader<TData>({ | |
| ) | ||
| } | ||
|
|
||
| function shouldRenderColumnResizer<TData>( | ||
| table: TanstackTable<TData>, | ||
| header: Header<TData, unknown> | ||
| ) { | ||
| return ( | ||
| table.options.enableColumnResizing === true && | ||
| !header.isPlaceholder && | ||
| header.column.getCanResize() && | ||
| !isContentSizedColumn(header.column.id) | ||
| ) | ||
| } | ||
|
|
||
| function getHeaderSizeStyle<TData>( | ||
| header: Header<TData, unknown>, | ||
| applyHeaderSize: boolean | undefined | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: QuantumNous/new-api
Length of output: 7220
🏁 Script executed:
Repository: QuantumNous/new-api
Length of output: 35307
🏁 Script executed:
Repository: QuantumNous/new-api
Length of output: 39500
Populate
ChannelInfofor this form-based fetch path.GetNextEnabledKey()ignoresStatus, but it does requireChannelInfo.IsMultiKey; with the current rawShouldBindJSONpayload, pasted multi-line API keys stay unsplit and are treated as one key.🤖 Prompt for AI Agents