@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,214 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex w-full justify-center">
|
|
3
|
+
<div class="flex w-full max-w-screen-2xl flex-col gap-2 p-4">
|
|
4
|
+
<div class="flex justify-end">
|
|
5
|
+
<div class="pr-4">
|
|
6
|
+
<Button
|
|
7
|
+
type="button"
|
|
8
|
+
:label="t('dashboard.add_widget')"
|
|
9
|
+
icon="pi pi-plus"
|
|
10
|
+
@click="($event) => newWidget.toggle($event)"
|
|
11
|
+
/>
|
|
12
|
+
<Popover ref="newWidget">
|
|
13
|
+
<div class="flex flex-col gap-2">
|
|
14
|
+
<p class="font-bold">
|
|
15
|
+
{{ t("dashboard.create_widget") }}
|
|
16
|
+
</p>
|
|
17
|
+
<SelectButton
|
|
18
|
+
v-model="component"
|
|
19
|
+
size="small"
|
|
20
|
+
option-label="label"
|
|
21
|
+
:options="componentOptions"
|
|
22
|
+
:allow-empty="false"
|
|
23
|
+
/>
|
|
24
|
+
<SelectButton
|
|
25
|
+
v-model="timeRange"
|
|
26
|
+
size="small"
|
|
27
|
+
:options="timeRanges"
|
|
28
|
+
:allow-empty="false"
|
|
29
|
+
/>
|
|
30
|
+
<Select
|
|
31
|
+
v-model="event"
|
|
32
|
+
:options="eventOptions"
|
|
33
|
+
option-label="label"
|
|
34
|
+
:placeholder="t('dashboard.select_data_type')"
|
|
35
|
+
/>
|
|
36
|
+
<Select
|
|
37
|
+
v-model="agent"
|
|
38
|
+
:options="agentInstances"
|
|
39
|
+
option-label="agent_config.name"
|
|
40
|
+
:placeholder="t('dashboard.select_agent')"
|
|
41
|
+
:loading="agentInstancesAreLoading"
|
|
42
|
+
show-clear
|
|
43
|
+
/>
|
|
44
|
+
<Button
|
|
45
|
+
:label="t('dashboard.create')"
|
|
46
|
+
:disabled="!(timeRange && event)"
|
|
47
|
+
@click="addWidget"
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
</Popover>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
<div
|
|
54
|
+
ref="gridstack"
|
|
55
|
+
class="min-h-[400px]"
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<script setup lang="ts">
|
|
62
|
+
import { GridStack } from 'gridstack'
|
|
63
|
+
import { v4 as uuid } from 'uuid'
|
|
64
|
+
import { h, render } from 'vue'
|
|
65
|
+
|
|
66
|
+
import 'gridstack/dist/gridstack.min.css'
|
|
67
|
+
import GridItemVue from './Item.vue'
|
|
68
|
+
|
|
69
|
+
import type { FullAgentInstanceDto, TimeRange } from '@core/sdk/client'
|
|
70
|
+
import type { DashboardWidget } from '@core/types/DashboardWidget'
|
|
71
|
+
import type { GridStackElement } from 'gridstack'
|
|
72
|
+
|
|
73
|
+
const { agentInstances, agentInstancesAreLoading } = useAgentInstances()
|
|
74
|
+
const { t } = useI18n()
|
|
75
|
+
const { myUser, myUserIsLoading } = useMyUser()
|
|
76
|
+
const { saveDashboard } = useSaveDashboard()
|
|
77
|
+
const { tenantId } = useTenant()
|
|
78
|
+
|
|
79
|
+
watch(myUser, () => {
|
|
80
|
+
if (myUser.value?.dashboard?.children && grid) {
|
|
81
|
+
grid.load(myUser.value?.dashboard?.children ?? [])
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
const gridStackElement = templateRef('gridstack')
|
|
86
|
+
let grid: GridStack | null = null
|
|
87
|
+
const itemRenderContexts = new Map<string, HTMLElement>()
|
|
88
|
+
|
|
89
|
+
const nuxtApp = useNuxtApp()
|
|
90
|
+
|
|
91
|
+
onMounted(() => {
|
|
92
|
+
grid = GridStack.init({
|
|
93
|
+
cellHeight: '350px',
|
|
94
|
+
minRow: 1,
|
|
95
|
+
margin: '24px',
|
|
96
|
+
column: 4,
|
|
97
|
+
}, gridStackElement.value)
|
|
98
|
+
|
|
99
|
+
GridStack.addRemoveCB = (_: HTMLElement, w: DashboardWidget, add: boolean): GridStackElement | undefined => {
|
|
100
|
+
const widgetId = w.id
|
|
101
|
+
|
|
102
|
+
if (add) {
|
|
103
|
+
const tempRenderHost = document.createElement('div')
|
|
104
|
+
|
|
105
|
+
const vueComponentVNode = h(
|
|
106
|
+
GridItemVue,
|
|
107
|
+
{
|
|
108
|
+
component: w.component,
|
|
109
|
+
data: w,
|
|
110
|
+
onRemove: (domElementToRemove: HTMLElement) => {
|
|
111
|
+
if (grid && domElementToRemove) {
|
|
112
|
+
grid.removeWidget(domElementToRemove)
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
if (nuxtApp && nuxtApp.vueApp) {
|
|
119
|
+
vueComponentVNode.appContext = nuxtApp.vueApp._context
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
render(vueComponentVNode, tempRenderHost)
|
|
123
|
+
itemRenderContexts.set(widgetId, tempRenderHost)
|
|
124
|
+
return vueComponentVNode.el as GridStackElement
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
const contextHostToUnmount = itemRenderContexts.get(widgetId)
|
|
128
|
+
if (contextHostToUnmount) {
|
|
129
|
+
render(null, contextHostToUnmount)
|
|
130
|
+
itemRenderContexts.delete(widgetId)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (!myUserIsLoading.value) {
|
|
136
|
+
grid.load(myUser.value?.dashboard?.children ?? [])
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
grid.on('change', () => {
|
|
140
|
+
saveLayout()
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
grid.on('added', () => {
|
|
144
|
+
saveLayout()
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
grid.on('removed', () => {
|
|
148
|
+
saveLayout()
|
|
149
|
+
})
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
onBeforeUnmount(() => {
|
|
153
|
+
if (grid) {
|
|
154
|
+
itemRenderContexts.forEach(host => render(null, host))
|
|
155
|
+
itemRenderContexts.clear()
|
|
156
|
+
grid.destroy(false)
|
|
157
|
+
grid = null
|
|
158
|
+
GridStack.addRemoveCB = undefined
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
const saveLayout = () => {
|
|
163
|
+
if (grid) {
|
|
164
|
+
const serializedData = grid.save(true, true)
|
|
165
|
+
saveDashboard({ grid: serializedData, tenantId: tenantId.value! })
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const newWidget = templateRef('newWidget')
|
|
170
|
+
|
|
171
|
+
type componentSelection = { label: string, component: string, w: number, h: number }
|
|
172
|
+
const componentOptions = ref<componentSelection[]>([
|
|
173
|
+
{ label: 'Number', component: 'DashboardComponentNumber', w: 1, h: 1 },
|
|
174
|
+
{ label: 'Line Chart', component: 'DashboardComponentLineChart', w: 2, h: 1 },
|
|
175
|
+
{ label: 'Bar Chart', component: 'DashboardComponentBarChart', w: 2, h: 1 },
|
|
176
|
+
])
|
|
177
|
+
const component = ref<componentSelection>(componentOptions.value[0])
|
|
178
|
+
|
|
179
|
+
const timeRange = ref<TimeRange>('24h')
|
|
180
|
+
const timeRanges = ref<string[]>(['1h', '24h', '30d', '365d'])
|
|
181
|
+
|
|
182
|
+
const agent = ref<FullAgentInstanceDto | null>(null)
|
|
183
|
+
|
|
184
|
+
type eventType = { label: string, event: string }
|
|
185
|
+
const eventOptions = computed<eventType[]>(() => {
|
|
186
|
+
return [
|
|
187
|
+
'StartEvent',
|
|
188
|
+
'UserMessageEvent',
|
|
189
|
+
'ExceptionEvent',
|
|
190
|
+
'HumanInTheLoopRequestEvent',
|
|
191
|
+
'BotInTheLoopRequestEvent',
|
|
192
|
+
'AgentInTheLoopRequestEvent',
|
|
193
|
+
].map((event: string) => ({
|
|
194
|
+
event,
|
|
195
|
+
label: t(`dashboard.events.${event}.label`),
|
|
196
|
+
}))
|
|
197
|
+
})
|
|
198
|
+
const event = ref<eventType | null>(null)
|
|
199
|
+
|
|
200
|
+
const addWidget = () => {
|
|
201
|
+
if (!grid) return
|
|
202
|
+
const newWidgetNodeToAdd: DashboardWidget = {
|
|
203
|
+
id: uuid(),
|
|
204
|
+
component: component.value.component,
|
|
205
|
+
w: component.value.w,
|
|
206
|
+
h: component.value.h,
|
|
207
|
+
noResize: true,
|
|
208
|
+
timeRange: timeRange.value,
|
|
209
|
+
agent: agent.value ? { agentId: agent.value.agent_id, agentClass: agent.value.agent_class } : undefined,
|
|
210
|
+
event: event.value!.event,
|
|
211
|
+
}
|
|
212
|
+
grid.addWidget(newWidgetNodeToAdd)
|
|
213
|
+
}
|
|
214
|
+
</script>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="gridItemRoot"
|
|
4
|
+
class="grid-stack-item"
|
|
5
|
+
>
|
|
6
|
+
<div class="size-full p-4">
|
|
7
|
+
<div class="flex size-full flex-col justify-start gap-2 rounded-xl border border-surface-200 bg-white p-4 shadow-lg dark:border-surface-800 dark:bg-surface-900">
|
|
8
|
+
<div class="flex w-full justify-between">
|
|
9
|
+
<Tag
|
|
10
|
+
severity="secondary"
|
|
11
|
+
:value="timeRangeName"
|
|
12
|
+
/>
|
|
13
|
+
<button @click="handleRemove">
|
|
14
|
+
<Icon
|
|
15
|
+
name="oui:cross"
|
|
16
|
+
size="xl"
|
|
17
|
+
/>
|
|
18
|
+
</button>
|
|
19
|
+
</div>
|
|
20
|
+
<ProgressSpinner
|
|
21
|
+
v-if="timeseriesIsLoading"
|
|
22
|
+
class="mt-24 size-12"
|
|
23
|
+
/>
|
|
24
|
+
<div v-else>
|
|
25
|
+
<component
|
|
26
|
+
:is="vueComponent"
|
|
27
|
+
:title="title"
|
|
28
|
+
:timeseries="timeseries"
|
|
29
|
+
:widget-data="data"
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script setup lang="ts">
|
|
38
|
+
import type { DashboardWidget } from '@core/types/DashboardWidget'
|
|
39
|
+
|
|
40
|
+
const props = defineProps<{
|
|
41
|
+
component: string
|
|
42
|
+
data: DashboardWidget
|
|
43
|
+
}>()
|
|
44
|
+
|
|
45
|
+
const { t } = useI18n()
|
|
46
|
+
|
|
47
|
+
const emit = defineEmits<{
|
|
48
|
+
remove: [HTMLElement]
|
|
49
|
+
}>()
|
|
50
|
+
|
|
51
|
+
const title = computed(() => t(`dashboard.events.${props.data.event}.label`))
|
|
52
|
+
|
|
53
|
+
const timeRange = computed(() => props.data.timeRange)
|
|
54
|
+
const timeRangeName = computed(() => t(`timerange.${timeRange.value}`))
|
|
55
|
+
|
|
56
|
+
const { timeseries, timeseriesIsLoading } = useEventTimeseries({
|
|
57
|
+
eventName: props.data.event,
|
|
58
|
+
timeRange: timeRange,
|
|
59
|
+
agentId: props.data?.agent?.agentId,
|
|
60
|
+
agentClass: props.data?.agent?.agentClass,
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
const gridItemRoot = ref<HTMLElement | null>(null)
|
|
64
|
+
const { resolveComponent } = useDashboardComponent()
|
|
65
|
+
|
|
66
|
+
const vueComponent = computed(() => {
|
|
67
|
+
return resolveComponent(props.component)
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
const handleRemove = () => {
|
|
71
|
+
if (gridItemRoot.value) {
|
|
72
|
+
emit('remove', gridItemRoot.value)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
</script>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Tag
|
|
3
|
+
v-if="isTrendingUp"
|
|
4
|
+
:severity="reverseLogic ? 'danger' : 'success'"
|
|
5
|
+
:value="t('chart.trending_up')"
|
|
6
|
+
size="small"
|
|
7
|
+
icon="pi pi-arrow-up-right"
|
|
8
|
+
rounded
|
|
9
|
+
/>
|
|
10
|
+
<Tag
|
|
11
|
+
v-else
|
|
12
|
+
:severity="reverseLogic ? 'success' : 'danger'"
|
|
13
|
+
:value="t('chart.trending_down')"
|
|
14
|
+
icon="pi pi-arrow-down-right"
|
|
15
|
+
rounded
|
|
16
|
+
/>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
import type { EventTimeseries } from '@core/sdk/client'
|
|
21
|
+
|
|
22
|
+
const props = defineProps<{
|
|
23
|
+
timeseries: EventTimeseries
|
|
24
|
+
}>()
|
|
25
|
+
|
|
26
|
+
const { t } = useI18n()
|
|
27
|
+
const { isTrendingUp } = useEventTimeseriesStats(props.timeseries)
|
|
28
|
+
|
|
29
|
+
const EXCEPTION_EVENT = 'ExceptionEvent'
|
|
30
|
+
|
|
31
|
+
const reverseLogic = computed(() => {
|
|
32
|
+
return props.timeseries.event_name === EXCEPTION_EVENT
|
|
33
|
+
})
|
|
34
|
+
</script>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DataTable
|
|
3
|
+
:value="displays"
|
|
4
|
+
table-style="min-width: 50rem"
|
|
5
|
+
selection-mode="single"
|
|
6
|
+
:selection="selectedDisplay"
|
|
7
|
+
size="small"
|
|
8
|
+
@update:selection="emit('selected', $event)"
|
|
9
|
+
>
|
|
10
|
+
<Column
|
|
11
|
+
field="Started"
|
|
12
|
+
:header="t('thread.display.list.started')"
|
|
13
|
+
>
|
|
14
|
+
<template #body="{ data }">
|
|
15
|
+
<p>{{ formatted(data.started_at) }}</p>
|
|
16
|
+
</template>
|
|
17
|
+
</Column>
|
|
18
|
+
<Column
|
|
19
|
+
field="duration"
|
|
20
|
+
:header="t('thread.display.list.duration')"
|
|
21
|
+
>
|
|
22
|
+
<template #body="{ data }">
|
|
23
|
+
<Badge :value="data.duration" />
|
|
24
|
+
</template>
|
|
25
|
+
</Column>
|
|
26
|
+
<Column
|
|
27
|
+
field="n_events"
|
|
28
|
+
:header="t('thread.display.list.events')"
|
|
29
|
+
>
|
|
30
|
+
<template #body="{ data }">
|
|
31
|
+
<Badge :value="data.n_events" />
|
|
32
|
+
</template>
|
|
33
|
+
</Column>
|
|
34
|
+
<Column
|
|
35
|
+
field="has_errors"
|
|
36
|
+
:header="t('thread.display.list.status')"
|
|
37
|
+
>
|
|
38
|
+
<template #body="{ data }">
|
|
39
|
+
<Tag
|
|
40
|
+
v-if="data.has_errors"
|
|
41
|
+
severity="danger"
|
|
42
|
+
:value="t('event.list.error')"
|
|
43
|
+
/>
|
|
44
|
+
<Tag
|
|
45
|
+
v-else
|
|
46
|
+
severity="success"
|
|
47
|
+
:value="t('event.list.successful')"
|
|
48
|
+
/>
|
|
49
|
+
</template>
|
|
50
|
+
</Column>
|
|
51
|
+
<Column
|
|
52
|
+
field="has_pending"
|
|
53
|
+
:header="t('thread.display.list.pending')"
|
|
54
|
+
>
|
|
55
|
+
<template #body="{ data }">
|
|
56
|
+
<Tag
|
|
57
|
+
v-if="data.has_pending"
|
|
58
|
+
severity="warn"
|
|
59
|
+
:value="pendingType(data)"
|
|
60
|
+
/>
|
|
61
|
+
<Tag
|
|
62
|
+
v-else
|
|
63
|
+
severity="success"
|
|
64
|
+
:value="t('event.list.no')"
|
|
65
|
+
/>
|
|
66
|
+
</template>
|
|
67
|
+
</Column>
|
|
68
|
+
</DataTable>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<script setup lang="ts">
|
|
72
|
+
import type { DisplayStatistics } from '@core/sdk/client'
|
|
73
|
+
|
|
74
|
+
const route = useRoute()
|
|
75
|
+
const { t } = useI18n()
|
|
76
|
+
|
|
77
|
+
const props = defineProps<{
|
|
78
|
+
displays: DisplayStatistics[]
|
|
79
|
+
}>()
|
|
80
|
+
|
|
81
|
+
const emit = defineEmits<{
|
|
82
|
+
selected: [display: DisplayStatistics]
|
|
83
|
+
}>()
|
|
84
|
+
|
|
85
|
+
const formatted = (datestr: string) => useDateFormat(new Date(datestr), t('thread.display.list.dateFormat'))
|
|
86
|
+
const { pendingType } = useThreadUtils()
|
|
87
|
+
|
|
88
|
+
const selectedDisplay = computed(() => {
|
|
89
|
+
return props.displays.filter((display: DisplayStatistics) => {
|
|
90
|
+
return display.display_id === route.params.display_id
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
</script>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="flex cursor-pointer flex-col gap-3 rounded-xl border border-surface-200 p-4 hover:bg-surface-100 dark:border-surface-800 hover:dark:bg-surface-800"
|
|
4
|
+
:class="{ 'bg-surface-100 dark:bg-surface-800': isActive }"
|
|
5
|
+
>
|
|
6
|
+
<div class="flex items-center justify-between gap-4">
|
|
7
|
+
<div class="flex items-center justify-start gap-2">
|
|
8
|
+
<div
|
|
9
|
+
class="flex items-center justify-center rounded-full bg-white p-3 dark:bg-surface-900"
|
|
10
|
+
>
|
|
11
|
+
<Icon
|
|
12
|
+
name="mage:book"
|
|
13
|
+
size="1.5em"
|
|
14
|
+
/>
|
|
15
|
+
</div>
|
|
16
|
+
<h3 class="font-semibold opacity-80">
|
|
17
|
+
{{ dataset.dataset_name }}
|
|
18
|
+
</h3>
|
|
19
|
+
</div>
|
|
20
|
+
<Button
|
|
21
|
+
v-if="langfuseDatasetUrl"
|
|
22
|
+
:label="t('evaluation.langfuse_link')"
|
|
23
|
+
icon="pi pi-external-link"
|
|
24
|
+
icon-pos="right"
|
|
25
|
+
size="small"
|
|
26
|
+
outlined
|
|
27
|
+
as="a"
|
|
28
|
+
:href="langfuseDatasetUrl"
|
|
29
|
+
target="_blank"
|
|
30
|
+
rel="noopener noreferrer"
|
|
31
|
+
@click.stop
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
<div>
|
|
35
|
+
<span class="text-xs">
|
|
36
|
+
{{ dataset.description }}
|
|
37
|
+
</span>
|
|
38
|
+
</div>
|
|
39
|
+
<div>
|
|
40
|
+
<div class="text-sm">
|
|
41
|
+
{{ t('evaluation.dataset.created_at') }}
|
|
42
|
+
<span class="font-light">
|
|
43
|
+
{{ useDateFormat(dataset.created_at, 'DD.MM.YYYY') }}
|
|
44
|
+
</span>
|
|
45
|
+
</div>
|
|
46
|
+
<div class="text-sm">
|
|
47
|
+
{{ t('evaluation.dataset.updated_at') }}
|
|
48
|
+
<span class="font-light">
|
|
49
|
+
{{ useDateFormat(dataset.updated_at, 'DD.MM.YYYY') }}
|
|
50
|
+
</span>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<script setup lang="ts">
|
|
57
|
+
import type { MinimalDataset } from '@core/sdk/client'
|
|
58
|
+
|
|
59
|
+
const props = defineProps<{
|
|
60
|
+
dataset: MinimalDataset
|
|
61
|
+
langfuseDatasetUrl?: string
|
|
62
|
+
}>()
|
|
63
|
+
|
|
64
|
+
const route = useRoute()
|
|
65
|
+
const { t } = useI18n()
|
|
66
|
+
|
|
67
|
+
const isActive = computed(() => {
|
|
68
|
+
return route.params.dataset_id === props.dataset.id
|
|
69
|
+
})
|
|
70
|
+
</script>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<span class="mb-8 block text-surface-500 dark:text-surface-400">
|
|
4
|
+
{{ t('evaluation.dataset.create_description') }}
|
|
5
|
+
</span>
|
|
6
|
+
<div class="mb-4 flex flex-col gap-4">
|
|
7
|
+
<div class="flex flex-col">
|
|
8
|
+
<label
|
|
9
|
+
for="name"
|
|
10
|
+
class="font-semibold"
|
|
11
|
+
>
|
|
12
|
+
{{ t('evaluation.dataset.name') }}
|
|
13
|
+
</label>
|
|
14
|
+
<InputText
|
|
15
|
+
id="name"
|
|
16
|
+
v-model="dataset.dataset_name"
|
|
17
|
+
class="flex-auto"
|
|
18
|
+
autocomplete="off"
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="flex flex-col">
|
|
22
|
+
<label
|
|
23
|
+
for="description"
|
|
24
|
+
class="w-24 font-semibold"
|
|
25
|
+
>
|
|
26
|
+
{{ t('evaluation.dataset.description') }}
|
|
27
|
+
</label>
|
|
28
|
+
<Textarea
|
|
29
|
+
id="description"
|
|
30
|
+
v-model="dataset.description"
|
|
31
|
+
class="flex-auto"
|
|
32
|
+
autocomplete="off"
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
<EvaluationDatasetEdit v-model="dataset" />
|
|
36
|
+
<div class="flex justify-end gap-2">
|
|
37
|
+
<Button
|
|
38
|
+
type="button"
|
|
39
|
+
:label="t('evaluation.dataset.cancel')"
|
|
40
|
+
severity="secondary"
|
|
41
|
+
@click="close"
|
|
42
|
+
/>
|
|
43
|
+
<Button
|
|
44
|
+
type="button"
|
|
45
|
+
:label="t('evaluation.dataset.save')"
|
|
46
|
+
:disabled="!dataset.dataset_name || !dataset.description || dataset.items.length === 0"
|
|
47
|
+
@click="save"
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<script setup lang="ts">
|
|
55
|
+
import { useI18n } from 'vue-i18n'
|
|
56
|
+
|
|
57
|
+
import type { DatasetCreate } from '@core/sdk/client'
|
|
58
|
+
|
|
59
|
+
const { t } = useI18n()
|
|
60
|
+
|
|
61
|
+
const dataset = ref<DatasetCreate>({
|
|
62
|
+
dataset_name: '',
|
|
63
|
+
description: '',
|
|
64
|
+
items: [],
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
const { createDataset } = useCreateDataset()
|
|
68
|
+
const { tenantId } = useTenant()
|
|
69
|
+
|
|
70
|
+
const emit = defineEmits<{
|
|
71
|
+
close: []
|
|
72
|
+
}>()
|
|
73
|
+
|
|
74
|
+
const close = () => {
|
|
75
|
+
emit('close')
|
|
76
|
+
}
|
|
77
|
+
const save = async () => {
|
|
78
|
+
await createDataset({ dataset: dataset.value, tenantId: tenantId.value! })
|
|
79
|
+
emit('close')
|
|
80
|
+
}
|
|
81
|
+
</script>
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex flex-col gap-4">
|
|
3
|
+
<p
|
|
4
|
+
v-if="modelValue.items.length === 0"
|
|
5
|
+
class="text-sm text-surface-500 dark:text-surface-400"
|
|
6
|
+
>
|
|
7
|
+
{{ t('evaluation.dataset.add_at_least_one') }}
|
|
8
|
+
</p>
|
|
9
|
+
<DataTable
|
|
10
|
+
v-else
|
|
11
|
+
:value="modelValue.items"
|
|
12
|
+
size="small"
|
|
13
|
+
>
|
|
14
|
+
<Column
|
|
15
|
+
field="question"
|
|
16
|
+
:header="t('evaluation.dataset.question_header')"
|
|
17
|
+
/>
|
|
18
|
+
<Column
|
|
19
|
+
field="answer"
|
|
20
|
+
:header="t('evaluation.dataset.answer_header')"
|
|
21
|
+
/>
|
|
22
|
+
<Column
|
|
23
|
+
:header="t('evaluation.dataset.status')"
|
|
24
|
+
class="w-24 !text-end"
|
|
25
|
+
>
|
|
26
|
+
<template #body="{ data: item }">
|
|
27
|
+
<Tag
|
|
28
|
+
v-if="isTemporaryItem(item)"
|
|
29
|
+
:value="t('evaluation.dataset.new')"
|
|
30
|
+
severity="success"
|
|
31
|
+
/>
|
|
32
|
+
</template>
|
|
33
|
+
</Column>
|
|
34
|
+
<Column class="w-12">
|
|
35
|
+
<template #body="{ data: item }">
|
|
36
|
+
<Button
|
|
37
|
+
v-if="isTemporaryItem(item)"
|
|
38
|
+
icon="pi pi-times"
|
|
39
|
+
severity="secondary"
|
|
40
|
+
variant="text"
|
|
41
|
+
rounded
|
|
42
|
+
size="small"
|
|
43
|
+
@click="removeItem(item)"
|
|
44
|
+
/>
|
|
45
|
+
</template>
|
|
46
|
+
</Column>
|
|
47
|
+
</DataTable>
|
|
48
|
+
<div class="flex gap-2">
|
|
49
|
+
<InputGroup>
|
|
50
|
+
<InputGroupAddon>
|
|
51
|
+
<i class="pi pi-question" />
|
|
52
|
+
</InputGroupAddon>
|
|
53
|
+
<InputText
|
|
54
|
+
v-model="question"
|
|
55
|
+
:placeholder="t('evaluation.dataset.question_placeholder')"
|
|
56
|
+
@click.enter="add"
|
|
57
|
+
/>
|
|
58
|
+
</InputGroup>
|
|
59
|
+
<InputGroup>
|
|
60
|
+
<InputGroupAddon>
|
|
61
|
+
<i class="pi pi-check" />
|
|
62
|
+
</InputGroupAddon>
|
|
63
|
+
<InputText
|
|
64
|
+
v-model="answer"
|
|
65
|
+
:placeholder="t('evaluation.dataset.answer_placeholder')"
|
|
66
|
+
@click.enter="add"
|
|
67
|
+
/>
|
|
68
|
+
</InputGroup>
|
|
69
|
+
<div>
|
|
70
|
+
<Button
|
|
71
|
+
type="button"
|
|
72
|
+
:label="t('evaluation.dataset.add_button')"
|
|
73
|
+
icon="pi pi-plus"
|
|
74
|
+
:disabled="!question || !answer"
|
|
75
|
+
@click="add"
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</template>
|
|
81
|
+
|
|
82
|
+
<script setup lang="ts">
|
|
83
|
+
import { useI18n } from 'vue-i18n'
|
|
84
|
+
|
|
85
|
+
import type { Dataset, DatasetCreate, DatasetItem } from '@core/sdk/client'
|
|
86
|
+
|
|
87
|
+
const { t } = useI18n()
|
|
88
|
+
|
|
89
|
+
const props = defineProps<{
|
|
90
|
+
modelValue: Dataset | DatasetCreate
|
|
91
|
+
}>()
|
|
92
|
+
|
|
93
|
+
const emit = defineEmits<{
|
|
94
|
+
'update:modelValue': [Dataset]
|
|
95
|
+
}>()
|
|
96
|
+
|
|
97
|
+
const dataset = ref<Dataset | DatasetCreate>(props.modelValue)
|
|
98
|
+
watch(() => props.modelValue, (newValue: Dataset | DatasetCreate) => {
|
|
99
|
+
dataset.value = newValue
|
|
100
|
+
}, { deep: true })
|
|
101
|
+
|
|
102
|
+
const question = ref('')
|
|
103
|
+
const answer = ref('')
|
|
104
|
+
const add = () => {
|
|
105
|
+
if (!question.value || !answer.value) {
|
|
106
|
+
return
|
|
107
|
+
}
|
|
108
|
+
if (!dataset.value.items) {
|
|
109
|
+
dataset.value.items = []
|
|
110
|
+
}
|
|
111
|
+
dataset.value.items.push({
|
|
112
|
+
question: question.value,
|
|
113
|
+
answer: answer.value,
|
|
114
|
+
id: `tmp-${new Date().getTime()}`,
|
|
115
|
+
})
|
|
116
|
+
question.value = ''
|
|
117
|
+
answer.value = ''
|
|
118
|
+
emit('update:modelValue', dataset.value)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const removeItem = (itemToRemove: DatasetItem) => {
|
|
122
|
+
if (!dataset.value.items) return
|
|
123
|
+
dataset.value.items = dataset.value.items.filter(
|
|
124
|
+
(datasetItem: DatasetItem) => datasetItem.id !== itemToRemove.id,
|
|
125
|
+
)
|
|
126
|
+
emit('update:modelValue', dataset.value)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const isTemporaryItem = (item: DatasetItem) => {
|
|
130
|
+
return !item.id || item.id.startsWith('tmp')
|
|
131
|
+
}
|
|
132
|
+
</script>
|