@@ -1980,35 +1984,65 @@ export function ChannelMutateDrawer({
<FormItem>
<FormLabel>{t('Task plugin *')}</FormLabel>
{canBindTaskPlugin?(
<FormControl><Combobox
value={field.value}
onValueChange={(value)=>{
field.onChange(value)
constplugin=
taskPluginOptionsQuery.data?.find(
(item)=>item.key===value
<FormControl>
<Combobox
value={field.value}
onValueChange={(value)=>{
constoptions=
taskPluginOptionsQuery.data??[]
constpreviousPlugin=options.find(
(item)=>item.key===field.value
)
if(plugin?.models?.length){
form.setValue(
'models',
formatModelsArray(plugin.models),
{
shouldDirty:true,
}
field.onChange(value)
constplugin=options.find(
(item)=>item.key===value
)
}
}}
options={(
taskPluginOptionsQuery.data??[]
).map((plugin)=>({
value:plugin.key,
label:`${plugin.name} (${plugin.key})`,
}))}
className='w-full'
placeholder={t(
'Select task plugin'
)}
/></FormControl>
if(plugin?.models?.length){
form.setValue(
'models',
formatModelsArray(plugin.models),
{
shouldDirty:true,
}
)
}
constprefilledBaseUrl=
nextTaskPluginBaseUrl(
form.getValues('base_url'),
previousPlugin?.baseUrl,
plugin?.baseUrl
)
if(prefilledBaseUrl!==null){
form.setValue(
'base_url',
prefilledBaseUrl,
{
shouldDirty:true,
shouldValidate:true,
}
)
}
}}
options={(
taskPluginOptionsQuery.data??[]
).map((plugin)=>({
value:plugin.key,
label:`${plugin.name} (${plugin.key})`,
icon:(
<PluginIcon
plugin={{
...plugin,
hasIcon:plugin.hasIcon,
}}
size={16}
/>
),
}))}
className='w-full'
placeholder={t('Select task plugin')}
showSelectedIcon
/>
</FormControl>
):(
<FormControl>
<Input
...
...
@@ -2020,7 +2054,7 @@ placeholder={t(
)}
<FormDescription>
{t(
'Selecting a plugin fills its declared models.'
'Selecting a plugin fills its declared models and default base URL.'
)}
</FormDescription>
<FormMessage/>
...
...
@@ -2792,12 +2826,74 @@ placeholder={t(
{...field}
/>
</FormControl>
<FormDescription>
{t(
'Custom API base URL. For official channels, New API has built-in addresses. Only fill this for third-party proxy sites or special endpoints. Do not add /v1 or trailing slash.'
{currentType!==
CHANNEL_TYPE_TASK_PLUGIN&&(
<FormDescription>
{t(
'Custom API base URL. For official channels, New API has built-in addresses. Only fill this for third-party proxy sites or special endpoints. Do not add /v1 or trailing slash.'
)}
</FormDescription>
)}
{currentType===CHANNEL_TYPE_TASK_PLUGIN&&
!boundTaskPlugin?.baseUrl&&(
<FormDescription>
{t(
'The upstream address this plugin sends requests to. The plugin declares no default, so it must be filled in.'