@swiss-ai-hub/web 0.321.0 → 0.323.0
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/components/Event/Display/AddMemoryToChatHistoryEvent.vue +3 -3
- package/components/Event/Display/AttachedFileEvent.vue +42 -0
- package/components/Event/Display/AttachedFilesReadEvent.vue +22 -0
- package/components/Event/Display/BaseRetrieveMemoryEvent.vue +2 -2
- package/components/Event/Display/BaseStoreMemoryEvent.vue +2 -2
- package/components/Event/Display/CompleteConversationEvent.vue +35 -0
- package/components/Event/Display/ComposeContextEvent.vue +38 -0
- package/components/Event/Display/ContextComposedEvent.vue +60 -0
- package/components/Event/Display/ContextualizeConversationEvent.vue +26 -0
- package/components/Event/Display/ConversationContextualizedEvent.vue +34 -0
- package/components/Event/Display/HumanInTheLoopResponseEvent.vue +11 -1
- package/components/Event/Display/KnowledgeSearchedEvent.vue +33 -0
- package/components/Event/Display/MemoryRecalledEvent.vue +33 -0
- package/components/Event/Display/MemoryStorageRequestedEvent.vue +29 -0
- package/components/Event/Display/NotAMetaQuestionEvent.vue +20 -0
- package/components/Event/Display/Part/Facts.vue +39 -0
- package/components/Event/Display/Part/MessageList.vue +50 -0
- package/components/Event/Display/Part/ToolCalls.vue +58 -0
- package/components/Event/Display/Part/ToolLoopState.vue +36 -0
- package/components/Event/Display/ReadAttachedFilesEvent.vue +28 -0
- package/components/Event/Display/RecallMemoryEvent.vue +27 -0
- package/components/Event/Display/RunToolLoopEvent.vue +34 -0
- package/components/Event/Display/SandboxFileDisplayedEvent.vue +46 -0
- package/components/Event/Display/SearchKnowledgeEvent.vue +31 -0
- package/components/Event/Display/ToolCallApprovedEvent.vue +27 -0
- package/components/Event/Display/ToolCallsDecidedEvent.vue +24 -0
- package/components/Event/Display/ToolLoopCondensedEvent.vue +31 -0
- package/components/Event/Display/ToolLoopFinishedEvent.vue +49 -0
- package/components/Event/Display/ToolLoopIterationEvent.vue +18 -0
- package/components/Event/Display/ToolLoopStatusEvent.vue +27 -0
- package/components/Event/Display/ToolResultEvent.vue +38 -0
- package/components/Event/List/EventList.vue +1 -1
- package/components/FormKit/DynamicConfiguration.vue +6 -1
- package/components/FormKit/KnowledgeCollectionSelector.vue +281 -0
- package/components/FormKit/KnowledgeDatabaseSelector.vue +7 -0
- package/components/FormKit/LocaleInput.vue +2 -0
- package/components/FormKit/SecretFileInput.vue +181 -0
- package/components/FormKit/VectorStoreInput.vue +20 -1
- package/components/Knowledge/Database/CreateModal.vue +91 -2
- package/components/Knowledge/Database/SourceModal.vue +165 -0
- package/components/Knowledge/Document/UploadModal.vue +4 -0
- package/components/Knowledge/Namespace/Card.vue +4 -4
- package/components/Knowledge/Namespace/CreateModal.vue +1 -1
- package/components/Knowledge/Namespace/EditModal.vue +3 -4
- package/components/Role/AccessRulesEditor.vue +1 -1
- package/components/Service/Selection.vue +7 -1
- package/components/Support/IncidentButton.vue +37 -0
- package/components/Support/IncidentDialog.vue +119 -0
- package/components/User/Settings.vue +9 -8
- package/components/UserFiles/Browser.vue +361 -0
- package/components/UserFiles/MoveDialog.vue +77 -0
- package/components/UserFiles/NameDialog.vue +59 -0
- package/components/UserFiles/Preview.vue +110 -0
- package/composables/auth/useAuth.ts +19 -3
- package/composables/document/useDocumentIngestionPolling.ts +64 -0
- package/composables/document/useDocuments.ts +3 -0
- package/composables/document/useSourcePipelines.ts +23 -0
- package/composables/document/useUpdateDatabaseSource.ts +21 -0
- package/composables/event/useEventComponent.ts +46 -0
- package/composables/form/useFormKitTransform.ts +68 -17
- package/composables/openwebui/useOpenWebuiDisclaimer.ts +22 -0
- package/composables/suite/useApps.ts +12 -3
- package/composables/suite/useSuite.ts +2 -0
- package/composables/support/useIncidentAvailability.ts +17 -0
- package/composables/support/useIncidentContext.ts +56 -0
- package/composables/support/useIncidentForm.ts +45 -0
- package/composables/support/useIncidentReport.ts +16 -0
- package/composables/support/useOpenWebUIContext.ts +38 -0
- package/composables/tenant/useChatDisclaimer.ts +24 -0
- package/composables/user/useApplyLocale.ts +23 -0
- package/composables/user/useMyLocale.ts +20 -0
- package/composables/user/useRestorePreferredLocale.ts +38 -0
- package/composables/userFiles/useCreateUserFolder.ts +15 -0
- package/composables/userFiles/useDeleteUserFile.ts +15 -0
- package/composables/userFiles/useMoveUserFile.ts +15 -0
- package/composables/userFiles/useUploadUserFiles.ts +19 -0
- package/composables/userFiles/useUserFileContent.ts +24 -0
- package/composables/userFiles/useUserFiles.ts +25 -0
- package/formkit.config.ts +10 -2
- package/i18n/locales/de.yaml +171 -3
- package/i18n/locales/en.yaml +172 -3
- package/i18n/locales/fr.yaml +173 -3
- package/i18n/locales/it.yaml +173 -3
- package/layouts/default.vue +7 -1
- package/middleware/auth.global.ts +6 -3
- package/middleware/home-redirect.ts +15 -4
- package/package.json +4 -3
- package/pages/[tenant]/service/knowledge/[db]/[namespace].vue +6 -8
- package/pages/[tenant]/service/knowledge.vue +33 -7
- package/pages/[tenant]/service/openai/[thread_id]/[display_id]/files.vue +51 -0
- package/pages/[tenant]/service/openai.vue +61 -17
- package/pages/[tenant]/service/user-knowledge.vue +19 -0
- package/plugins/api-client.client.ts +5 -0
- package/plugins/oidc-client.ts +14 -7
- package/sdk/client/index.ts +171 -1
- package/sdk/client/schemas.gen.ts +18602 -8560
- package/sdk/client/sdk.gen.ts +482 -0
- package/sdk/client/types.gen.ts +13616 -7044
- package/types/EventFact.ts +4 -0
- package/utils/apiResponseGuard.ts +97 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { ToastServiceMethods } from 'primevue/toastservice'
|
|
2
|
+
|
|
3
|
+
// When the `api` container is not running, Traefik drops its router
|
|
4
|
+
// (Host && PathPrefix('/api/v1'), priority 6000) and `/api/v1/...` falls through
|
|
5
|
+
// to `web-default` (bare Host, priority 100) — the SPA nginx, whose
|
|
6
|
+
// `try_files $uri /index.html` answers 200 text/html. ofetch resolves that to
|
|
7
|
+
// responseType "text", so `_data` is the index.html source string with status
|
|
8
|
+
// 200 and no error, and Pinia-Colada caches it as a valid DTO. Consumers then
|
|
9
|
+
// read a list off it and throw inside a computed, taking the layout down.
|
|
10
|
+
//
|
|
11
|
+
// Deliberately a text/html DENYLIST rather than a JSON allowlist: the SDK
|
|
12
|
+
// generator never emits `responseType`, so createSpeech (audio/*),
|
|
13
|
+
// createTranscription (text/plain) and streaming chat completions
|
|
14
|
+
// (text/event-stream) are indistinguishable from an unannotated JSON call.
|
|
15
|
+
// Requiring JSON would break all three. No AI-Hub endpoint answers text/html.
|
|
16
|
+
const HTML_CONTENT_TYPE = /^text\/html\b/i
|
|
17
|
+
|
|
18
|
+
// Every in-flight query fails at once when the API is unreachable. One toast is
|
|
19
|
+
// a diagnosis, a dozen is noise. Module scope so both SDK clients share it.
|
|
20
|
+
const NOTIFY_THROTTLE_MS = 10_000
|
|
21
|
+
|
|
22
|
+
let lastNotifiedAt = 0
|
|
23
|
+
|
|
24
|
+
// Structural supertype of ofetch's hook context — `ofetch` itself is not
|
|
25
|
+
// resolvable from packages/web under pnpm's isolated linker.
|
|
26
|
+
type ApiResponseContext = {
|
|
27
|
+
options: { responseType?: string }
|
|
28
|
+
response: Response
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Only what the notifier reads. Structural on purpose: defineNuxtPlugin hands
|
|
32
|
+
// its callback `_NuxtApp` while useNuxtApp() returns `NuxtApp`, and both call
|
|
33
|
+
// sites satisfy this.
|
|
34
|
+
type NotifyCapableApp = {
|
|
35
|
+
vueApp: { config: { globalProperties: Record<string, unknown> } }
|
|
36
|
+
$i18n?: unknown
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export class HtmlResponseError extends Error {
|
|
40
|
+
readonly status: number
|
|
41
|
+
readonly contentType: string
|
|
42
|
+
readonly url: string
|
|
43
|
+
|
|
44
|
+
constructor(response: Response, contentType: string) {
|
|
45
|
+
super(
|
|
46
|
+
`Expected JSON from the AI-Hub API but received ${contentType} (HTTP ${response.status}, ${response.url}). `
|
|
47
|
+
+ 'The API is most likely unreachable and a proxy answered with the SPA shell.',
|
|
48
|
+
)
|
|
49
|
+
this.name = 'HtmlResponseError'
|
|
50
|
+
this.status = response.status
|
|
51
|
+
this.contentType = contentType
|
|
52
|
+
this.url = response.url
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const notifyApiUnavailable = (nuxtApp: NotifyCapableApp): void => {
|
|
57
|
+
const now = Date.now()
|
|
58
|
+
if (now - lastNotifiedAt < NOTIFY_THROTTLE_MS) return
|
|
59
|
+
|
|
60
|
+
// `useToast()` injects and needs a component instance, which an ofetch hook
|
|
61
|
+
// does not have. Read lazily so plugin ordering cannot matter.
|
|
62
|
+
const toast = nuxtApp.vueApp.config.globalProperties.$toast as ToastServiceMethods | undefined
|
|
63
|
+
if (!toast) return
|
|
64
|
+
|
|
65
|
+
lastNotifiedAt = now
|
|
66
|
+
const i18n = nuxtApp.$i18n as { t?: (key: string) => string } | undefined
|
|
67
|
+
toast.add({
|
|
68
|
+
severity: 'error',
|
|
69
|
+
summary: i18n?.t?.('http_error.code.503') ?? 'Our service is temporarily unavailable.',
|
|
70
|
+
life: 10_000,
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// `nuxtApp` is captured rather than resolved inside the hook: useNuxtApp()
|
|
75
|
+
// throws once Nuxt's async context is gone, which it is by response time.
|
|
76
|
+
export const createHtmlResponseGuard = (nuxtApp: NotifyCapableApp) => {
|
|
77
|
+
return ({ options, response }: ApiResponseContext): void => {
|
|
78
|
+
// A caller that asked for a non-JSON body knows what it is doing.
|
|
79
|
+
if (options.responseType && options.responseType !== 'json') return
|
|
80
|
+
|
|
81
|
+
// 4xx/5xx still reject through ofetch and reach onResponseError, which owns
|
|
82
|
+
// the localized toast. This hook runs BEFORE ofetch's `status >= 400`
|
|
83
|
+
// branch, so throwing here would mask a correct "404" with a generic error.
|
|
84
|
+
if (!response.ok) return
|
|
85
|
+
|
|
86
|
+
// An absent content-type (202 with an empty body) fails this test and is
|
|
87
|
+
// left alone; ofetch skips 204 bodies entirely.
|
|
88
|
+
const contentType = response.headers.get('content-type') ?? ''
|
|
89
|
+
if (!HTML_CONTENT_TYPE.test(contentType)) return
|
|
90
|
+
|
|
91
|
+
notifyApiUnavailable(nuxtApp)
|
|
92
|
+
|
|
93
|
+
// Must throw: ofetch ignores this hook's return value, so returning would
|
|
94
|
+
// leave the HTML string in `_data` for Pinia-Colada to cache as valid data.
|
|
95
|
+
throw new HtmlResponseError(response, contentType)
|
|
96
|
+
}
|
|
97
|
+
}
|