2
0
mirror of https://github.com/QuantumNous/new-api.git synced 2026-08-31 02:41:34 +00:00

fix(web): keep fetched model selection in sync with form (#6841)

* fix(web): keep fetched model selection in sync with form

* refactor(web): reuse parsed channel models
This commit is contained in:
Shawn Wang 2026-08-14 16:40:34 +08:00 committed by GitHub
parent 58d4e9bd3b
commit 15cfdeddef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 8 deletions

View File

@ -53,17 +53,27 @@ function normalizeModelNameList(models: readonly string[]): string[] {
return [...new Set(models.map((m) => normalizeModelName(m)).filter(Boolean))]
}
type FetchModelsDialogProps = {
type FetchModelsDialogBaseProps = {
open: boolean
onOpenChange: (open: boolean) => void
onModelsSelected?: (models: string[]) => void
redirectModels?: string[]
redirectSourceModels?: string[]
customFetcher?: () => Promise<string[]>
existingModelsOverride?: string[]
channelName?: string | null
}
type FetchModelsDialogProps = FetchModelsDialogBaseProps &
(
| {
onModelsSelected: (models: string[]) => void
existingModelsOverride: string[]
}
| {
onModelsSelected?: undefined
existingModelsOverride?: undefined
}
)
export function FetchModelsDialog({
open,
onOpenChange,

View File

@ -4824,11 +4824,7 @@ export function ChannelMutateDrawer({
channelName={
shouldPreviewUnsavedModels ? currentName?.trim() : undefined
}
existingModelsOverride={
shouldPreviewUnsavedModels
? parseModelsString(form.getValues('models') || '')
: undefined
}
existingModelsOverride={currentModelsArray}
/>
<SecureVerificationDialog