mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 01:18:05 +08:00
feat: model-selector in Agent node (case: installed models)
This commit is contained in:
@ -44,7 +44,7 @@ const Card = ({
|
||||
const locale = localeFromProps ? getLanguage(localeFromProps) : defaultLocale
|
||||
const { categoriesMap } = useCategories()
|
||||
const { category, type, name, org, label, brief, icon, verified } = payload
|
||||
const isBundle = !['plugin', 'model', 'tool', 'extension', 'agent-strategy'].includes(type)
|
||||
const isBundle = !['plugin', 'model', 'tool', 'extension', 'agent_strategy'].includes(type)
|
||||
const cornerMark = isBundle ? categoriesMap.bundle?.label : categoriesMap[category]?.label
|
||||
const getLocalizedText = (obj: Record<string, string> | undefined) =>
|
||||
obj?.[locale] || obj?.['en-US'] || obj?.en_US || ''
|
||||
|
||||
@ -44,7 +44,7 @@ export const useCategories = (translateFromOut?: TFunction) => {
|
||||
const categories = categoryKeys.map((category) => {
|
||||
if (category === 'agent') {
|
||||
return {
|
||||
name: 'agent-strategy',
|
||||
name: 'agent_strategy',
|
||||
label: t(`plugin.category.${category}s`),
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ export const getMarketplaceListCondition = (pluginType: string) => {
|
||||
return 'category=tool'
|
||||
|
||||
if (pluginType === PluginType.agent)
|
||||
return 'category=agent-strategy'
|
||||
return 'category=agent_strategy'
|
||||
|
||||
if (pluginType === PluginType.model)
|
||||
return 'category=model'
|
||||
|
||||
@ -13,6 +13,7 @@ import ModelSelector from '@/app/components/header/account-setting/model-provide
|
||||
import {
|
||||
useModelList,
|
||||
} from '@/app/components/header/account-setting/model-provider-page/hooks'
|
||||
import AgentModelTrigger from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal/agent-model-trigger'
|
||||
import Trigger from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal/trigger'
|
||||
import type { TriggerProps } from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal/trigger'
|
||||
import {
|
||||
@ -34,6 +35,7 @@ export type ModelParameterModalProps = {
|
||||
renderTrigger?: (v: TriggerProps) => ReactNode
|
||||
readonly?: boolean
|
||||
isInWorkflow?: boolean
|
||||
isAgentStrategy?: boolean
|
||||
scope?: string
|
||||
}
|
||||
|
||||
@ -46,6 +48,7 @@ const ModelParameterModal: FC<ModelParameterModalProps> = ({
|
||||
renderTrigger,
|
||||
readonly,
|
||||
isInWorkflow,
|
||||
isAgentStrategy,
|
||||
scope = ModelTypeEnum.textGeneration,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
@ -168,8 +171,16 @@ const ModelParameterModal: FC<ModelParameterModalProps> = ({
|
||||
providerName: value?.provider,
|
||||
modelId: value?.model,
|
||||
})
|
||||
: (
|
||||
<Trigger
|
||||
: (isAgentStrategy
|
||||
? <AgentModelTrigger
|
||||
disabled={disabled}
|
||||
hasDeprecated={hasDeprecated}
|
||||
currentProvider={currentProvider}
|
||||
currentModel={currentModel}
|
||||
providerName={value?.provider}
|
||||
modelId={value?.model}
|
||||
/>
|
||||
: <Trigger
|
||||
disabled={disabled}
|
||||
isInWorkflow={isInWorkflow}
|
||||
modelDisabled={modelDisabled}
|
||||
|
||||
@ -6,7 +6,7 @@ export enum PluginType {
|
||||
tool = 'tool',
|
||||
model = 'model',
|
||||
extension = 'extension',
|
||||
agent = 'agent-strategy',
|
||||
agent = 'agent_strategy',
|
||||
}
|
||||
|
||||
export enum PluginSource {
|
||||
@ -109,7 +109,7 @@ export type PluginDetail = {
|
||||
}
|
||||
|
||||
export type Plugin = {
|
||||
type: 'plugin' | 'bundle' | 'model' | 'extension' | 'tool'
|
||||
type: 'plugin' | 'bundle' | 'model' | 'extension' | 'tool' | 'agent_strategy'
|
||||
org: string
|
||||
author?: string
|
||||
name: string
|
||||
|
||||
Reference in New Issue
Block a user