@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.
Files changed (313) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +479 -0
  3. package/app.config.ts +1 -0
  4. package/app.vue +52 -0
  5. package/assets/css/main.css +4 -0
  6. package/assets/images/logo.png +0 -0
  7. package/components/Agent/Avatar.vue +40 -0
  8. package/components/Agent/Card.vue +139 -0
  9. package/components/Agent/Configuration.vue +20 -0
  10. package/components/Agent/CreateModal.vue +287 -0
  11. package/components/Agent/EmptyCard.vue +35 -0
  12. package/components/Agent/List.vue +85 -0
  13. package/components/Agent/TemplateCard.vue +58 -0
  14. package/components/AppLoader.vue +55 -0
  15. package/components/Chat/Message.vue +90 -0
  16. package/components/Chat/SourceNodes.vue +120 -0
  17. package/components/Chat/Thread.vue +134 -0
  18. package/components/Costs/Table.vue +56 -0
  19. package/components/Dashboard/Component/BarChart.vue +46 -0
  20. package/components/Dashboard/Component/LineChart.vue +138 -0
  21. package/components/Dashboard/Component/Number.vue +31 -0
  22. package/components/Dashboard/Grid.vue +214 -0
  23. package/components/Dashboard/Item.vue +75 -0
  24. package/components/Dashboard/Trend.vue +34 -0
  25. package/components/Display/List/DisplayList.vue +93 -0
  26. package/components/Evaluation/Dataset/Card.vue +70 -0
  27. package/components/Evaluation/Dataset/Create.vue +81 -0
  28. package/components/Evaluation/Dataset/Edit.vue +132 -0
  29. package/components/Event/Display/AddMemoryToChatHistoryEvent.vue +60 -0
  30. package/components/Event/Display/AgentInTheLoopRequestEvent.vue +56 -0
  31. package/components/Event/Display/AgentInTheLoopResponseEvent.vue +17 -0
  32. package/components/Event/Display/Base.vue +125 -0
  33. package/components/Event/Display/BaseRetrieveMemoryEvent.vue +101 -0
  34. package/components/Event/Display/BaseStoreMemoryEvent.vue +182 -0
  35. package/components/Event/Display/ChunkEvent.vue +40 -0
  36. package/components/Event/Display/EmbeddingEvent.vue +25 -0
  37. package/components/Event/Display/ExceptionEvent.vue +21 -0
  38. package/components/Event/Display/GuardAcceptEvent.vue +25 -0
  39. package/components/Event/Display/GuardEvent.vue +17 -0
  40. package/components/Event/Display/GuardRejectionEvent.vue +25 -0
  41. package/components/Event/Display/HumanInTheLoopRequestEvent.vue +53 -0
  42. package/components/Event/Display/HumanInTheLoopResponseEvent.vue +40 -0
  43. package/components/Event/Display/LLMCostEvent.vue +25 -0
  44. package/components/Event/Display/LLMEvent.vue +92 -0
  45. package/components/Event/Display/LimitChatHistoryEvent.vue +60 -0
  46. package/components/Event/Display/RAGFailureStopEvent.vue +28 -0
  47. package/components/Event/Display/RAGStartEvent.vue +77 -0
  48. package/components/Event/Display/RAGSuccessStopEvent.vue +16 -0
  49. package/components/Event/Display/RawDataContent.vue +69 -0
  50. package/components/Event/Display/RerankerEvent.vue +39 -0
  51. package/components/Event/Display/RetrieverEvent.vue +22 -0
  52. package/components/Event/Display/RouterEvent.vue +54 -0
  53. package/components/Event/Display/StandaloneQuestionCondenserEvent.vue +38 -0
  54. package/components/Event/Display/StopEvent.vue +16 -0
  55. package/components/Event/Display/ThoughtEvent.vue +20 -0
  56. package/components/Event/Display/ToolEvent.vue +38 -0
  57. package/components/Event/Display/UnknownEvent.vue +17 -0
  58. package/components/Event/Display/UserMessageEvent.vue +35 -0
  59. package/components/Event/List/EventList.vue +249 -0
  60. package/components/Event/Statistics.vue +49 -0
  61. package/components/Event/Timeseries.vue +224 -0
  62. package/components/FormKit/AgentSelector.vue +307 -0
  63. package/components/FormKit/ChipsInput.vue +62 -0
  64. package/components/FormKit/DynamicConfiguration.vue +155 -0
  65. package/components/FormKit/IconSelector.vue +72 -0
  66. package/components/FormKit/KnowledgeDatabaseSelector.vue +92 -0
  67. package/components/FormKit/LocaleInput.vue +150 -0
  68. package/components/FormKit/ModelSelect.vue +110 -0
  69. package/components/FormKit/Repeater.vue +93 -0
  70. package/components/FormKit/VectorStoreInput.vue +247 -0
  71. package/components/Knowledge/Document/List.vue +140 -0
  72. package/components/Knowledge/Document/Overview.vue +28 -0
  73. package/components/Knowledge/Document/UploadModal.vue +298 -0
  74. package/components/Knowledge/Document/WithNodes.vue +105 -0
  75. package/components/Knowledge/Namespace/Card.vue +108 -0
  76. package/components/Knowledge/Namespace/CreateModal.vue +203 -0
  77. package/components/Knowledge/Namespace/EditModal.vue +134 -0
  78. package/components/Knowledge/Namespace/EmptyCard.vue +35 -0
  79. package/components/Knowledge/Node/Content.vue +71 -0
  80. package/components/Markdown/Renderer.vue +87 -0
  81. package/components/Memory/DetailPage.vue +48 -0
  82. package/components/Memory/Edit.vue +241 -0
  83. package/components/Memory/Graph.vue +318 -0
  84. package/components/Memory/List.vue +155 -0
  85. package/components/Memory/MemoryManagementPage.vue +178 -0
  86. package/components/Memory/OpenWebUIContent.vue +96 -0
  87. package/components/Memory/PageLayout.vue +72 -0
  88. package/components/Models/ModelDetailsPanel.vue +250 -0
  89. package/components/Models/NamespaceCard.vue +79 -0
  90. package/components/Navigation/Left.vue +85 -0
  91. package/components/Navigation/Top.vue +31 -0
  92. package/components/Notification/Item.vue +88 -0
  93. package/components/Notification/NotificationsOverlay.vue +164 -0
  94. package/components/Process/Card.vue +119 -0
  95. package/components/Process/Configuration.vue +20 -0
  96. package/components/Process/CreateModal.vue +276 -0
  97. package/components/Process/EmptyCard.vue +35 -0
  98. package/components/Process/Form.vue +153 -0
  99. package/components/Process/Starts.vue +44 -0
  100. package/components/Process/Walkthrough/List.vue +162 -0
  101. package/components/Role/AccessRulesEditor.vue +132 -0
  102. package/components/Role/Card.vue +68 -0
  103. package/components/Role/Create.vue +55 -0
  104. package/components/Role/Edit.vue +82 -0
  105. package/components/Role/UsageLimitsEditor.vue +225 -0
  106. package/components/Service/Selection.vue +148 -0
  107. package/components/Structural/Column.vue +74 -0
  108. package/components/Structural/Screen.vue +10 -0
  109. package/components/Structural/Substructure.vue +5 -0
  110. package/components/Tenant/Switcher.vue +102 -0
  111. package/components/Thread/Details.vue +135 -0
  112. package/components/Thread/Hierarchy.vue +136 -0
  113. package/components/Thread/Info.vue +41 -0
  114. package/components/Thread/List.vue +136 -0
  115. package/components/User/Bar.vue +74 -0
  116. package/components/User/List.vue +86 -0
  117. package/components/User/RoleChips.vue +83 -0
  118. package/components/User/Settings.vue +79 -0
  119. package/components/Workflow/Modal.vue +39 -0
  120. package/components/Workflow/NodeCard.vue +41 -0
  121. package/components/Workflow/StartNode.vue +24 -0
  122. package/components/Workflow/StepNode.vue +27 -0
  123. package/components/Workflow/StopNode.vue +24 -0
  124. package/components/Workflow/Visualization.vue +265 -0
  125. package/components/mdc/MarkdownFigure.vue +9 -0
  126. package/components/mdc/MarkdownTable.vue +9 -0
  127. package/components/mdc/ResolveImageComponent.vue +58 -0
  128. package/composables/agent/useAgentClass.ts +27 -0
  129. package/composables/agent/useAgentClassInstances.ts +27 -0
  130. package/composables/agent/useAgentClasses.ts +27 -0
  131. package/composables/agent/useAgentIconFromThread.ts +8 -0
  132. package/composables/agent/useAgentInstance.ts +28 -0
  133. package/composables/agent/useAgentInstanceThreads.ts +76 -0
  134. package/composables/agent/useAgentInstances.ts +25 -0
  135. package/composables/agent/useAgentNavigation.ts +35 -0
  136. package/composables/agent/useCreateAgentInstance.ts +33 -0
  137. package/composables/agent/useDeleteAgentInstance.ts +31 -0
  138. package/composables/agent/useUpdateAgentInstance.ts +40 -0
  139. package/composables/auth/useAuth.ts +54 -0
  140. package/composables/auth/useAuthProviders.ts +14 -0
  141. package/composables/chat/useChatCompletions.ts +30 -0
  142. package/composables/dashboard/useAgentNameFromDashboardWidget.ts +27 -0
  143. package/composables/dashboard/useDashboardComponent.ts +27 -0
  144. package/composables/dashboard/useSaveDashboard.ts +21 -0
  145. package/composables/document/useCreateNamespace.ts +26 -0
  146. package/composables/document/useDatabases.ts +23 -0
  147. package/composables/document/useDocument.ts +29 -0
  148. package/composables/document/useDocumentUrl.ts +20 -0
  149. package/composables/document/useDocuments.ts +107 -0
  150. package/composables/document/useNodes.ts +29 -0
  151. package/composables/document/useSummaryNodes.ts +32 -0
  152. package/composables/document/useUpdateNamespace.ts +22 -0
  153. package/composables/evaluation/useCreateDataset.ts +19 -0
  154. package/composables/evaluation/useDataset.ts +26 -0
  155. package/composables/evaluation/useDatasets.ts +25 -0
  156. package/composables/evaluation/useUpdateDataset.ts +23 -0
  157. package/composables/event/useBasicEventStatistics.ts +83 -0
  158. package/composables/event/useEventColor.ts +25 -0
  159. package/composables/event/useEventComponent.ts +87 -0
  160. package/composables/event/useEventTimeseries.ts +39 -0
  161. package/composables/event/useEventTimeseriesStats.ts +26 -0
  162. package/composables/file/useFileUpload.ts +91 -0
  163. package/composables/file/useSupportedFileTypes.ts +22 -0
  164. package/composables/form/useCreateInstanceForm.ts +251 -0
  165. package/composables/form/useFormKitTransform.ts +753 -0
  166. package/composables/memory/useMemoryCRUD.ts +88 -0
  167. package/composables/memory/useMemoryFactory.ts +319 -0
  168. package/composables/memory/useMemorySearchFilter.ts +74 -0
  169. package/composables/models/useModelsList.ts +24 -0
  170. package/composables/models/useSingleModel.ts +30 -0
  171. package/composables/notification/useNotificationPoller.ts +58 -0
  172. package/composables/notification/useNotifications.ts +57 -0
  173. package/composables/notification/useUpdateMultipleNotifications.ts +17 -0
  174. package/composables/notification/useUpdateNotification.ts +17 -0
  175. package/composables/process/useCreateProcessInstance.ts +32 -0
  176. package/composables/process/useDeleteProcessInstance.ts +31 -0
  177. package/composables/process/useProcessClasses.ts +27 -0
  178. package/composables/process/useProcessInstance.ts +28 -0
  179. package/composables/process/useProcessInstances.ts +27 -0
  180. package/composables/process/useProcessWalkthroughs.ts +73 -0
  181. package/composables/process/useSendProcessStartForm.ts +43 -0
  182. package/composables/process/useUpdateProcessInstance.ts +40 -0
  183. package/composables/role/useCreateRole.ts +19 -0
  184. package/composables/role/useDeleteRole.ts +21 -0
  185. package/composables/role/useRole.ts +30 -0
  186. package/composables/role/useRoles.ts +25 -0
  187. package/composables/role/useUpdateRole.ts +22 -0
  188. package/composables/suite/useApps.ts +31 -0
  189. package/composables/suite/useSuite.ts +26 -0
  190. package/composables/tenant/useActiveTenant.ts +27 -0
  191. package/composables/tenant/useSysadminNavigation.ts +19 -0
  192. package/composables/tenant/useTenant.ts +38 -0
  193. package/composables/tenant/useTenantMemberships.ts +15 -0
  194. package/composables/tenant/useTenantPath.ts +20 -0
  195. package/composables/tenant/useTenantPolling.ts +30 -0
  196. package/composables/tenant/useTenantReady.ts +12 -0
  197. package/composables/theme/useDarkMode.ts +5 -0
  198. package/composables/thread/useThread.ts +27 -0
  199. package/composables/thread/useThreadEvents.ts +91 -0
  200. package/composables/thread/useThreadUtils.ts +49 -0
  201. package/composables/thread/useThreads.ts +64 -0
  202. package/composables/thread/useThreadsInfinite.ts +56 -0
  203. package/composables/translation/useTranslate.ts +20 -0
  204. package/composables/useRouteReady.ts +21 -0
  205. package/composables/useTimeAgo.ts +40 -0
  206. package/composables/user/useAssignRoleToUser.ts +22 -0
  207. package/composables/user/useMyUser.ts +25 -0
  208. package/composables/user/useRevokeRoleFromUser.ts +21 -0
  209. package/composables/user/useUser.ts +30 -0
  210. package/composables/user/useUsers.ts +63 -0
  211. package/composables/utils/useJsonTree.ts +138 -0
  212. package/formkit.config.ts +44 -0
  213. package/i18n/locales/de.yaml +815 -0
  214. package/i18n/locales/en.yaml +804 -0
  215. package/i18n/locales/fr.yaml +812 -0
  216. package/i18n/locales/it.yaml +808 -0
  217. package/layouts/anonymous.vue +8 -0
  218. package/layouts/default.vue +116 -0
  219. package/middleware/auth.global.ts +62 -0
  220. package/nuxt.config.ts +145 -0
  221. package/package.json +114 -0
  222. package/pages/[tenant]/index.vue +31 -0
  223. package/pages/[tenant]/notifications/index.vue +235 -0
  224. package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/chat.vue +67 -0
  225. package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/configuration.vue +122 -0
  226. package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/memories/[memory_id].vue +3 -0
  227. package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/memories.vue +20 -0
  228. package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/overview.vue +72 -0
  229. package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/threads.vue +52 -0
  230. package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/workflow.vue +19 -0
  231. package/pages/[tenant]/service/agents/[agent_class]-[agent_id].vue +63 -0
  232. package/pages/[tenant]/service/agents/templates.vue +102 -0
  233. package/pages/[tenant]/service/agents.vue +185 -0
  234. package/pages/[tenant]/service/datasets/[dataset_id].vue +81 -0
  235. package/pages/[tenant]/service/datasets.vue +53 -0
  236. package/pages/[tenant]/service/health/index.vue +3 -0
  237. package/pages/[tenant]/service/knowledge/[db]/[namespace]/[document_id]/nodes.vue +20 -0
  238. package/pages/[tenant]/service/knowledge/[db]/[namespace]/[document_id]/overview.vue +40 -0
  239. package/pages/[tenant]/service/knowledge/[db]/[namespace]/[document_id]/summary.vue +88 -0
  240. package/pages/[tenant]/service/knowledge/[db]/[namespace]/[document_id].vue +48 -0
  241. package/pages/[tenant]/service/knowledge/[db]/[namespace].vue +144 -0
  242. package/pages/[tenant]/service/knowledge.vue +126 -0
  243. package/pages/[tenant]/service/models/[model_name].vue +84 -0
  244. package/pages/[tenant]/service/models.vue +61 -0
  245. package/pages/[tenant]/service/my-account.vue +117 -0
  246. package/pages/[tenant]/service/openai/[thread_id]/[display_id]/memories.vue +66 -0
  247. package/pages/[tenant]/service/openai/[thread_id]/[display_id]/sources.vue +100 -0
  248. package/pages/[tenant]/service/openai/[thread_id]/[display_id]/tracing.vue +49 -0
  249. package/pages/[tenant]/service/openai.vue +101 -0
  250. package/pages/[tenant]/service/organization-memories/graph.vue +97 -0
  251. package/pages/[tenant]/service/organization-memories/list/[memory_id].vue +3 -0
  252. package/pages/[tenant]/service/organization-memories/list.vue +150 -0
  253. package/pages/[tenant]/service/organization-memories.vue +3 -0
  254. package/pages/[tenant]/service/processes/[process_class]-[process_id]/[process_walkthrough_id].vue +7 -0
  255. package/pages/[tenant]/service/processes/[process_class]-[process_id]/configuration.vue +106 -0
  256. package/pages/[tenant]/service/processes/[process_class]-[process_id]/overview.vue +67 -0
  257. package/pages/[tenant]/service/processes/[process_class]-[process_id]/start.vue +26 -0
  258. package/pages/[tenant]/service/processes/[process_class]-[process_id]/walkthroughs/[process_walkthrough_id]/overview.vue +14 -0
  259. package/pages/[tenant]/service/processes/[process_class]-[process_id]/walkthroughs.vue +54 -0
  260. package/pages/[tenant]/service/processes/[process_class]-[process_id].vue +60 -0
  261. package/pages/[tenant]/service/processes.vue +129 -0
  262. package/pages/[tenant]/service/roles/[role_id].vue +54 -0
  263. package/pages/[tenant]/service/roles.vue +84 -0
  264. package/pages/[tenant]/service/threads/[thread_id]/chat.vue +51 -0
  265. package/pages/[tenant]/service/threads/[thread_id]/display/[display_id].vue +21 -0
  266. package/pages/[tenant]/service/threads/[thread_id]/display.vue +29 -0
  267. package/pages/[tenant]/service/threads/[thread_id]/hierarchy.vue +14 -0
  268. package/pages/[tenant]/service/threads/[thread_id]/memories/[memory_id].vue +3 -0
  269. package/pages/[tenant]/service/threads/[thread_id]/memories.vue +19 -0
  270. package/pages/[tenant]/service/threads/[thread_id]/overview.vue +100 -0
  271. package/pages/[tenant]/service/threads/[thread_id].vue +54 -0
  272. package/pages/[tenant]/service/threads.vue +52 -0
  273. package/pages/[tenant]/service/user-memories/graph.vue +97 -0
  274. package/pages/[tenant]/service/user-memories/list/[memory_id].vue +3 -0
  275. package/pages/[tenant]/service/user-memories/list.vue +150 -0
  276. package/pages/[tenant]/service/user-memories.vue +3 -0
  277. package/pages/[tenant]/service/users/[user_id].vue +117 -0
  278. package/pages/[tenant]/service/users.vue +88 -0
  279. package/pages/auth/callback.vue +52 -0
  280. package/pages/auth/login.vue +80 -0
  281. package/pages/auth/renew.vue +24 -0
  282. package/pages/index.vue +59 -0
  283. package/pages/select-tenant.vue +76 -0
  284. package/plugins/0.runtime-config.client.ts +55 -0
  285. package/plugins/apexcharts.client.ts +5 -0
  286. package/plugins/api-client.client.ts +38 -0
  287. package/plugins/dark-mode.client.ts +12 -0
  288. package/plugins/keycloak-client.ts +41 -0
  289. package/plugins/oidc-client.ts +78 -0
  290. package/sdk/client/client/client.gen.ts +237 -0
  291. package/sdk/client/client/index.ts +24 -0
  292. package/sdk/client/client/types.gen.ts +213 -0
  293. package/sdk/client/client/utils.gen.ts +407 -0
  294. package/sdk/client/client.gen.ts +25 -0
  295. package/sdk/client/core/auth.gen.ts +42 -0
  296. package/sdk/client/core/bodySerializer.gen.ts +96 -0
  297. package/sdk/client/core/params.gen.ts +181 -0
  298. package/sdk/client/core/pathSerializer.gen.ts +180 -0
  299. package/sdk/client/core/queryKeySerializer.gen.ts +136 -0
  300. package/sdk/client/core/serverSentEvents.gen.ts +265 -0
  301. package/sdk/client/core/types.gen.ts +118 -0
  302. package/sdk/client/core/utils.gen.ts +143 -0
  303. package/sdk/client/index.ts +1013 -0
  304. package/sdk/client/schemas.gen.ts +35395 -0
  305. package/sdk/client/sdk.gen.ts +3438 -0
  306. package/sdk/client/transformers.gen.ts +143 -0
  307. package/sdk/client/types.gen.ts +27567 -0
  308. package/tailwind.config.mjs +27 -0
  309. package/themes/aihub-theme.ts +125 -0
  310. package/types/DashboardWidget.ts +13 -0
  311. package/types/EventChartInput.ts +7 -0
  312. package/types/NavItem.ts +6 -0
  313. package/types/TimeseriesInput.ts +7 -0
