diff --git a/api/models/Agent.js b/api/models/Agent.js index 1cd6ba3ed940..c88c0f80c53d 100644 --- a/api/models/Agent.js +++ b/api/models/Agent.js @@ -627,6 +627,7 @@ const getListAgentsByAccess = async ({ author: 1, projectIds: 1, description: 1, + short_description: 1, updatedAt: 1, category: 1, support_contact: 1, @@ -697,6 +698,7 @@ const getListAgents = async (searchParameter) => { author: 1, projectIds: 1, description: 1, + short_description: 1, // @deprecated - isCollaborative replaced by ACL permissions isCollaborative: 1, category: 1, diff --git a/client/src/common/selector.ts b/client/src/common/selector.ts index af69ca4af506..97174a69cc22 100644 --- a/client/src/common/selector.ts +++ b/client/src/common/selector.ts @@ -8,6 +8,7 @@ export interface Endpoint { models?: Array<{ name: string; isGlobal?: boolean }>; icon: React.ReactNode; agentNames?: Record; + agentDescriptions?: Record; assistantNames?: Record; modelIcons?: Record; } diff --git a/client/src/components/Chat/Menus/Endpoints/components/EndpointModelItem.tsx b/client/src/components/Chat/Menus/Endpoints/components/EndpointModelItem.tsx index eeefdba59860..e7ecf9e02dc5 100644 --- a/client/src/components/Chat/Menus/Endpoints/components/EndpointModelItem.tsx +++ b/client/src/components/Chat/Menus/Endpoints/components/EndpointModelItem.tsx @@ -15,11 +15,13 @@ export function EndpointModelItem({ modelId, endpoint, isSelected }: EndpointMod const { handleSelectModel } = useModelSelectorContext(); let isGlobal = false; let modelName = modelId; + let modelDescription = ''; const avatarUrl = endpoint?.modelIcons?.[modelId ?? ''] || null; // Use custom names if available if (endpoint && modelId && isAgentsEndpoint(endpoint.value) && endpoint.agentNames?.[modelId]) { modelName = endpoint.agentNames[modelId]; + modelDescription = endpoint.agentDescriptions?.[modelId] || ''; const modelInfo = endpoint?.models?.find((m) => m.name === modelId); isGlobal = modelInfo?.isGlobal ?? false; @@ -39,17 +41,26 @@ export function EndpointModelItem({ modelId, endpoint, isSelected }: EndpointMod className="flex w-full cursor-pointer items-center justify-between rounded-lg px-2 text-sm" >
- {avatarUrl ? ( + {avatarUrl && (
{modelName
- ) : (isAgentsEndpoint(endpoint.value) || isAssistantsEndpoint(endpoint.value)) && - endpoint.icon ? ( -
- {endpoint.icon} -
- ) : null} - {modelName} + )} + {!avatarUrl && + (isAgentsEndpoint(endpoint.value) || isAssistantsEndpoint(endpoint.value)) && + endpoint.icon && ( +
+ {endpoint.icon} +
+ )} +
+ {modelName} + {modelDescription && ( + + {modelDescription} + + )} +
{isGlobal && ( )} diff --git a/client/src/components/Chat/Menus/Endpoints/components/SearchResults.tsx b/client/src/components/Chat/Menus/Endpoints/components/SearchResults.tsx index ffefbc44d42e..4c7647a247d7 100644 --- a/client/src/components/Chat/Menus/Endpoints/components/SearchResults.tsx +++ b/client/src/components/Chat/Menus/Endpoints/components/SearchResults.tsx @@ -138,12 +138,14 @@ export function SearchResults({ results, localize, searchValue }: SearchResultsP let isGlobal = false; let modelName = modelId; + let modelDescription = ''; if ( isAgentsEndpoint(endpoint.value) && endpoint.agentNames && endpoint.agentNames[modelId] ) { modelName = endpoint.agentNames[modelId]; + modelDescription = endpoint.agentDescriptions?.[modelId] || ''; const modelInfo = endpoint?.models?.find((m) => m.name === modelId); isGlobal = modelInfo?.isGlobal ?? false; } else if ( @@ -160,9 +162,9 @@ export function SearchResults({ results, localize, searchValue }: SearchResultsP onClick={() => handleSelectModel(endpoint, modelId)} className="flex w-full cursor-pointer items-center justify-start rounded-lg px-3 py-2 pl-6 text-sm" > -
+
{endpoint.modelIcons?.[modelId] && ( -
+
{modelName}
)} - {modelName} +
+ {modelName} + {modelDescription && ( + + {modelDescription} + + )} +
- {isGlobal && } + {isGlobal && ( + + )} {selectedEndpoint === endpoint.value && selectedModel === modelId && ( { + acc[agent.id] = agent.short_description || agent.description || ''; + return acc; + }, {}); result.modelIcons = agents?.reduce((acc, agent) => { acc[agent.id] = agent?.avatar?.filepath; return acc; diff --git a/packages/api/src/agents/validation.ts b/packages/api/src/agents/validation.ts index 4798ffeb80ae..9662168dc14c 100644 --- a/packages/api/src/agents/validation.ts +++ b/packages/api/src/agents/validation.ts @@ -55,6 +55,7 @@ export const graphEdgeSchema = z.object({ export const agentBaseSchema = z.object({ name: z.string().nullable().optional(), description: z.string().nullable().optional(), + short_description: z.string().max(50).nullable().optional(), instructions: z.string().nullable().optional(), avatar: agentAvatarSchema.nullable().optional(), model_parameters: z.record(z.unknown()).optional(), diff --git a/packages/data-provider/src/types/assistants.ts b/packages/data-provider/src/types/assistants.ts index cc1ef4a5289d..5df556c67dc2 100644 --- a/packages/data-provider/src/types/assistants.ts +++ b/packages/data-provider/src/types/assistants.ts @@ -214,6 +214,7 @@ export type Agent = { endpoint?: string | null; authorName?: string | null; description: string | null; + short_description?: string | null; created_at: number; avatar: AgentAvatar | null; instructions: string | null; diff --git a/packages/data-schemas/src/schema/agent.ts b/packages/data-schemas/src/schema/agent.ts index 716c105000e1..5637c3110f77 100644 --- a/packages/data-schemas/src/schema/agent.ts +++ b/packages/data-schemas/src/schema/agent.ts @@ -15,6 +15,9 @@ const agentSchema = new Schema( description: { type: String, }, + short_description: { + type: String, + }, instructions: { type: String, }, diff --git a/packages/data-schemas/src/types/agent.ts b/packages/data-schemas/src/types/agent.ts index 2a6063575109..7b324367523f 100644 --- a/packages/data-schemas/src/types/agent.ts +++ b/packages/data-schemas/src/types/agent.ts @@ -10,6 +10,7 @@ export interface IAgent extends Omit { id: string; name?: string; description?: string; + short_description?: string; instructions?: string; avatar?: { filepath: string;