2026-05-19 18:37:29 +08:00
|
|
|
export const DEFAULT_ALL_AGENT_RESOURCE_KINDS = Object.freeze([
|
|
|
|
|
'tools',
|
|
|
|
|
'knowledges',
|
|
|
|
|
'mcps',
|
|
|
|
|
'skills',
|
|
|
|
|
'subagents'
|
|
|
|
|
])
|
|
|
|
|
|
2026-05-21 19:33:00 +08:00
|
|
|
export const MENTION_AGENT_RESOURCE_KINDS = Object.freeze([
|
|
|
|
|
'knowledges',
|
|
|
|
|
'mcps',
|
|
|
|
|
'skills',
|
|
|
|
|
'subagents'
|
|
|
|
|
])
|
|
|
|
|
|
2026-05-19 18:37:29 +08:00
|
|
|
export const isDefaultAllAgentResourceKind = (kind) =>
|
|
|
|
|
DEFAULT_ALL_AGENT_RESOURCE_KINDS.includes(kind)
|
2026-05-21 19:33:00 +08:00
|
|
|
|
|
|
|
|
export const isMentionAgentResourceKind = (kind) => MENTION_AGENT_RESOURCE_KINDS.includes(kind)
|
|
|
|
|
|
|
|
|
|
export const getAgentConfigOptions = (item) => (Array.isArray(item?.options) ? item.options : [])
|
|
|
|
|
|
|
|
|
|
export const getAgentConfigOptionValue = (option) => {
|
|
|
|
|
if (typeof option !== 'object' || option === null) return option
|
2026-05-31 13:40:15 +08:00
|
|
|
return (
|
|
|
|
|
option.key ||
|
|
|
|
|
option.id ||
|
|
|
|
|
option.value ||
|
|
|
|
|
option.name ||
|
|
|
|
|
option.db_id ||
|
|
|
|
|
option.slug ||
|
|
|
|
|
option.label
|
|
|
|
|
)
|
2026-05-21 19:33:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const getAgentConfigOptionLabel = (option) => {
|
|
|
|
|
if (typeof option !== 'object' || option === null) return option
|
|
|
|
|
return option.name || option.label || getAgentConfigOptionValue(option)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const getAgentConfigOptionDescription = (option) =>
|
|
|
|
|
typeof option === 'object' && option !== null ? option.description || '' : ''
|