Commit 15cfdedd by Shawn Wang Committed by GitHub

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
parent 58d4e9bd
...@@ -53,17 +53,27 @@ function normalizeModelNameList(models: readonly string[]): string[] { ...@@ -53,17 +53,27 @@ function normalizeModelNameList(models: readonly string[]): string[] {
return [...new Set(models.map((m) => normalizeModelName(m)).filter(Boolean))] return [...new Set(models.map((m) => normalizeModelName(m)).filter(Boolean))]
} }
type FetchModelsDialogProps = { type FetchModelsDialogBaseProps = {
open: boolean open: boolean
onOpenChange: (open: boolean) => void onOpenChange: (open: boolean) => void
onModelsSelected?: (models: string[]) => void
redirectModels?: string[] redirectModels?: string[]
redirectSourceModels?: string[] redirectSourceModels?: string[]
customFetcher?: () => Promise<string[]> customFetcher?: () => Promise<string[]>
existingModelsOverride?: string[]
channelName?: string | null channelName?: string | null
} }
type FetchModelsDialogProps = FetchModelsDialogBaseProps &
(
| {
onModelsSelected: (models: string[]) => void
existingModelsOverride: string[]
}
| {
onModelsSelected?: undefined
existingModelsOverride?: undefined
}
)
export function FetchModelsDialog({ export function FetchModelsDialog({
open, open,
onOpenChange, onOpenChange,
......
...@@ -4824,11 +4824,7 @@ export function ChannelMutateDrawer({ ...@@ -4824,11 +4824,7 @@ export function ChannelMutateDrawer({
channelName={ channelName={
shouldPreviewUnsavedModels ? currentName?.trim() : undefined shouldPreviewUnsavedModels ? currentName?.trim() : undefined
} }
existingModelsOverride={ existingModelsOverride={currentModelsArray}
shouldPreviewUnsavedModels
? parseModelsString(form.getValues('models') || '')
: undefined
}
/> />
<SecureVerificationDialog <SecureVerificationDialog
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment