diff --git a/packages/@n8n/api-types/src/chat-hub.ts b/packages/@n8n/api-types/src/chat-hub.ts index 246912c8662..13af4c67af3 100644 --- a/packages/@n8n/api-types/src/chat-hub.ts +++ b/packages/@n8n/api-types/src/chat-hub.ts @@ -85,6 +85,8 @@ export interface ChatModelDto { model: ChatHubConversationModel; name: string; description: string | null; + updatedAt: string | null; + createdAt: string | null; } /** diff --git a/packages/cli/src/modules/chat-hub/chat-hub-agent.service.ts b/packages/cli/src/modules/chat-hub/chat-hub-agent.service.ts index 96a5fdeb984..ec9be402204 100644 --- a/packages/cli/src/modules/chat-hub/chat-hub-agent.service.ts +++ b/packages/cli/src/modules/chat-hub/chat-hub-agent.service.ts @@ -29,6 +29,8 @@ export class ChatHubAgentService { provider: 'custom-agent', agentId: agent.id, }, + createdAt: agent.createdAt.toISOString(), + updatedAt: agent.updatedAt.toISOString(), })), }; } diff --git a/packages/cli/src/modules/chat-hub/chat-hub.service.ts b/packages/cli/src/modules/chat-hub/chat-hub.service.ts index 2eaef4a2cfb..9a5cf2d7195 100644 --- a/packages/cli/src/modules/chat-hub/chat-hub.service.ts +++ b/packages/cli/src/modules/chat-hub/chat-hub.service.ts @@ -192,12 +192,14 @@ export class ChatHubService { return { models: resourceLocatorResults.results.map((result) => ({ - name: String(result.value), - description: null, + name: result.name, + description: result.description ?? null, model: { provider: 'openai', model: String(result.value), }, + createdAt: null, + updatedAt: null, })), }; } @@ -217,12 +219,14 @@ export class ChatHubService { return { models: resourceLocatorResults.results.map((result) => ({ - name: String(result.value), - description: null, + name: result.name, + description: result.description ?? null, model: { provider: 'anthropic', model: String(result.value), }, + createdAt: null, + updatedAt: null, })), }; } @@ -281,11 +285,13 @@ export class ChatHubService { return { models: results.map((result) => ({ name: String(result.value), - description: null, + description: result.description ?? null, model: { provider: 'google', model: String(result.value), }, + createdAt: null, + updatedAt: null, })), }; } @@ -331,6 +337,8 @@ export class ChatHubService { provider: 'n8n', workflowId: workflow.id, }, + createdAt: workflow.createdAt ? workflow.createdAt.toISOString() : null, + updatedAt: workflow.updatedAt ? workflow.updatedAt.toISOString() : null, }, ]; }), diff --git a/packages/frontend/editor-ui/src/features/ai/chatHub/ChatAgentsView.vue b/packages/frontend/editor-ui/src/features/ai/chatHub/ChatAgentsView.vue index c12c70877d3..9648371bc98 100644 --- a/packages/frontend/editor-ui/src/features/ai/chatHub/ChatAgentsView.vue +++ b/packages/frontend/editor-ui/src/features/ai/chatHub/ChatAgentsView.vue @@ -12,9 +12,8 @@ import { N8nSelect, N8nText, } from '@n8n/design-system'; -import { computed, onMounted, ref, watch } from 'vue'; +import { computed, ref, watch } from 'vue'; import { useUIStore } from '@/stores/ui.store'; -import { useWorkflowsStore } from '@/stores/workflows.store'; import AgentEditorModal from '@/features/ai/chatHub/components/AgentEditorModal.vue'; import ChatAgentCard from '@/features/ai/chatHub/components/ChatAgentCard.vue'; import { useChatCredentials } from '@/features/ai/chatHub/composables/useChatCredentials'; @@ -28,7 +27,6 @@ import { MOBILE_MEDIA_QUERY } from '@/features/ai/chatHub/constants'; const chatStore = useChatStore(); const uiStore = useUIStore(); -const workflowsStore = useWorkflowsStore(); const toast = useToast(); const message = useMessage(); const usersStore = useUsersStore(); @@ -45,19 +43,12 @@ const agentFilter = ref({ const { credentialsByProvider } = useChatCredentials(usersStore.currentUserId ?? 'anonymous'); -const readyToShowList = computed(() => chatStore.customAgentsReady && chatStore.agentsReady); +const readyToShowList = computed(() => chatStore.agentsReady); const allModels = computed(() => chatStore.agents.n8n.models.concat(chatStore.agents['custom-agent'].models), ); -const agents = computed(() => { - return filterAndSortAgents( - allModels.value, - agentFilter.value, - chatStore.customAgents, - workflowsStore.workflowsById, // TODO: ensure workflows are fetched - ); -}); +const agents = computed(() => filterAndSortAgents(allModels.value, agentFilter.value)); const providerOptions = [ { label: 'All', value: '' }, @@ -95,7 +86,6 @@ function handleCloseAgentEditor() { } async function handleAgentCreatedOrUpdated() { - await chatStore.fetchCustomAgents(); editingAgentId.value = undefined; } @@ -130,10 +120,6 @@ watch( }, { immediate: true }, ); - -onMounted(() => { - void chatStore.fetchCustomAgents(); -});