-
Notifications
You must be signed in to change notification settings - Fork 11.3k
修复:模型定价中无法删除模型、同步渠道弹窗中无法选中渠道、控制台日志中的翻译错误 #5493
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 |
|---|---|---|
|
|
@@ -16,12 +16,14 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. | |
|
|
||
| For commercial licensing, please contact support@quantumnous.com | ||
| */ | ||
| import { useState } from 'react' | ||
| import { type ColumnDef } from '@tanstack/react-table' | ||
| import { Pencil, Trash2 } from 'lucide-react' | ||
| import { Button } from '@/components/ui/button' | ||
| import { Checkbox } from '@/components/ui/checkbox' | ||
| import { DataTableColumnHeader } from '@/components/data-table' | ||
| import { StatusBadge } from '@/components/status-badge' | ||
| import { ConfirmDialog } from '@/components/confirm-dialog' | ||
| import { | ||
| getModeLabel, | ||
| getModeVariant, | ||
|
|
@@ -38,10 +40,54 @@ const filterBySelectedValues = ( | |
| return filterValue.includes(String(rowValue)) | ||
| } | ||
|
|
||
| type Translate = (key: string, options?: Record<string, unknown>) => string | ||
|
|
||
| type BuildModelRatioColumnsOptions = { | ||
| onDelete: (name: string) => void | ||
| onEdit: (model: ModelRow) => void | ||
| t: (key: string) => string | ||
| t: Translate | ||
| } | ||
|
|
||
| function DeleteButton({ | ||
| modelName, | ||
| onDelete, | ||
| t, | ||
| }: { | ||
| modelName: string | ||
| onDelete: (name: string) => void | ||
| t: Translate | ||
| }) { | ||
| const [confirmOpen, setConfirmOpen] = useState(false) | ||
|
|
||
| return ( | ||
| <> | ||
| <Button | ||
| variant='ghost' | ||
| size='sm' | ||
| onClick={(e) => { | ||
| e.stopPropagation() | ||
| setConfirmOpen(true) | ||
| }} | ||
| > | ||
| <Trash2 /> | ||
| </Button> | ||
|
Comment on lines
+64
to
+73
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. Add accessible names to icon-only action buttons. At Line 64 and Line 194, the icon-only delete/edit buttons have no accessible name. Add Proposed fix <Button
variant='ghost'
size='sm'
+ aria-label={t('Delete model pricing')}
onClick={(e) => {
e.stopPropagation()
setConfirmOpen(true)
}}
>
<Trash2 />
</Button>
@@
<Button
variant='ghost'
size='sm'
+ aria-label={t('Edit model pricing')}
onClick={(e) => {
e.stopPropagation()
onEdit(row.original)
}}
>
<Pencil />
</Button>As per coding guidelines: “Ensure keyboard operability and logical focus order; use ARIA attributes when necessary ( Also applies to: 194-203 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| <ConfirmDialog | ||
| open={confirmOpen} | ||
| onOpenChange={setConfirmOpen} | ||
| title={t('Delete model pricing')} | ||
| desc={t( | ||
| 'Are you sure you want to delete pricing for "{{name}}"? This action cannot be undone.', | ||
| { name: modelName } | ||
| )} | ||
| confirmText={t('Delete')} | ||
| destructive | ||
| handleConfirm={() => { | ||
| onDelete(modelName) | ||
| setConfirmOpen(false) | ||
| }} | ||
|
Comment on lines
+84
to
+87
|
||
| /> | ||
| </> | ||
| ) | ||
| } | ||
|
|
||
| export function buildModelRatioColumns({ | ||
|
|
@@ -148,17 +194,18 @@ export function buildModelRatioColumns({ | |
| <Button | ||
| variant='ghost' | ||
| size='sm' | ||
| onClick={() => onEdit(row.original)} | ||
| onClick={(e) => { | ||
| e.stopPropagation() | ||
| onEdit(row.original) | ||
| }} | ||
| > | ||
| <Pencil /> | ||
| </Button> | ||
| <Button | ||
| variant='ghost' | ||
| size='sm' | ||
| onClick={() => onDelete(row.original.name)} | ||
| > | ||
| <Trash2 /> | ||
| </Button> | ||
| <DeleteButton | ||
| modelName={row.original.name} | ||
| onDelete={onDelete} | ||
| t={t} | ||
| /> | ||
| </div> | ||
| ), | ||
| enableHiding: false, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -392,6 +392,7 @@ | |||||
| "Are you sure you want to delete {{count}} model(s)? This action cannot be undone.": "Вы уверены, что хотите удалить {{count}} модел(ей)? Это действие нельзя отменить.", | ||||||
| "Are you sure you want to delete all auto-disabled keys? This action cannot be undone.": "Вы уверены, что хотите удалить все автоматически отключённые ключи? Это действие нельзя отменить.", | ||||||
| "Are you sure you want to delete deployment \"{{name}}\"? This action cannot be undone.": "Вы уверены, что хотите удалить развертывание \"{{name}}\"? Это действие нельзя отменить.", | ||||||
| "Are you sure you want to delete pricing for \"{{name}}\"? This action cannot be undone.": "Вы уверены, что хотите удалить цену для \"{{name}}\"? Это действие нельзя отменить.", | ||||||
| "Are you sure you want to delete this key? This action cannot be undone.": "Вы уверены, что хотите удалить этот ключ? Это действие нельзя отменить.", | ||||||
| "Are you sure you want to disable all enabled keys?": "Вы уверены, что хотите отключить все включённые ключи?", | ||||||
| "Are you sure you want to enable all keys?": "Вы уверены, что хотите включить все ключи?", | ||||||
|
|
@@ -1160,6 +1161,7 @@ | |||||
| "Delete logs": "Удалить логи", | ||||||
| "Delete mapping": "Удалить сопоставление", | ||||||
| "Delete Model": "Удалить модель", | ||||||
| "Delete model pricing": "Удалить цену модели", | ||||||
|
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. Use the same Russian pricing term here.
💡 Suggested wording- "Delete model pricing": "Удалить цену модели",
+ "Delete model pricing": "Удалить тариф модели",📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| "Delete Models?": "Удалить модели?", | ||||||
| "Delete Provider": "Удалить провайдер", | ||||||
| "Delete Request Header": "Удалить заголовок запроса", | ||||||
|
|
||||||
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.
经过多次排查,这里的缓存会导致同步渠道中的复选框无法被选中,底层数据已经选中但是UI不会得到更新,尝试通过添加更新的逻辑条件,会导致更新选中状态时页面闪烁。