@@ -0,0 +1,40 @@
1
+ import { updateAgentInstance } from '@core/sdk/client'
2
+
3
+ export const useUpdateAgentInstance = defineMutation(() => {
4
+ const queryCache = useQueryCache()
5
+
6
+ const { mutateAsync: updateAgentInstanceMutation, isPending: isUpdating } = useMutation({
7
+ mutation: async ({
8
+ agentClass,
9
+ agentId,
10
+ tenantId,
11
+ configuration,
12
+ }: {
13
+ agentClass: string
14
+ agentId: string
15
+ tenantId: string
16
+ configuration: Record<string, unknown>
17
+ }) => {
18
+ const result = await updateAgentInstance({
19
+ composable: '$fetch',
20
+ path: {
21
+ tenant_id: tenantId,
22
+ agent_class: agentClass,
23
+ agent_id: agentId,
24
+ },
25
+ body: {
26
+ configuration,
27
+ },
28
+ })
29
+ queryCache.invalidateQueries({ key: ['tenant', tenantId, 'agent-instances', agentClass, agentId] })
30
+ queryCache.invalidateQueries({ key: ['tenant', tenantId, 'agent-instances'] })
31
+ queryCache.invalidateQueries({ key: ['tenant', tenantId, 'agent-class-instances', agentClass] })
32
+ return result
33
+ },
34
+ })
35
+
36
+ return {
37
+ updateAgentInstance: updateAgentInstanceMutation,
38
+ isUpdating,
39
+ }
40
+ })
@@ -0,0 +1,54 @@
1
+ export const useAuth = () => {
2
+ const login = (idpHint?: string) => {
3
+ const { $auth } = useNuxtApp()
4
+ const extraQueryParams = idpHint ? { kc_idp_hint: idpHint } : {}
5
+ $auth.signinRedirect({ prompt: 'login', extraQueryParams })
6
+ }
7
+
8
+ const logout = async () => {
9
+ const { $auth, $keycloakClient } = useNuxtApp()
10
+ const user = await $auth.getUser()
11
+
12
+ if (user?.refresh_token) {
13
+ await $keycloakClient.logout(user.refresh_token)
14
+ .catch((error: unknown) => console.error('Keycloak session revocation failed:', error))
15
+ }
16
+
17
+ await $auth.removeUser()
18
+ navigateTo('/auth/login')
19
+ }
20
+
21
+ const getUser = async () => {
22
+ const { $auth } = useNuxtApp()
23
+ return await $auth.getUser()
24
+ }
25
+
26
+ const getToken = async () => {
27
+ const user = await getUser()
28
+ if (!user) {
29
+ throw new Error('User not logged in')
30
+ }
31
+ return user.access_token
32
+ }
33
+
34
+ const getBearer = async () => {
35
+ const token = await getToken()
36
+ return `Bearer ${token}`
37
+ }
38
+
39
+ const getHeaders = async (): Promise<Record<string, string>> => {
40
+ const bearer = await getBearer()
41
+ return {
42
+ Authorization: bearer,
43
+ }
44
+ }
45
+
46
+ return {
47
+ login,
48
+ logout,
49
+ getUser,
50
+ getToken,
51
+ getBearer,
52
+ getHeaders,
53
+ }
54
+ }
@@ -0,0 +1,14 @@
1
+ import { getAuthProviders } from '@core/sdk/client'
2
+ import { minutesToMilliseconds } from 'date-fns'
3
+
4
+ import type { AuthProviderResponse } from '@core/sdk/client'
5
+
6
+ export const useAuthProviders = defineQuery(() => {
7
+ const { data: authProviders, isPending: isLoading } = useQuery<AuthProviderResponse[]>({
8
+ key: () => ['auth-providers'],
9
+ staleTime: minutesToMilliseconds(5),
10
+ query: async () => await getAuthProviders({ composable: '$fetch' }),
11
+ })
12
+
13
+ return { authProviders, isLoading }
14
+ })
@@ -0,0 +1,30 @@
1
+ import {
2
+ type ChatCompletionAssistantMessageParam,
3
+ type ChatCompletionDeveloperMessageParam, type ChatCompletionFunctionMessageParam,
4
+ type ChatCompletionSystemMessageParam, type ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam,
5
+ chatCompletionWithAssistants,
6
+ } from '@core/sdk/client'
7
+
8
+ type MessageType = Array<ChatCompletionDeveloperMessageParam | ChatCompletionSystemMessageParam | ChatCompletionUserMessageParam | ChatCompletionAssistantMessageParam | ChatCompletionToolMessageParam | ChatCompletionFunctionMessageParam>
9
+
10
+ export const useChatCompletions = defineMutation(() => {
11
+ const { mutate: sendMessages } = useMutation({
12
+ mutation: ({ model, messages, threadId, tenantId }: { model: string, messages: MessageType, threadId: string, tenantId: string }) =>
13
+ chatCompletionWithAssistants({
14
+ composable: '$fetch',
15
+ path: { tenant_id: tenantId },
16
+ body: {
17
+ model,
18
+ messages,
19
+ stream: false,
20
+ metadata: {
21
+ thread_id: threadId,
22
+ reconstruct_history: true,
23
+ },
24
+ },
25
+ }),
26
+ })
27
+ return {
28
+ sendMessages,
29
+ }
30
+ })
@@ -0,0 +1,27 @@
1
+ import type { FullAgentInstanceDto } from '@core/sdk/client'
2
+ import type { DashboardWidget } from '@core/types/DashboardWidget'
3
+
4
+ export const useAgentNameFromDashboardWidget = (widgetData: DashboardWidget) => {
5
+ const { agentInstances } = useAgentInstances()
6
+ const { t } = useI18n()
7
+ const agentName = computed<string>(() => {
8
+ const agentId = widgetData.agent?.agentId
9
+ const agentClass = widgetData.agent?.agentClass
10
+ if (!(agentId && agentClass)) {
11
+ return t('dashboard.all_agents')
12
+ }
13
+ if (agentClass === 'UserAgent') {
14
+ return t('dashboard.users')
15
+ }
16
+ const agent = agentInstances.value?.find((instance: FullAgentInstanceDto) => {
17
+ return instance.agent_id === agentId && instance.agent_class === agentClass
18
+ })
19
+ if (!agent) {
20
+ return t('dashboard.unknown_agent')
21
+ }
22
+ return agent.agent_config.name
23
+ })
24
+ return {
25
+ agentName,
26
+ }
27
+ }
@@ -0,0 +1,27 @@
1
+ import {
2
+ DashboardComponentNumber,
3
+ DashboardComponentLineChart,
4
+ DashboardComponentBarChart,
5
+ } from '#components'
6
+
7
+ export const useDashboardComponent = () => {
8
+ const mapping = {
9
+ DashboardComponentNumber,
10
+ DashboardComponentLineChart,
11
+ DashboardComponentBarChart,
12
+ }
13
+
14
+ const resolveComponent = (name: string) => {
15
+ if (name in mapping) {
16
+ return mapping[name]
17
+ }
18
+ throw Error(`Unable to resolve component for ${name}`)
19
+ }
20
+
21
+ const componentNames = Object.keys(mapping)
22
+
23
+ return {
24
+ resolveComponent,
25
+ componentNames,
26
+ }
27
+ }
@@ -0,0 +1,21 @@
1
+ import { updateMyDashboard } from '@core/sdk/client'
2
+
3
+ import type { GridStackOptions } from 'gridstack/dist/types'
4
+
5
+ export const useSaveDashboard = () => {
6
+ const queryCache = useQueryCache()
7
+
8
+ const { mutate: saveDashboard } = useMutation({
9
+ mutation: async ({ grid, tenantId }: { grid: GridStackOptions, tenantId: string }) => {
10
+ await updateMyDashboard({
11
+ composable: '$fetch',
12
+ path: { tenant_id: tenantId },
13
+ body: grid,
14
+ })
15
+ queryCache.invalidateQueries({ key: ['tenant', tenantId, 'my_user'] })
16
+ },
17
+ })
18
+ return {
19
+ saveDashboard,
20
+ }
21
+ }
@@ -0,0 +1,26 @@
1
+ import { createNamespace, type CreateNamespaceRequest } from '@core/sdk/client'
2
+
3
+ export const useCreateNamespace = defineMutation(() => {
4
+ const queryCache = useQueryCache()
5
+ const { tenantId } = useTenant()
6
+
7
+ return useMutation({
8
+ mutation: (request: CreateNamespaceRequest & { database: string, namespace: string, tenantId: string }) =>
9
+ createNamespace({
10
+ composable: '$fetch',
11
+ body: {
12
+ folder_name: request.folder_name,
13
+ display_name: request.display_name,
14
+ description: request.description,
15
+ },
16
+ path: {
17
+ tenant_id: request.tenantId,
18
+ database: request.database,
19
+ namespace: request.namespace,
20
+ },
21
+ }),
22
+ onSuccess: () => {
23
+ queryCache.invalidateQueries({ key: ['tenant', tenantId.value, 'knowledge'] })
24
+ },
25
+ })
26
+ })
@@ -0,0 +1,23 @@
1
+ import { type DatabaseDto, getDatabases } from '@core/sdk/client'
2
+ import { minutesToMilliseconds } from 'date-fns'
3
+
4
+ export const useDatabases = defineQuery(() => {
5
+ const { tenantId } = useTenant()
6
+
7
+ const { data: databases, isPending: databasesAreLoading } = useQuery<DatabaseDto[]>({
8
+ key: () => ['tenant', tenantId.value, 'knowledge'],
9
+ staleTime: minutesToMilliseconds(5),
10
+ enabled: useTenantReady(),
11
+ query: async () => {
12
+ return await getDatabases({
13
+ composable: '$fetch',
14
+ path: { tenant_id: tenantId.value! },
15
+ })
16
+ },
17
+ })
18
+
19
+ return {
20
+ databases,
21
+ databasesAreLoading,
22
+ }
23
+ })
@@ -0,0 +1,29 @@
1
+ import { type DocumentDto, getDocumentById } from '@core/sdk/client'
2
+ import { minutesToMilliseconds } from 'date-fns'
3
+ import { useRoute } from 'vue-router'
4
+
5
+ export const useDocument = defineQuery(() => {
6
+ const route = useRoute()
7
+ const { tenantId } = useTenant()
8
+
9
+ const { data: document, isPending: documentIsLoading } = useQuery<DocumentDto>({
10
+ key: () => ['tenant', tenantId.value, 'knowledge', 'databases', route.params.db as string, 'namespaces', route.params.namespace as string, 'documents', route.params.document_id as string],
11
+ staleTime: minutesToMilliseconds(5),
12
+ enabled: useTenantReady('db', 'namespace', 'document_id'),
13
+ query: async () => {
14
+ return await getDocumentById({
15
+ composable: '$fetch',
16
+ path: {
17
+ tenant_id: tenantId.value!,
18
+ database: route.params.db as string,
19
+ namespace: route.params.namespace as string,
20
+ document_id: route.params.document_id as string,
21
+ },
22
+ })
23
+ },
24
+ })
25
+ return {
26
+ document,
27
+ documentIsLoading,
28
+ }
29
+ })
@@ -0,0 +1,20 @@
1
+ import { getDocumentUrl } from '@core/sdk/client'
2
+
3
+ export const useDocumentUrl = () => {
4
+ const getDocumentSourceUrl = async (tenantId: string, database: string, namespace: string, documentId: string): Promise<string> => {
5
+ const { url } = await getDocumentUrl({
6
+ composable: '$fetch',
7
+ path: {
8
+ tenant_id: tenantId,
9
+ database,
10
+ namespace,
11
+ document_id: documentId,
12
+ },
13
+ })
14
+ return url
15
+ }
16
+
17
+ return {
18
+ getDocumentSourceUrl,
19
+ }
20
+ }
@@ -0,0 +1,107 @@
1
+ import { type DocumentDto, getDocumentsForNamespace } from '@core/sdk/client'
2
+
3
+ export interface SortState {
4
+ field: string | null
5
+ order: 1 | -1
6
+ }
7
+
8
+ export const useDocuments = defineQuery(() => {
9
+ const route = useRoute()
10
+ const { tenantId } = useTenant()
11
+
12
+ const currentPage = ref(1)
13
+ const pageSize = ref(10)
14
+ const searchQuery = ref<string | null>(null)
15
+ const sortState = ref<SortState>({ field: null, order: 1 })
16
+
17
+ const database = computed(() => route.params.db as string)
18
+ const namespace = computed(() => route.params.namespace as string)
19
+
20
+ const documentsQuery = useQuery({
21
+ key: () => ['tenant', tenantId.value, 'knowledge', 'databases', database.value, 'namespaces', namespace.value, 'documents', { page: currentPage.value, size: pageSize.value, search: searchQuery.value, sortField: sortState.value.field, sortOrder: sortState.value.order }],
22
+ enabled: useTenantReady('db', 'namespace'),
23
+ query: async () => {
24
+ const db = database.value
25
+ const ns = namespace.value
26
+
27
+ if (!db || !ns) {
28
+ throw new Error('Database and namespace are required')
29
+ }
30
+
31
+ const pageToFetch = Math.max(1, currentPage.value)
32
+
33
+ return await getDocumentsForNamespace({
34
+ composable: '$fetch',
35
+ query: {
36
+ page: pageToFetch,
37
+ page_size: pageSize.value,
38
+ search: searchQuery.value ?? undefined,
39
+ sort_field: sortState.value.field ?? undefined,
40
+ sort_order: sortState.value.order,
41
+ },
42
+ path: {
43
+ tenant_id: tenantId.value!,
44
+ database: db,
45
+ namespace: ns,
46
+ },
47
+ })
48
+ },
49
+ placeholderData: previousData => previousData,
50
+ })
51
+
52
+ const setPageSize = (newSize: number) => {
53
+ if (newSize > 0) {
54
+ pageSize.value = newSize
55
+ currentPage.value = 1
56
+ }
57
+ }
58
+
59
+ const setPage = (newPage: number) => {
60
+ if (newPage > 0) {
61
+ currentPage.value = newPage
62
+ }
63
+ }
64
+
65
+ const setSearch = (query: string | null) => {
66
+ searchQuery.value = query?.trim() || null
67
+ currentPage.value = 1
68
+ }
69
+
70
+ const setSort = (field: string | null, order: 1 | -1 = 1) => {
71
+ sortState.value = { field, order }
72
+ currentPage.value = 1
73
+ }
74
+
75
+ const paginationMeta = computed(() => {
76
+ const data = documentsQuery.state.value?.data
77
+
78
+ return {
79
+ total: data?.total ?? 0,
80
+ currentPage: data?.page ?? currentPage.value,
81
+ pageSize: data?.page_size ?? pageSize.value,
82
+ totalPages: data?.total_pages ?? 0,
83
+ }
84
+ })
85
+
86
+ const documents = computed(() => documentsQuery.state.value?.data?.documents ?? [] as DocumentDto[])
87
+
88
+ // Only show loading on initial load, not during refetch/search when we have data
89
+ const isLoading = computed(() => documentsQuery.asyncStatus.value === 'loading' && !documentsQuery.state.value?.data)
90
+ const isFetching = computed(() => documentsQuery.asyncStatus.value === 'loading')
91
+
92
+ return {
93
+ documents,
94
+ isLoading,
95
+ isFetching,
96
+ pagination: paginationMeta,
97
+ currentPage,
98
+ pageSize,
99
+ searchQuery,
100
+ sortState,
101
+ setPage,
102
+ setPageSize,
103
+ setSearch,
104
+ setSort,
105
+ refetch: documentsQuery.refetch,
106
+ }
107
+ })
@@ -0,0 +1,29 @@
1
+ import { getNodesForDocument, type IngestedNode } from '@core/sdk/client'
2
+ import { minutesToMilliseconds } from 'date-fns'
3
+ import { useRoute } from 'vue-router'
4
+
5
+ export const useNodes = defineQuery(() => {
6
+ const route = useRoute()
7
+ const { tenantId } = useTenant()
8
+
9
+ const { data: nodes, isPending: nodesAreLoading } = useQuery<IngestedNode[]>({
10
+ key: () => ['tenant', tenantId.value, 'knowledge', 'databases', route.params.db as string, 'namespaces', route.params.namespace as string, 'documents', route.params.document_id as string, 'nodes'],
11
+ staleTime: minutesToMilliseconds(5),
12
+ enabled: useTenantReady('db', 'namespace', 'document_id'),
13
+ query: async () => {
14
+ return await getNodesForDocument({
15
+ composable: '$fetch',
16
+ path: {
17
+ tenant_id: tenantId.value!,
18
+ database: route.params.db as string,
19
+ namespace: route.params.namespace as string,
20
+ document_id: route.params.document_id as string,
21
+ },
22
+ })
23
+ },
24
+ })
25
+ return {
26
+ nodes,
27
+ nodesAreLoading,
28
+ }
29
+ })
@@ -0,0 +1,32 @@
1
+ import {
2
+ getSummaryNodesForDocument,
3
+ type NodeSummaryDto,
4
+ } from '@core/sdk/client'
5
+ import { minutesToMilliseconds } from 'date-fns'
6
+ import { useRoute } from 'vue-router'
7
+
8
+ export const useSummaryNodes = defineQuery(() => {
9
+ const route = useRoute()
10
+ const { tenantId } = useTenant()
11
+
12
+ const { data: summaryNodes, isPending: summaryNodesAreLoading } = useQuery<NodeSummaryDto[]>({
13
+ key: () => ['tenant', tenantId.value, 'knowledge', 'databases', route.params.db as string, 'namespaces', route.params.namespace as string, 'documents', route.params.document_id as string, 'summaries'],
14
+ staleTime: minutesToMilliseconds(5),
15
+ enabled: useTenantReady('db', 'namespace', 'document_id'),
16
+ query: async () => {
17
+ return await getSummaryNodesForDocument({
18
+ composable: '$fetch',
19
+ path: {
20
+ tenant_id: tenantId.value!,
21
+ database: route.params.db as string,
22
+ namespace: route.params.namespace as string,
23
+ document_id: route.params.document_id as string,
24
+ },
25
+ })
26
+ },
27
+ })
28
+ return {
29
+ summaryNodes,
30
+ summaryNodesAreLoading,
31
+ }
32
+ })
@@ -0,0 +1,22 @@
1
+ import { updateNamespace, type UpdateNamespaceRequest } from '@core/sdk/client'
2
+
3
+ export const useUpdateNamespace = defineMutation(() => {
4
+ const queryCache = useQueryCache()
5
+ const { tenantId } = useTenant()
6
+
7
+ return useMutation({
8
+ mutation: ({ database, namespace, payload, tenantId }: { database: string, namespace: string, payload: Ref<UpdateNamespaceRequest>, tenantId: string }) =>
9
+ updateNamespace({
10
+ composable: '$fetch',
11
+ path: {
12
+ tenant_id: tenantId,
13
+ database,
14
+ namespace,
15
+ },
16
+ body: payload,
17
+ }),
18
+ onSuccess: () => {
19
+ queryCache.invalidateQueries({ key: ['tenant', tenantId.value, 'knowledge'] })
20
+ },
21
+ })
22
+ })
@@ -0,0 +1,19 @@
1
+ import { createDataset as createDatasetCall, type DatasetCreate } from '@core/sdk/client'
2
+
3
+ export const useCreateDataset = () => {
4
+ const queryCache = useQueryCache()
5
+
6
+ const { mutateAsync: createDataset } = useMutation({
7
+ mutation: async ({ dataset, tenantId }: { dataset: DatasetCreate, tenantId: string }) => {
8
+ await createDatasetCall({
9
+ composable: '$fetch',
10
+ path: { tenant_id: tenantId },
11
+ body: dataset,
12
+ })
13
+ queryCache.invalidateQueries({ key: ['tenant', tenantId, 'datasets'] })
14
+ },
15
+ })
16
+ return {
17
+ createDataset,
18
+ }
19
+ }
@@ -0,0 +1,26 @@
1
+ import { type Dataset, getDataset } from '@core/sdk/client'
2
+ import { minutesToMilliseconds } from 'date-fns'
3
+
4
+ export const useDataset = defineQuery(() => {
5
+ const route = useRoute()
6
+ const { tenantId } = useTenant()
7
+
8
+ const { data: dataset, isPending: datasetIsLoading } = useQuery<Dataset>({
9
+ key: () => ['tenant', tenantId.value, 'datasets', route.params.dataset_id as string],
10
+ staleTime: minutesToMilliseconds(5),
11
+ enabled: useTenantReady('dataset_id'),
12
+ query: async () => {
13
+ return await getDataset({
14
+ composable: '$fetch',
15
+ path: {
16
+ tenant_id: tenantId.value!,
17
+ dataset_id: route.params.dataset_id as string,
18
+ },
19
+ })
20
+ },
21
+ })
22
+ return {
23
+ dataset,
24
+ datasetIsLoading,
25
+ }
26
+ })
@@ -0,0 +1,25 @@
1
+ import {
2
+ getDatasets,
3
+ type MinimalDataset,
4
+ } from '@core/sdk/client'
5
+ import { minutesToMilliseconds } from 'date-fns'
6
+
7
+ export const useDatasets = defineQuery(() => {
8
+ const { tenantId } = useTenant()
9
+
10
+ const { data: datasets, isPending: datasetsAreLoading } = useQuery<MinimalDataset[]>({
11
+ key: () => ['tenant', tenantId.value, 'datasets'],
12
+ staleTime: minutesToMilliseconds(5),
13
+ enabled: useTenantReady(),
14
+ query: async () => {
15
+ return await getDatasets({
16
+ composable: '$fetch',
17
+ path: { tenant_id: tenantId.value! },
18
+ })
19
+ },
20
+ })
21
+ return {
22
+ datasets,
23
+ datasetsAreLoading,
24
+ }
25
+ })
@@ -0,0 +1,23 @@
1
+ import { type DatasetUpdate, updateDataset as updateDatasetCall } from '@core/sdk/client'
2
+
3
+ export const useUpdateDataset = () => {
4
+ const queryCache = useQueryCache()
5
+ const route = useRoute()
6
+
7
+ const { mutateAsync: updateDataset } = useMutation({
8
+ mutation: async ({ dataset, tenantId }: { dataset: DatasetUpdate, tenantId: string }) => {
9
+ await updateDatasetCall({
10
+ composable: '$fetch',
11
+ body: dataset,
12
+ path: {
13
+ tenant_id: tenantId,
14
+ dataset_id: route.params.dataset_id as string,
15
+ },
16
+ })
17
+ queryCache.invalidateQueries({ key: ['tenant', tenantId, 'datasets'] })
18
+ },
19
+ })
20
+ return {
21
+ updateDataset,
22
+ }
23
+ }