@swiss-ai-hub/web 0.290.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.md +479 -0
- package/app.config.ts +1 -0
- package/app.vue +52 -0
- package/assets/css/main.css +4 -0
- package/assets/images/logo.png +0 -0
- package/components/Agent/Avatar.vue +40 -0
- package/components/Agent/Card.vue +139 -0
- package/components/Agent/Configuration.vue +20 -0
- package/components/Agent/CreateModal.vue +287 -0
- package/components/Agent/EmptyCard.vue +35 -0
- package/components/Agent/List.vue +85 -0
- package/components/Agent/TemplateCard.vue +58 -0
- package/components/AppLoader.vue +55 -0
- package/components/Chat/Message.vue +90 -0
- package/components/Chat/SourceNodes.vue +120 -0
- package/components/Chat/Thread.vue +134 -0
- package/components/Costs/Table.vue +56 -0
- package/components/Dashboard/Component/BarChart.vue +46 -0
- package/components/Dashboard/Component/LineChart.vue +138 -0
- package/components/Dashboard/Component/Number.vue +31 -0
- package/components/Dashboard/Grid.vue +214 -0
- package/components/Dashboard/Item.vue +75 -0
- package/components/Dashboard/Trend.vue +34 -0
- package/components/Display/List/DisplayList.vue +93 -0
- package/components/Evaluation/Dataset/Card.vue +70 -0
- package/components/Evaluation/Dataset/Create.vue +81 -0
- package/components/Evaluation/Dataset/Edit.vue +132 -0
- package/components/Event/Display/AddMemoryToChatHistoryEvent.vue +60 -0
- package/components/Event/Display/AgentInTheLoopRequestEvent.vue +56 -0
- package/components/Event/Display/AgentInTheLoopResponseEvent.vue +17 -0
- package/components/Event/Display/Base.vue +125 -0
- package/components/Event/Display/BaseRetrieveMemoryEvent.vue +101 -0
- package/components/Event/Display/BaseStoreMemoryEvent.vue +182 -0
- package/components/Event/Display/ChunkEvent.vue +40 -0
- package/components/Event/Display/EmbeddingEvent.vue +25 -0
- package/components/Event/Display/ExceptionEvent.vue +21 -0
- package/components/Event/Display/GuardAcceptEvent.vue +25 -0
- package/components/Event/Display/GuardEvent.vue +17 -0
- package/components/Event/Display/GuardRejectionEvent.vue +25 -0
- package/components/Event/Display/HumanInTheLoopRequestEvent.vue +53 -0
- package/components/Event/Display/HumanInTheLoopResponseEvent.vue +40 -0
- package/components/Event/Display/LLMCostEvent.vue +25 -0
- package/components/Event/Display/LLMEvent.vue +92 -0
- package/components/Event/Display/LimitChatHistoryEvent.vue +60 -0
- package/components/Event/Display/RAGFailureStopEvent.vue +28 -0
- package/components/Event/Display/RAGStartEvent.vue +77 -0
- package/components/Event/Display/RAGSuccessStopEvent.vue +16 -0
- package/components/Event/Display/RawDataContent.vue +69 -0
- package/components/Event/Display/RerankerEvent.vue +39 -0
- package/components/Event/Display/RetrieverEvent.vue +22 -0
- package/components/Event/Display/RouterEvent.vue +54 -0
- package/components/Event/Display/StandaloneQuestionCondenserEvent.vue +38 -0
- package/components/Event/Display/StopEvent.vue +16 -0
- package/components/Event/Display/ThoughtEvent.vue +20 -0
- package/components/Event/Display/ToolEvent.vue +38 -0
- package/components/Event/Display/UnknownEvent.vue +17 -0
- package/components/Event/Display/UserMessageEvent.vue +35 -0
- package/components/Event/List/EventList.vue +249 -0
- package/components/Event/Statistics.vue +49 -0
- package/components/Event/Timeseries.vue +224 -0
- package/components/FormKit/AgentSelector.vue +307 -0
- package/components/FormKit/ChipsInput.vue +62 -0
- package/components/FormKit/DynamicConfiguration.vue +155 -0
- package/components/FormKit/IconSelector.vue +72 -0
- package/components/FormKit/KnowledgeDatabaseSelector.vue +92 -0
- package/components/FormKit/LocaleInput.vue +150 -0
- package/components/FormKit/ModelSelect.vue +110 -0
- package/components/FormKit/Repeater.vue +93 -0
- package/components/FormKit/VectorStoreInput.vue +247 -0
- package/components/Knowledge/Document/List.vue +140 -0
- package/components/Knowledge/Document/Overview.vue +28 -0
- package/components/Knowledge/Document/UploadModal.vue +298 -0
- package/components/Knowledge/Document/WithNodes.vue +105 -0
- package/components/Knowledge/Namespace/Card.vue +108 -0
- package/components/Knowledge/Namespace/CreateModal.vue +203 -0
- package/components/Knowledge/Namespace/EditModal.vue +134 -0
- package/components/Knowledge/Namespace/EmptyCard.vue +35 -0
- package/components/Knowledge/Node/Content.vue +71 -0
- package/components/Markdown/Renderer.vue +87 -0
- package/components/Memory/DetailPage.vue +48 -0
- package/components/Memory/Edit.vue +241 -0
- package/components/Memory/Graph.vue +318 -0
- package/components/Memory/List.vue +155 -0
- package/components/Memory/MemoryManagementPage.vue +178 -0
- package/components/Memory/OpenWebUIContent.vue +96 -0
- package/components/Memory/PageLayout.vue +72 -0
- package/components/Models/ModelDetailsPanel.vue +250 -0
- package/components/Models/NamespaceCard.vue +79 -0
- package/components/Navigation/Left.vue +85 -0
- package/components/Navigation/Top.vue +31 -0
- package/components/Notification/Item.vue +88 -0
- package/components/Notification/NotificationsOverlay.vue +164 -0
- package/components/Process/Card.vue +119 -0
- package/components/Process/Configuration.vue +20 -0
- package/components/Process/CreateModal.vue +276 -0
- package/components/Process/EmptyCard.vue +35 -0
- package/components/Process/Form.vue +153 -0
- package/components/Process/Starts.vue +44 -0
- package/components/Process/Walkthrough/List.vue +162 -0
- package/components/Role/AccessRulesEditor.vue +132 -0
- package/components/Role/Card.vue +68 -0
- package/components/Role/Create.vue +55 -0
- package/components/Role/Edit.vue +82 -0
- package/components/Role/UsageLimitsEditor.vue +225 -0
- package/components/Service/Selection.vue +148 -0
- package/components/Structural/Column.vue +74 -0
- package/components/Structural/Screen.vue +10 -0
- package/components/Structural/Substructure.vue +5 -0
- package/components/Tenant/Switcher.vue +102 -0
- package/components/Thread/Details.vue +135 -0
- package/components/Thread/Hierarchy.vue +136 -0
- package/components/Thread/Info.vue +41 -0
- package/components/Thread/List.vue +136 -0
- package/components/User/Bar.vue +74 -0
- package/components/User/List.vue +86 -0
- package/components/User/RoleChips.vue +83 -0
- package/components/User/Settings.vue +79 -0
- package/components/Workflow/Modal.vue +39 -0
- package/components/Workflow/NodeCard.vue +41 -0
- package/components/Workflow/StartNode.vue +24 -0
- package/components/Workflow/StepNode.vue +27 -0
- package/components/Workflow/StopNode.vue +24 -0
- package/components/Workflow/Visualization.vue +265 -0
- package/components/mdc/MarkdownFigure.vue +9 -0
- package/components/mdc/MarkdownTable.vue +9 -0
- package/components/mdc/ResolveImageComponent.vue +58 -0
- package/composables/agent/useAgentClass.ts +27 -0
- package/composables/agent/useAgentClassInstances.ts +27 -0
- package/composables/agent/useAgentClasses.ts +27 -0
- package/composables/agent/useAgentIconFromThread.ts +8 -0
- package/composables/agent/useAgentInstance.ts +28 -0
- package/composables/agent/useAgentInstanceThreads.ts +76 -0
- package/composables/agent/useAgentInstances.ts +25 -0
- package/composables/agent/useAgentNavigation.ts +35 -0
- package/composables/agent/useCreateAgentInstance.ts +33 -0
- package/composables/agent/useDeleteAgentInstance.ts +31 -0
- package/composables/agent/useUpdateAgentInstance.ts +40 -0
- package/composables/auth/useAuth.ts +54 -0
- package/composables/auth/useAuthProviders.ts +14 -0
- package/composables/chat/useChatCompletions.ts +30 -0
- package/composables/dashboard/useAgentNameFromDashboardWidget.ts +27 -0
- package/composables/dashboard/useDashboardComponent.ts +27 -0
- package/composables/dashboard/useSaveDashboard.ts +21 -0
- package/composables/document/useCreateNamespace.ts +26 -0
- package/composables/document/useDatabases.ts +23 -0
- package/composables/document/useDocument.ts +29 -0
- package/composables/document/useDocumentUrl.ts +20 -0
- package/composables/document/useDocuments.ts +107 -0
- package/composables/document/useNodes.ts +29 -0
- package/composables/document/useSummaryNodes.ts +32 -0
- package/composables/document/useUpdateNamespace.ts +22 -0
- package/composables/evaluation/useCreateDataset.ts +19 -0
- package/composables/evaluation/useDataset.ts +26 -0
- package/composables/evaluation/useDatasets.ts +25 -0
- package/composables/evaluation/useUpdateDataset.ts +23 -0
- package/composables/event/useBasicEventStatistics.ts +83 -0
- package/composables/event/useEventColor.ts +25 -0
- package/composables/event/useEventComponent.ts +87 -0
- package/composables/event/useEventTimeseries.ts +39 -0
- package/composables/event/useEventTimeseriesStats.ts +26 -0
- package/composables/file/useFileUpload.ts +91 -0
- package/composables/file/useSupportedFileTypes.ts +22 -0
- package/composables/form/useCreateInstanceForm.ts +251 -0
- package/composables/form/useFormKitTransform.ts +753 -0
- package/composables/memory/useMemoryCRUD.ts +88 -0
- package/composables/memory/useMemoryFactory.ts +319 -0
- package/composables/memory/useMemorySearchFilter.ts +74 -0
- package/composables/models/useModelsList.ts +24 -0
- package/composables/models/useSingleModel.ts +30 -0
- package/composables/notification/useNotificationPoller.ts +58 -0
- package/composables/notification/useNotifications.ts +57 -0
- package/composables/notification/useUpdateMultipleNotifications.ts +17 -0
- package/composables/notification/useUpdateNotification.ts +17 -0
- package/composables/process/useCreateProcessInstance.ts +32 -0
- package/composables/process/useDeleteProcessInstance.ts +31 -0
- package/composables/process/useProcessClasses.ts +27 -0
- package/composables/process/useProcessInstance.ts +28 -0
- package/composables/process/useProcessInstances.ts +27 -0
- package/composables/process/useProcessWalkthroughs.ts +73 -0
- package/composables/process/useSendProcessStartForm.ts +43 -0
- package/composables/process/useUpdateProcessInstance.ts +40 -0
- package/composables/role/useCreateRole.ts +19 -0
- package/composables/role/useDeleteRole.ts +21 -0
- package/composables/role/useRole.ts +30 -0
- package/composables/role/useRoles.ts +25 -0
- package/composables/role/useUpdateRole.ts +22 -0
- package/composables/suite/useApps.ts +31 -0
- package/composables/suite/useSuite.ts +26 -0
- package/composables/tenant/useActiveTenant.ts +27 -0
- package/composables/tenant/useSysadminNavigation.ts +19 -0
- package/composables/tenant/useTenant.ts +38 -0
- package/composables/tenant/useTenantMemberships.ts +15 -0
- package/composables/tenant/useTenantPath.ts +20 -0
- package/composables/tenant/useTenantPolling.ts +30 -0
- package/composables/tenant/useTenantReady.ts +12 -0
- package/composables/theme/useDarkMode.ts +5 -0
- package/composables/thread/useThread.ts +27 -0
- package/composables/thread/useThreadEvents.ts +91 -0
- package/composables/thread/useThreadUtils.ts +49 -0
- package/composables/thread/useThreads.ts +64 -0
- package/composables/thread/useThreadsInfinite.ts +56 -0
- package/composables/translation/useTranslate.ts +20 -0
- package/composables/useRouteReady.ts +21 -0
- package/composables/useTimeAgo.ts +40 -0
- package/composables/user/useAssignRoleToUser.ts +22 -0
- package/composables/user/useMyUser.ts +25 -0
- package/composables/user/useRevokeRoleFromUser.ts +21 -0
- package/composables/user/useUser.ts +30 -0
- package/composables/user/useUsers.ts +63 -0
- package/composables/utils/useJsonTree.ts +138 -0
- package/formkit.config.ts +44 -0
- package/i18n/locales/de.yaml +815 -0
- package/i18n/locales/en.yaml +804 -0
- package/i18n/locales/fr.yaml +812 -0
- package/i18n/locales/it.yaml +808 -0
- package/layouts/anonymous.vue +8 -0
- package/layouts/default.vue +116 -0
- package/middleware/auth.global.ts +62 -0
- package/nuxt.config.ts +145 -0
- package/package.json +114 -0
- package/pages/[tenant]/index.vue +31 -0
- package/pages/[tenant]/notifications/index.vue +235 -0
- package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/chat.vue +67 -0
- package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/configuration.vue +122 -0
- package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/memories/[memory_id].vue +3 -0
- package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/memories.vue +20 -0
- package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/overview.vue +72 -0
- package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/threads.vue +52 -0
- package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/workflow.vue +19 -0
- package/pages/[tenant]/service/agents/[agent_class]-[agent_id].vue +63 -0
- package/pages/[tenant]/service/agents/templates.vue +102 -0
- package/pages/[tenant]/service/agents.vue +185 -0
- package/pages/[tenant]/service/datasets/[dataset_id].vue +81 -0
- package/pages/[tenant]/service/datasets.vue +53 -0
- package/pages/[tenant]/service/health/index.vue +3 -0
- package/pages/[tenant]/service/knowledge/[db]/[namespace]/[document_id]/nodes.vue +20 -0
- package/pages/[tenant]/service/knowledge/[db]/[namespace]/[document_id]/overview.vue +40 -0
- package/pages/[tenant]/service/knowledge/[db]/[namespace]/[document_id]/summary.vue +88 -0
- package/pages/[tenant]/service/knowledge/[db]/[namespace]/[document_id].vue +48 -0
- package/pages/[tenant]/service/knowledge/[db]/[namespace].vue +144 -0
- package/pages/[tenant]/service/knowledge.vue +126 -0
- package/pages/[tenant]/service/models/[model_name].vue +84 -0
- package/pages/[tenant]/service/models.vue +61 -0
- package/pages/[tenant]/service/my-account.vue +117 -0
- package/pages/[tenant]/service/openai/[thread_id]/[display_id]/memories.vue +66 -0
- package/pages/[tenant]/service/openai/[thread_id]/[display_id]/sources.vue +100 -0
- package/pages/[tenant]/service/openai/[thread_id]/[display_id]/tracing.vue +49 -0
- package/pages/[tenant]/service/openai.vue +101 -0
- package/pages/[tenant]/service/organization-memories/graph.vue +97 -0
- package/pages/[tenant]/service/organization-memories/list/[memory_id].vue +3 -0
- package/pages/[tenant]/service/organization-memories/list.vue +150 -0
- package/pages/[tenant]/service/organization-memories.vue +3 -0
- package/pages/[tenant]/service/processes/[process_class]-[process_id]/[process_walkthrough_id].vue +7 -0
- package/pages/[tenant]/service/processes/[process_class]-[process_id]/configuration.vue +106 -0
- package/pages/[tenant]/service/processes/[process_class]-[process_id]/overview.vue +67 -0
- package/pages/[tenant]/service/processes/[process_class]-[process_id]/start.vue +26 -0
- package/pages/[tenant]/service/processes/[process_class]-[process_id]/walkthroughs/[process_walkthrough_id]/overview.vue +14 -0
- package/pages/[tenant]/service/processes/[process_class]-[process_id]/walkthroughs.vue +54 -0
- package/pages/[tenant]/service/processes/[process_class]-[process_id].vue +60 -0
- package/pages/[tenant]/service/processes.vue +129 -0
- package/pages/[tenant]/service/roles/[role_id].vue +54 -0
- package/pages/[tenant]/service/roles.vue +84 -0
- package/pages/[tenant]/service/threads/[thread_id]/chat.vue +51 -0
- package/pages/[tenant]/service/threads/[thread_id]/display/[display_id].vue +21 -0
- package/pages/[tenant]/service/threads/[thread_id]/display.vue +29 -0
- package/pages/[tenant]/service/threads/[thread_id]/hierarchy.vue +14 -0
- package/pages/[tenant]/service/threads/[thread_id]/memories/[memory_id].vue +3 -0
- package/pages/[tenant]/service/threads/[thread_id]/memories.vue +19 -0
- package/pages/[tenant]/service/threads/[thread_id]/overview.vue +100 -0
- package/pages/[tenant]/service/threads/[thread_id].vue +54 -0
- package/pages/[tenant]/service/threads.vue +52 -0
- package/pages/[tenant]/service/user-memories/graph.vue +97 -0
- package/pages/[tenant]/service/user-memories/list/[memory_id].vue +3 -0
- package/pages/[tenant]/service/user-memories/list.vue +150 -0
- package/pages/[tenant]/service/user-memories.vue +3 -0
- package/pages/[tenant]/service/users/[user_id].vue +117 -0
- package/pages/[tenant]/service/users.vue +88 -0
- package/pages/auth/callback.vue +52 -0
- package/pages/auth/login.vue +80 -0
- package/pages/auth/renew.vue +24 -0
- package/pages/index.vue +59 -0
- package/pages/select-tenant.vue +76 -0
- package/plugins/0.runtime-config.client.ts +55 -0
- package/plugins/apexcharts.client.ts +5 -0
- package/plugins/api-client.client.ts +38 -0
- package/plugins/dark-mode.client.ts +12 -0
- package/plugins/keycloak-client.ts +41 -0
- package/plugins/oidc-client.ts +78 -0
- package/sdk/client/client/client.gen.ts +237 -0
- package/sdk/client/client/index.ts +24 -0
- package/sdk/client/client/types.gen.ts +213 -0
- package/sdk/client/client/utils.gen.ts +407 -0
- package/sdk/client/client.gen.ts +25 -0
- package/sdk/client/core/auth.gen.ts +42 -0
- package/sdk/client/core/bodySerializer.gen.ts +96 -0
- package/sdk/client/core/params.gen.ts +181 -0
- package/sdk/client/core/pathSerializer.gen.ts +180 -0
- package/sdk/client/core/queryKeySerializer.gen.ts +136 -0
- package/sdk/client/core/serverSentEvents.gen.ts +265 -0
- package/sdk/client/core/types.gen.ts +118 -0
- package/sdk/client/core/utils.gen.ts +143 -0
- package/sdk/client/index.ts +1013 -0
- package/sdk/client/schemas.gen.ts +35395 -0
- package/sdk/client/sdk.gen.ts +3438 -0
- package/sdk/client/transformers.gen.ts +143 -0
- package/sdk/client/types.gen.ts +27567 -0
- package/tailwind.config.mjs +27 -0
- package/themes/aihub-theme.ts +125 -0
- package/types/DashboardWidget.ts +13 -0
- package/types/EventChartInput.ts +7 -0
- package/types/NavItem.ts +6 -0
- package/types/TimeseriesInput.ts +7 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<StructuralColumn
|
|
3
|
+
:title="t('agent.title')"
|
|
4
|
+
:loading="agentClassesAreLoading"
|
|
5
|
+
>
|
|
6
|
+
<SelectButton
|
|
7
|
+
:model-value="activeNavItem"
|
|
8
|
+
:options="navItems"
|
|
9
|
+
data-key="key"
|
|
10
|
+
option-label="name"
|
|
11
|
+
size="small"
|
|
12
|
+
@update:model-value="toNavItem"
|
|
13
|
+
/>
|
|
14
|
+
<div class="flex flex-col gap-12 pt-4">
|
|
15
|
+
<div
|
|
16
|
+
v-for="group in groupedTemplates"
|
|
17
|
+
:key="group.agentClass"
|
|
18
|
+
>
|
|
19
|
+
<div class="pb-4">
|
|
20
|
+
<div class="flex items-center gap-2 pb-2">
|
|
21
|
+
<Icon
|
|
22
|
+
:name="group.icon"
|
|
23
|
+
size="2em"
|
|
24
|
+
class="text-surface-500"
|
|
25
|
+
/>
|
|
26
|
+
<span class="text-lg font-medium">{{ group.name }}</span>
|
|
27
|
+
</div>
|
|
28
|
+
<span
|
|
29
|
+
v-if="group.description"
|
|
30
|
+
class="pb-2 text-xs text-surface-500"
|
|
31
|
+
>
|
|
32
|
+
{{ group.description }}
|
|
33
|
+
</span>
|
|
34
|
+
</div>
|
|
35
|
+
<div class="grid grid-cols-2 gap-4 2xl:grid-cols-2">
|
|
36
|
+
<AgentTemplateCard
|
|
37
|
+
v-for="(tmpl, index) in group.templates"
|
|
38
|
+
:key="`${group.agentClass}-${index}`"
|
|
39
|
+
:template="tmpl"
|
|
40
|
+
:agent-class-name="group.name"
|
|
41
|
+
:locale="locale"
|
|
42
|
+
@click="openCreateModalWithTemplate(group.agentClass, tmpl)"
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
<div
|
|
47
|
+
v-if="groupedTemplates.length === 0"
|
|
48
|
+
class="flex flex-col items-center justify-center py-12 text-center"
|
|
49
|
+
>
|
|
50
|
+
<p class="text-sm text-surface-500">
|
|
51
|
+
{{ t('agent.templates.empty') }}
|
|
52
|
+
</p>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
<AgentCreateModal
|
|
56
|
+
v-model="createModalOpen"
|
|
57
|
+
:initial-class="selectedClassForCreate"
|
|
58
|
+
:initial-data="initialDataForCreate"
|
|
59
|
+
@success="handleCreateSuccess"
|
|
60
|
+
/>
|
|
61
|
+
</StructuralColumn>
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
<script setup lang="ts">
|
|
65
|
+
const router = useRouter()
|
|
66
|
+
const tenantPath = useTenantPath()
|
|
67
|
+
const { t, locale } = useI18n()
|
|
68
|
+
|
|
69
|
+
const { agentClasses, agentClassesAreLoading } = useAgentClasses()
|
|
70
|
+
const { navItems, activeNavItem, toNavItem } = useAgentNavigation()
|
|
71
|
+
|
|
72
|
+
const createModalOpen = ref(false)
|
|
73
|
+
const selectedClassForCreate = ref('')
|
|
74
|
+
const initialDataForCreate = ref<Record<string, unknown> | null>(null)
|
|
75
|
+
|
|
76
|
+
const openCreateModalWithTemplate = (agentClass: string, template: Record<string, unknown>) => {
|
|
77
|
+
selectedClassForCreate.value = agentClass
|
|
78
|
+
initialDataForCreate.value = template
|
|
79
|
+
createModalOpen.value = true
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const groupedTemplates = computed(() => {
|
|
83
|
+
if (!agentClasses.value) return []
|
|
84
|
+
|
|
85
|
+
const localeKey = locale.value as 'de' | 'en' | 'fr' | 'it'
|
|
86
|
+
|
|
87
|
+
return agentClasses.value
|
|
88
|
+
.filter(classInfo => classInfo.templates && classInfo.templates.length > 0)
|
|
89
|
+
.map(classInfo => ({
|
|
90
|
+
agentClass: classInfo.agent_class,
|
|
91
|
+
name: classInfo.name?.[localeKey] ?? classInfo.agent_class,
|
|
92
|
+
description: classInfo.description?.[localeKey] ?? '',
|
|
93
|
+
icon: classInfo.icon ?? 'meteor-icons:robot',
|
|
94
|
+
templates: classInfo.templates!,
|
|
95
|
+
}))
|
|
96
|
+
.sort((a, b) => a.agentClass.localeCompare(b.agentClass))
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
const handleCreateSuccess = (agentClass: string, agentId: string) => {
|
|
100
|
+
router.push(tenantPath(`/service/agents/${agentClass}-${agentId}/overview`))
|
|
101
|
+
}
|
|
102
|
+
</script>
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<StructuralScreen>
|
|
3
|
+
<StructuralColumn
|
|
4
|
+
v-if="!isTemplatesRoute"
|
|
5
|
+
:title="t('agent.title')"
|
|
6
|
+
:loading="isLoading"
|
|
7
|
+
size="large"
|
|
8
|
+
>
|
|
9
|
+
<SelectButton
|
|
10
|
+
:model-value="activeNavItem"
|
|
11
|
+
:options="navItems"
|
|
12
|
+
data-key="key"
|
|
13
|
+
option-label="name"
|
|
14
|
+
size="small"
|
|
15
|
+
@update:model-value="toNavItem"
|
|
16
|
+
/>
|
|
17
|
+
<div class="flex flex-col gap-12 pt-4">
|
|
18
|
+
<div
|
|
19
|
+
v-for="group in groupedAgents"
|
|
20
|
+
:key="group.agentClass"
|
|
21
|
+
>
|
|
22
|
+
<div class="pb-4">
|
|
23
|
+
<div class="flex items-center gap-2 pb-2">
|
|
24
|
+
<Icon
|
|
25
|
+
:name="group.icon"
|
|
26
|
+
size="2em"
|
|
27
|
+
class="text-surface-500"
|
|
28
|
+
/>
|
|
29
|
+
<span class="text-lg font-medium">{{ group.name }}</span>
|
|
30
|
+
<Button
|
|
31
|
+
v-if="group.networkGraph"
|
|
32
|
+
v-tooltip.top="t('agent.workflow.view_tooltip')"
|
|
33
|
+
severity="secondary"
|
|
34
|
+
text
|
|
35
|
+
rounded
|
|
36
|
+
size="small"
|
|
37
|
+
@click="openWorkflowModal(group)"
|
|
38
|
+
>
|
|
39
|
+
<Icon
|
|
40
|
+
name="mage:arrows-all-direction-2"
|
|
41
|
+
size="1.25em"
|
|
42
|
+
/>
|
|
43
|
+
</Button>
|
|
44
|
+
</div>
|
|
45
|
+
<span
|
|
46
|
+
v-if="group.description"
|
|
47
|
+
class="pb-2 text-xs text-surface-500"
|
|
48
|
+
>
|
|
49
|
+
{{ group.description }}
|
|
50
|
+
</span>
|
|
51
|
+
</div>
|
|
52
|
+
<div class="grid grid-cols-3 gap-4">
|
|
53
|
+
<AgentCard
|
|
54
|
+
v-for="agent in group.instances"
|
|
55
|
+
:key="`${agent.agent_class}-${agent.agent_id}`"
|
|
56
|
+
:agent="agent"
|
|
57
|
+
@click="() => toAgent(agent)"
|
|
58
|
+
@clone="handleClone"
|
|
59
|
+
/>
|
|
60
|
+
<AgentEmptyCard
|
|
61
|
+
v-if="group.isAvailable"
|
|
62
|
+
@add="openCreateModal(group.agentClass)"
|
|
63
|
+
/>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
<AgentCreateModal
|
|
68
|
+
v-model="createModalOpen"
|
|
69
|
+
:initial-class="selectedClassForCreate"
|
|
70
|
+
:initial-data="initialDataForCreate"
|
|
71
|
+
@success="handleCreateSuccess"
|
|
72
|
+
/>
|
|
73
|
+
<WorkflowModal
|
|
74
|
+
v-model="workflowModalOpen"
|
|
75
|
+
:graph-data="selectedGroupForWorkflow?.networkGraph"
|
|
76
|
+
:header="selectedGroupForWorkflow ? `${t('agent.workflow.title')} — ${selectedGroupForWorkflow.name}` : undefined"
|
|
77
|
+
/>
|
|
78
|
+
</StructuralColumn>
|
|
79
|
+
|
|
80
|
+
<NuxtPage />
|
|
81
|
+
</StructuralScreen>
|
|
82
|
+
</template>
|
|
83
|
+
|
|
84
|
+
<script setup lang="ts">
|
|
85
|
+
import type { FullAgentInstanceDto, WorkflowGraph } from '@core/sdk/client'
|
|
86
|
+
|
|
87
|
+
type AgentGroup = {
|
|
88
|
+
agentClass: string
|
|
89
|
+
name: string
|
|
90
|
+
description: string
|
|
91
|
+
icon: string
|
|
92
|
+
instances: FullAgentInstanceDto[]
|
|
93
|
+
isAvailable: boolean
|
|
94
|
+
networkGraph: WorkflowGraph | null
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const router = useRouter()
|
|
98
|
+
const route = useRoute()
|
|
99
|
+
const tenantPath = useTenantPath()
|
|
100
|
+
const { t, locale } = useI18n()
|
|
101
|
+
|
|
102
|
+
const { agentInstances, agentInstancesAreLoading } = useAgentInstances()
|
|
103
|
+
const { agentClasses, agentClassesAreLoading } = useAgentClasses()
|
|
104
|
+
const { navItems, activeNavItem, toNavItem } = useAgentNavigation()
|
|
105
|
+
|
|
106
|
+
const isLoading = computed(() => agentInstancesAreLoading.value || agentClassesAreLoading.value)
|
|
107
|
+
const isTemplatesRoute = computed(() => route.path.includes('/service/agents/templates'))
|
|
108
|
+
|
|
109
|
+
const createModalOpen = ref(false)
|
|
110
|
+
const selectedClassForCreate = ref('')
|
|
111
|
+
const initialDataForCreate = ref<Record<string, unknown> | null>(null)
|
|
112
|
+
|
|
113
|
+
const workflowModalOpen = ref(false)
|
|
114
|
+
const selectedGroupForWorkflow = ref<AgentGroup | null>(null)
|
|
115
|
+
|
|
116
|
+
const openWorkflowModal = (group: AgentGroup) => {
|
|
117
|
+
selectedGroupForWorkflow.value = group
|
|
118
|
+
workflowModalOpen.value = true
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const openCreateModal = (agentClass: string) => {
|
|
122
|
+
selectedClassForCreate.value = agentClass
|
|
123
|
+
initialDataForCreate.value = null
|
|
124
|
+
createModalOpen.value = true
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const handleClone = (agent: FullAgentInstanceDto) => {
|
|
128
|
+
selectedClassForCreate.value = agent.agent_class
|
|
129
|
+
initialDataForCreate.value = agent.configuration ?? null
|
|
130
|
+
createModalOpen.value = true
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const groupedAgents = computed<AgentGroup[]>(() => {
|
|
134
|
+
const groups = new Map<string, AgentGroup>()
|
|
135
|
+
|
|
136
|
+
const localeKey = locale.value as 'de' | 'en' | 'fr' | 'it'
|
|
137
|
+
|
|
138
|
+
// First, add all available agent classes (even those without instances)
|
|
139
|
+
if (agentClasses.value) {
|
|
140
|
+
for (const classInfo of agentClasses.value) {
|
|
141
|
+
groups.set(classInfo.agent_class, {
|
|
142
|
+
agentClass: classInfo.agent_class,
|
|
143
|
+
name: classInfo.name?.[localeKey] ?? classInfo.agent_class,
|
|
144
|
+
description: classInfo.description?.[localeKey] ?? '',
|
|
145
|
+
icon: classInfo.icon ?? 'meteor-icons:robot',
|
|
146
|
+
instances: [],
|
|
147
|
+
isAvailable: true,
|
|
148
|
+
networkGraph: classInfo.network_graph ?? null,
|
|
149
|
+
})
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Then, add instances to their groups (or create groups for unavailable classes)
|
|
154
|
+
if (agentInstances.value) {
|
|
155
|
+
for (const agent of agentInstances.value) {
|
|
156
|
+
const existing = groups.get(agent.agent_class)
|
|
157
|
+
if (existing) {
|
|
158
|
+
existing.instances.push(agent)
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
groups.set(agent.agent_class, {
|
|
162
|
+
agentClass: agent.agent_class,
|
|
163
|
+
name: agent.agent_class,
|
|
164
|
+
description: '',
|
|
165
|
+
icon: 'meteor-icons:robot',
|
|
166
|
+
instances: [agent],
|
|
167
|
+
isAvailable: false,
|
|
168
|
+
networkGraph: agent.network_graph ?? null,
|
|
169
|
+
})
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return Array.from(groups.values())
|
|
175
|
+
.sort((a, b) => a.agentClass.localeCompare(b.agentClass))
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
const toAgent = (agent: FullAgentInstanceDto) => {
|
|
179
|
+
router.push(tenantPath(`/service/agents/${agent.agent_class}-${agent.agent_id}/overview`))
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const handleCreateSuccess = (agentClass: string, agentId: string) => {
|
|
183
|
+
router.push(tenantPath(`/service/agents/${agentClass}-${agentId}/overview`))
|
|
184
|
+
}
|
|
185
|
+
</script>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<StructuralColumn
|
|
3
|
+
:title="dataset?.dataset_name"
|
|
4
|
+
close-route="/service/datasets"
|
|
5
|
+
:loading="datasetIsLoading"
|
|
6
|
+
>
|
|
7
|
+
<ConfirmPopup />
|
|
8
|
+
<div class="flex flex-col gap-3">
|
|
9
|
+
<EvaluationDatasetEdit v-model="editableDataset" />
|
|
10
|
+
<Button
|
|
11
|
+
v-if="changedItems.length > 0"
|
|
12
|
+
class="w-full"
|
|
13
|
+
:label="t('evaluation.dataset.save_button')"
|
|
14
|
+
icon="pi pi-save"
|
|
15
|
+
@click="safeDataset($event)"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
</StructuralColumn>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup lang="ts">
|
|
22
|
+
import { cloneDeep } from 'lodash-es'
|
|
23
|
+
import { useConfirm } from 'primevue/useconfirm'
|
|
24
|
+
import { useToast } from 'primevue/usetoast'
|
|
25
|
+
import { useI18n } from 'vue-i18n'
|
|
26
|
+
|
|
27
|
+
import type { Dataset, DatasetItem, DatasetItemCreate } from '@core/sdk/client'
|
|
28
|
+
|
|
29
|
+
const { t } = useI18n()
|
|
30
|
+
|
|
31
|
+
const { dataset, datasetIsLoading } = useDataset()
|
|
32
|
+
const editableDataset = ref<Dataset | null>(null)
|
|
33
|
+
|
|
34
|
+
watch(dataset, (newServerData) => {
|
|
35
|
+
if (newServerData) {
|
|
36
|
+
editableDataset.value = cloneDeep(newServerData)
|
|
37
|
+
}
|
|
38
|
+
}, { immediate: true })
|
|
39
|
+
|
|
40
|
+
const confirm = useConfirm()
|
|
41
|
+
const toast = useToast()
|
|
42
|
+
|
|
43
|
+
const { updateDataset } = useUpdateDataset()
|
|
44
|
+
const { tenantId } = useTenant()
|
|
45
|
+
|
|
46
|
+
const changedItems = computed<DatasetItemCreate[]>(() => {
|
|
47
|
+
return editableDataset.value.items
|
|
48
|
+
.filter((item: DatasetItem) => {
|
|
49
|
+
return !item.id || item.id.startsWith('tmp')
|
|
50
|
+
})
|
|
51
|
+
.map((item: DatasetItem) => {
|
|
52
|
+
return {
|
|
53
|
+
question: item.question,
|
|
54
|
+
answer: item.answer,
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const safeDataset = (event) => {
|
|
60
|
+
confirm.require({
|
|
61
|
+
target: event.currentTarget,
|
|
62
|
+
message: t('evaluation.dataset.save_confirmation'),
|
|
63
|
+
icon: 'pi pi-exclamation-triangle',
|
|
64
|
+
rejectProps: {
|
|
65
|
+
label: t('evaluation.dataset.cancel_button'),
|
|
66
|
+
severity: 'secondary',
|
|
67
|
+
outlined: true,
|
|
68
|
+
},
|
|
69
|
+
acceptProps: {
|
|
70
|
+
label: t('evaluation.dataset.save_action'),
|
|
71
|
+
},
|
|
72
|
+
accept: async () => {
|
|
73
|
+
const items = changedItems.value
|
|
74
|
+
if (items.length > 0) {
|
|
75
|
+
await updateDataset({ dataset: { items }, tenantId: tenantId.value! })
|
|
76
|
+
toast.add({ severity: 'success', summary: t('evaluation.dataset.saved_summary'), detail: t('evaluation.dataset.saved_detail'), life: 3000 })
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
</script>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<StructuralScreen>
|
|
3
|
+
<StructuralColumn
|
|
4
|
+
:title="t('evaluation.dataset.title')"
|
|
5
|
+
:loading="datasetsAreLoading"
|
|
6
|
+
>
|
|
7
|
+
<div class="flex flex-col gap-2">
|
|
8
|
+
<div class="flex w-full justify-end">
|
|
9
|
+
<Button
|
|
10
|
+
:label="t('evaluation.dataset.create_new')"
|
|
11
|
+
icon="pi pi-plus"
|
|
12
|
+
@click="createModalOpen = true"
|
|
13
|
+
/>
|
|
14
|
+
<Dialog
|
|
15
|
+
v-model:visible="createModalOpen"
|
|
16
|
+
modal
|
|
17
|
+
:header="t('evaluation.dataset.create_new')"
|
|
18
|
+
>
|
|
19
|
+
<EvaluationDatasetCreate
|
|
20
|
+
@close="createModalOpen = false"
|
|
21
|
+
/>
|
|
22
|
+
</Dialog>
|
|
23
|
+
</div>
|
|
24
|
+
<div
|
|
25
|
+
class="grid grid-cols-2 gap-4 xl:grid-cols-2"
|
|
26
|
+
>
|
|
27
|
+
<EvaluationDatasetCard
|
|
28
|
+
v-for="dataset in datasets"
|
|
29
|
+
:key="dataset.id"
|
|
30
|
+
:dataset="dataset"
|
|
31
|
+
:langfuse-dataset-url="dataset.langfuse_url"
|
|
32
|
+
@click="() => toDataset(dataset)"
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</StructuralColumn>
|
|
37
|
+
|
|
38
|
+
<NuxtPage />
|
|
39
|
+
</StructuralScreen>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script setup lang="ts">
|
|
43
|
+
const router = useRouter()
|
|
44
|
+
const tenantPath = useTenantPath()
|
|
45
|
+
const { t } = useI18n()
|
|
46
|
+
|
|
47
|
+
const { datasets, datasetsAreLoading } = useDatasets()
|
|
48
|
+
const createModalOpen = ref(false)
|
|
49
|
+
|
|
50
|
+
const toDataset = (dataset: { id: string }) => {
|
|
51
|
+
router.push(tenantPath(`/service/datasets/${dataset.id}`))
|
|
52
|
+
}
|
|
53
|
+
</script>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<StructuralColumn
|
|
3
|
+
:title="t('knowledge.nodes.title')"
|
|
4
|
+
:close-route="`/service/knowledge/${route.params.db}/${route.params.namespace}`"
|
|
5
|
+
:loading="nodesAreLoading"
|
|
6
|
+
>
|
|
7
|
+
<KnowledgeNodeContent
|
|
8
|
+
v-for="node in nodes"
|
|
9
|
+
:key="node.id"
|
|
10
|
+
:node="node"
|
|
11
|
+
/>
|
|
12
|
+
</StructuralColumn>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
const { nodes, nodesAreLoading } = useNodes()
|
|
17
|
+
|
|
18
|
+
const { t } = useI18n()
|
|
19
|
+
const route = useRoute()
|
|
20
|
+
</script>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<StructuralColumn
|
|
3
|
+
:title="document?.document_title"
|
|
4
|
+
:close-route="`/service/knowledge/${route.params.db}/${route.params.namespace}`"
|
|
5
|
+
:loading="documentIsLoading"
|
|
6
|
+
>
|
|
7
|
+
<div class="mt-16 rounded-3xl border border-surface-100 p-9 shadow-lg dark:border-surface-800">
|
|
8
|
+
<KnowledgeDocumentOverview :document="document">
|
|
9
|
+
<MarkdownRenderer
|
|
10
|
+
:md="md"
|
|
11
|
+
/>
|
|
12
|
+
</KnowledgeDocumentOverview>
|
|
13
|
+
</div>
|
|
14
|
+
</StructuralColumn>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
const { document, documentIsLoading } = useDocument()
|
|
19
|
+
const route = useRoute()
|
|
20
|
+
|
|
21
|
+
const md = computed<string>(() => {
|
|
22
|
+
if (documentIsLoading.value) {
|
|
23
|
+
return ''
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const content = document.value?.content
|
|
27
|
+
if (!content) {
|
|
28
|
+
return ''
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return content
|
|
32
|
+
// Replace our custom <figure>-tags surrounding our images
|
|
33
|
+
.replace(/(?:<|<)figure(?:>|>)/g, '::MarkdownFigure\n')
|
|
34
|
+
.replace(/(?:<|<)\/figure(?:>|>)/g, '\n::')
|
|
35
|
+
|
|
36
|
+
// Replace our custom <table>-tag surrounding our tables
|
|
37
|
+
.replace(/(?:<|<)table(?:>|>)/g, '::MarkdownTable\n')
|
|
38
|
+
.replace(/(?:<|<)\/table(?:>|>)/g, '\n::')
|
|
39
|
+
})
|
|
40
|
+
</script>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<StructuralColumn
|
|
3
|
+
:title="t('knowledge.summary.title')"
|
|
4
|
+
:close-route="`/service/knowledge/${route.params.db}/${route.params.namespace}`"
|
|
5
|
+
:loading="summaryNodesAreLoading"
|
|
6
|
+
>
|
|
7
|
+
<div class="flex flex-col gap-16">
|
|
8
|
+
<Tabs :value="1">
|
|
9
|
+
<TabList>
|
|
10
|
+
<Tab
|
|
11
|
+
v-for="summary in summaryNodes"
|
|
12
|
+
:key="summary.level"
|
|
13
|
+
:value="summary.level"
|
|
14
|
+
>
|
|
15
|
+
{{ t('knowledge.summary.level') }} {{ summary.level }}
|
|
16
|
+
</Tab>
|
|
17
|
+
</TabList>
|
|
18
|
+
<TabPanels>
|
|
19
|
+
<TabPanel
|
|
20
|
+
v-for="summary in summaryNodes"
|
|
21
|
+
:key="summary.level"
|
|
22
|
+
:value="summary.level"
|
|
23
|
+
>
|
|
24
|
+
<div v-if="summary.nodes.length > 0">
|
|
25
|
+
<div
|
|
26
|
+
v-for="(node, nodeIndex) in summary.nodes"
|
|
27
|
+
:key="node.id"
|
|
28
|
+
>
|
|
29
|
+
<div
|
|
30
|
+
v-for="i in 6"
|
|
31
|
+
:key="i"
|
|
32
|
+
>
|
|
33
|
+
<Component
|
|
34
|
+
:is="`h${i}`"
|
|
35
|
+
v-if="node[`h${i}`] && (nodeIndex === 0 || node[`h${i}`] !== summary.nodes[nodeIndex-1][`h${i}`])"
|
|
36
|
+
class="pl-2"
|
|
37
|
+
>
|
|
38
|
+
{{ node[`h${i}`] }}
|
|
39
|
+
</Component>
|
|
40
|
+
</div>
|
|
41
|
+
<KnowledgeNodeContent
|
|
42
|
+
:node="node"
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
<div v-else>
|
|
47
|
+
{{ t("knowledge.summary.no_summaries_at_level") }}
|
|
48
|
+
</div>
|
|
49
|
+
</TabPanel>
|
|
50
|
+
</TabPanels>
|
|
51
|
+
</Tabs>
|
|
52
|
+
</div>
|
|
53
|
+
</StructuralColumn>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<script setup lang="ts">
|
|
57
|
+
import { useSummaryNodes } from '@core/composables/document/useSummaryNodes'
|
|
58
|
+
|
|
59
|
+
const { t } = useI18n()
|
|
60
|
+
const route = useRoute()
|
|
61
|
+
const { summaryNodes, summaryNodesAreLoading } = useSummaryNodes()
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<style scoped>
|
|
65
|
+
h1 {
|
|
66
|
+
@apply mt-4 text-xl font-bold before:content-['#'] before:pr-1 before:text-gray-400;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
h2 {
|
|
70
|
+
@apply mt-4 text-lg font-bold before:content-['##'] before:pr-1 before:text-gray-400;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
h3 {
|
|
74
|
+
@apply mt-4 text-base font-bold before:content-['###'] before:pr-1 before:text-gray-400;;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
h4 {
|
|
78
|
+
@apply mt-3 font-bold before:content-['####'] before:pr-1 before:text-gray-400;;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
h5 {
|
|
82
|
+
@apply mt-2 font-bold before:content-['#####'] before:pr-1 before:text-gray-400;;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
h6 {
|
|
86
|
+
@apply mt-2 font-bold before:content-['######'] before:pr-1 before:text-gray-400;;
|
|
87
|
+
}
|
|
88
|
+
</style>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex flex-col gap-2">
|
|
3
|
+
<SelectButton
|
|
4
|
+
v-if="navItems"
|
|
5
|
+
:model-value="activeNavItem"
|
|
6
|
+
:options="navItems"
|
|
7
|
+
data-key="key"
|
|
8
|
+
option-label="name"
|
|
9
|
+
size="small"
|
|
10
|
+
@update:model-value="toNavItem"
|
|
11
|
+
/>
|
|
12
|
+
<NuxtPage />
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
import type { NavItem } from '@core/types/NavItem'
|
|
18
|
+
|
|
19
|
+
const router = useRouter()
|
|
20
|
+
const route = useRoute()
|
|
21
|
+
const tenantPath = useTenantPath()
|
|
22
|
+
const { t } = useI18n()
|
|
23
|
+
|
|
24
|
+
const subPath = (path: string) => {
|
|
25
|
+
return `/service/knowledge/${route.params.db}/${route.params.namespace}/${route.params.document_id}/${path}`
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const isActive = (path: string) => {
|
|
29
|
+
return () => {
|
|
30
|
+
const localizedPath = tenantPath(subPath(path))
|
|
31
|
+
return route.path.startsWith(localizedPath)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const navItems = computed<NavItem[]>(() => [
|
|
36
|
+
{ name: t('knowledge.navigation.document.basic'), key: 'basic', path: subPath('overview'), isActive: isActive('overview') },
|
|
37
|
+
{ name: t('knowledge.navigation.document.nodes'), key: 'nodes', path: subPath('nodes'), isActive: isActive('nodes') },
|
|
38
|
+
{ name: t('knowledge.navigation.document.summary'), key: 'summary', path: subPath('summary'), isActive: isActive('summary') },
|
|
39
|
+
])
|
|
40
|
+
|
|
41
|
+
const toNavItem = (navItem: NavItem) => {
|
|
42
|
+
router.push(tenantPath(navItem.path))
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const activeNavItem = computed<NavItem | undefined>(() => {
|
|
46
|
+
return navItems.value?.find(navItem => navItem.isActive())
|
|
47
|
+
})
|
|
48
|
+
</script>
|