@8wave/ai-elements 0.111.0-beta.3 → 0.111.0-beta.7
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/dist/_chunks/{Agent-Su_LDF9_.js → Agent-tE7ZJPxG.js} +80 -78
- package/dist/_chunks/Agent-tE7ZJPxG.js.map +1 -0
- package/dist/_chunks/{Document-DecVclEe.js → Document-Bmx6774B.js} +33 -21
- package/dist/_chunks/Document-Bmx6774B.js.map +1 -0
- package/dist/_chunks/Media-Cft7Pwrh.js +108 -0
- package/dist/_chunks/Media-Cft7Pwrh.js.map +1 -0
- package/dist/_chunks/{PkStreamingMarkdown-CwqsJnJJ.js → PkStreamingMarkdown-DgBS4Ebc.js} +69 -59
- package/dist/_chunks/PkStreamingMarkdown-DgBS4Ebc.js.map +1 -0
- package/dist/_chunks/{PkToolRequestGeolocation-OokLeTf1.js → PkToolRequestGeolocation-pVys3x9M.js} +2 -2
- package/dist/_chunks/{PkToolRequestGeolocation-OokLeTf1.js.map → PkToolRequestGeolocation-pVys3x9M.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-CtqKG6Yb.js → PkToolRequestOAuthConnection-BGChb_eC.js} +2 -2
- package/dist/_chunks/{PkToolRequestOAuthConnection-CtqKG6Yb.js.map → PkToolRequestOAuthConnection-BGChb_eC.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-M6jlSmyJ.js → PkToolShowArtifact-CkTBIdQd.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-M6jlSmyJ.js.map → PkToolShowArtifact-CkTBIdQd.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-D_dW59Dl.js → PkToolShowContactForm-Du7jX7K5.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-D_dW59Dl.js.map → PkToolShowContactForm-Du7jX7K5.js.map} +1 -1
- package/dist/_chunks/PkToolShowDiagram-BdmG9gm8.js.map +1 -1
- package/dist/_chunks/{PkToolShowForm-DbJHMDbt.js → PkToolShowForm-Du2nk7pq.js} +3 -3
- package/dist/_chunks/PkToolShowForm-Du2nk7pq.js.map +1 -0
- package/dist/_chunks/{PkToolShowSources-Dot-W0Mj.js → PkToolShowSources-CsHLUF4L.js} +3 -3
- package/dist/_chunks/{PkToolShowSources-Dot-W0Mj.js.map → PkToolShowSources-CsHLUF4L.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-CKxSH0Y9.js → PkToolShowSuggestedReply-D7g_qymH.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-CKxSH0Y9.js.map → PkToolShowSuggestedReply-D7g_qymH.js.map} +1 -1
- package/dist/_chunks/PkToolShowWeather-LPd3tC77.js.map +1 -1
- package/dist/_chunks/PkUrl-BPbjZJ1A.js.map +1 -1
- package/dist/_chunks/{browser-NgY6LXg-.js → browser-B0Xnbqi7.js} +726 -751
- package/dist/_chunks/browser-B0Xnbqi7.js.map +1 -0
- package/dist/_chunks/text-DbSEK8si.js.map +1 -1
- package/dist/_chunks/utils-YJ0ZOLDG.js.map +1 -1
- package/dist/ai-elements.es.js +3010 -3052
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotEmptyState.js +1 -1
- package/dist-vue/PkChatbotError.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotSteps.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewConversations.js +1 -1
- package/dist-vue/PkChatbotViewFiles.js +1 -1
- package/dist-vue/PkChatbotViewProfile.js +1 -1
- package/dist-vue/_chunks/{Agent-C8BsTAxk.js → Agent-De2gFNjR.js} +165 -176
- package/dist-vue/_chunks/Agent-De2gFNjR.js.map +1 -0
- package/dist-vue/_chunks/{Document-CaUfI_SZ.js → Document-8umjeTVS.js} +84 -72
- package/dist-vue/_chunks/Document-8umjeTVS.js.map +1 -0
- package/dist-vue/_chunks/Media-_HfFLHGD.js.map +1 -1
- package/dist-vue/_chunks/{PkChatbot-BPKSPIeC.js → PkChatbot-Di7R2CWN.js} +7 -7
- package/dist-vue/_chunks/PkChatbot-Di7R2CWN.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotEmptyState-BvaeBxhx.js → PkChatbotEmptyState-C_ITdvH7.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-BvaeBxhx.js.map → PkChatbotEmptyState-C_ITdvH7.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotError-CBP2mf-n.js → PkChatbotError-gvDpRcEz.js} +21 -19
- package/dist-vue/_chunks/PkChatbotError-gvDpRcEz.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotInput-JnHaRlfk.js → PkChatbotInput-pEl3D2O-.js} +139 -124
- package/dist-vue/_chunks/PkChatbotInput-pEl3D2O-.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotMessages-DAlkoMkY.js → PkChatbotMessages-CGALOKwe.js} +17 -17
- package/dist-vue/_chunks/PkChatbotMessages-CGALOKwe.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotSteps-rommD48p.js → PkChatbotSteps-BhFupvbz.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotSteps-rommD48p.js.map → PkChatbotSteps-BhFupvbz.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-CEqzF1G9.js → PkChatbotViewChat-DT-rAU_r.js} +6 -6
- package/dist-vue/_chunks/{PkChatbotViewChat-CEqzF1G9.js.map → PkChatbotViewChat-DT-rAU_r.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewConversations-C787v5ll.js → PkChatbotViewConversations-3LaZPFyw.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-C787v5ll.js.map → PkChatbotViewConversations-3LaZPFyw.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-CNFLt8YO.js → PkChatbotViewFiles-CTqnbsCj.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-CNFLt8YO.js.map → PkChatbotViewFiles-CTqnbsCj.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-7p0ci3qm.js → PkChatbotViewProfile-B-Mp1jGQ.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-7p0ci3qm.js.map → PkChatbotViewProfile-B-Mp1jGQ.js.map} +1 -1
- package/dist-vue/_chunks/PkRelativeTime--1cIphlA.js.map +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-D8_LwZMR.js → PkStreamingMarkdown-DIaZEedG.js} +406 -396
- package/dist-vue/_chunks/PkStreamingMarkdown-DIaZEedG.js.map +1 -0
- package/dist-vue/_chunks/PkSvgViewer-D-0M5bqg.js.map +1 -1
- package/dist-vue/_chunks/{PkToolRequestGeolocation-Bxqz9oSo.js → PkToolRequestGeolocation-Q3N3jlO8.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestGeolocation-Bxqz9oSo.js.map → PkToolRequestGeolocation-Q3N3jlO8.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-C6rXgb0s.js → PkToolRequestOAuthConnection-C0LW5Evp.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-C6rXgb0s.js.map → PkToolRequestOAuthConnection-C0LW5Evp.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-CEXdfOGG.js → PkToolShowArtifact-BCCUucVQ.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-CEXdfOGG.js.map → PkToolShowArtifact-BCCUucVQ.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-DHmzAIVF.js → PkToolShowContactForm-BXGxWSc2.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-DHmzAIVF.js.map → PkToolShowContactForm-BXGxWSc2.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-dwCVZ1up.js → PkToolShowDiagram-CZgrWvBr.js} +2 -2
- package/dist-vue/_chunks/PkToolShowDiagram-CZgrWvBr.js.map +1 -0
- package/dist-vue/_chunks/{PkToolShowEmail-CavhsPvi.js → PkToolShowEmail-DpC517Vn.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowEmail-CavhsPvi.js.map → PkToolShowEmail-DpC517Vn.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-CO5A_j9L.js → PkToolShowForm-CIZpfAGK.js} +3 -3
- package/dist-vue/_chunks/PkToolShowForm-CIZpfAGK.js.map +1 -0
- package/dist-vue/_chunks/{PkToolShowMessage-DQojxDiV.js → PkToolShowMessage-B7flxVCU.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowMessage-DQojxDiV.js.map → PkToolShowMessage-B7flxVCU.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-Cn0yewM3.js → PkToolShowProductList-B6fRtIpx.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-Cn0yewM3.js.map → PkToolShowProductList-B6fRtIpx.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-7Q5Iogxi.js → PkToolShowSources-DDZokZow.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowSources-7Q5Iogxi.js.map → PkToolShowSources-DDZokZow.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-DQFOVonE.js → PkToolShowSuggestedReply-DWLkUh2L.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-DQFOVonE.js.map → PkToolShowSuggestedReply-DWLkUh2L.js.map} +1 -1
- package/dist-vue/_chunks/PkToolShowWeather-Bzqalzh8.js.map +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-Bzkkn9GV.js → PkToolShowWebPages-DY48ee6V.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-Bzkkn9GV.js.map → PkToolShowWebPages-DY48ee6V.js.map} +1 -1
- package/dist-vue/_chunks/{PkUrl-xUBKVJCv.js → PkUrl-DSGxrEM7.js} +2 -2
- package/dist-vue/_chunks/PkUrl-DSGxrEM7.js.map +1 -0
- package/dist-vue/_chunks/{createChatbotApiClient-D9f69brW.js → createChatbotApiClient-MkaPbGWB.js} +2 -2
- package/dist-vue/_chunks/createChatbotApiClient-MkaPbGWB.js.map +1 -0
- package/dist-vue/_chunks/{useChatbotStore-9Cw_oR6J.js → useChatbotStore-BzfqjiYz.js} +6 -3
- package/dist-vue/_chunks/useChatbotStore-BzfqjiYz.js.map +1 -0
- package/dist-vue/_chunks/useDialogConfirm-KWz0ohCQ.js.map +1 -1
- package/dist-vue/_chunks/utils-Coqik0XI.js.map +1 -1
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +2 -2
- package/dist-vue/index.js +3858 -3490
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +36 -8
- package/dist-vue/packages/components/src/chat/PkAgentSettingsPanel.d.ts +20 -3
- package/dist-vue/packages/components/src/chat/PkChatButton.d.ts +3 -2
- package/dist-vue/packages/components/src/chat/PkLanguageModel.d.ts +26 -2
- package/dist-vue/packages/components/src/chat/PkLanguageModelCombobox.d.ts +53 -1
- package/dist-vue/packages/components/src/chat/PkModelOption.d.ts +19 -0
- package/dist-vue/packages/components/src/chat/PkReasoningSettings.d.ts +6 -0
- package/dist-vue/packages/components/src/chat/constants.d.ts +5 -18
- package/dist-vue/packages/components/src/chat/index.d.ts +3 -1
- package/dist-vue/packages/components/src/chat/modelCatalog.d.ts +46 -0
- package/dist-vue/packages/components/src/table/PkTableSortable.d.ts +5 -1
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +18 -0
- package/dist-vue/packages/composable/src/useChatbotError.d.ts +2 -0
- package/dist-vue/packages/models/src/schema/Agent.d.ts +70 -10
- package/dist-vue/packages/models/src/schema/Chat.d.ts +10 -0
- package/dist-vue/packages/models/src/schema/ModelProvider.d.ts +316 -0
- package/dist-vue/packages/models/src/schema/Organization.d.ts +142 -2
- package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +20 -0
- package/dist-vue/packages/models/src/schema/SubAgent.d.ts +20 -0
- package/dist-vue/packages/models/src/schema/UserOverview.d.ts +41 -0
- package/dist-vue/packages/models/src/schema/constants.d.ts +56 -91
- package/dist-vue/packages/models/src/schema/index.d.ts +1 -0
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/Agent-Su_LDF9_.js.map +0 -1
- package/dist/_chunks/Document-DecVclEe.js.map +0 -1
- package/dist/_chunks/Media-C6SOQfJZ.js +0 -122
- package/dist/_chunks/Media-C6SOQfJZ.js.map +0 -1
- package/dist/_chunks/PkStreamingMarkdown-CwqsJnJJ.js.map +0 -1
- package/dist/_chunks/PkToolShowForm-DbJHMDbt.js.map +0 -1
- package/dist/_chunks/browser-NgY6LXg-.js.map +0 -1
- package/dist-vue/_chunks/Agent-C8BsTAxk.js.map +0 -1
- package/dist-vue/_chunks/Document-CaUfI_SZ.js.map +0 -1
- package/dist-vue/_chunks/PkChatbot-BPKSPIeC.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotError-CBP2mf-n.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotInput-JnHaRlfk.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotMessages-DAlkoMkY.js.map +0 -1
- package/dist-vue/_chunks/PkStreamingMarkdown-D8_LwZMR.js.map +0 -1
- package/dist-vue/_chunks/PkToolShowDiagram-dwCVZ1up.js.map +0 -1
- package/dist-vue/_chunks/PkToolShowForm-CO5A_j9L.js.map +0 -1
- package/dist-vue/_chunks/PkUrl-xUBKVJCv.js.map +0 -1
- package/dist-vue/_chunks/createChatbotApiClient-D9f69brW.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-9Cw_oR6J.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PkChatbotError-gvDpRcEz.js","names":["$emit"],"sources":["../../../../packages/models/src/schema/StreamError.ts","../../../../packages/composable/src/useChatbotError.ts","../../../../packages/components/src/chat/PkChatbotError.vue","../../../../packages/components/src/chat/PkChatbotError.vue"],"sourcesContent":["export const STREAM_ERROR_PREFIX = 'STREAM_ERROR:'\n\nexport const StreamErrorCode = {\n GATEWAY_CONFIG: 'GATEWAY_CONFIG',\n} as const\n\nexport type StreamErrorCode =\n (typeof StreamErrorCode)[keyof typeof StreamErrorCode]\n\nexport interface StreamErrorPayload {\n reason: string\n model?: string\n [key: string]: unknown\n}\n\nexport function formatStreamError(\n code: string,\n payload: StreamErrorPayload,\n): string {\n return `${STREAM_ERROR_PREFIX}${code}:${JSON.stringify(payload)}`\n}\n\nexport function parseStreamError(\n message: string | undefined,\n): { code: string; payload: StreamErrorPayload } | undefined {\n if (!message?.startsWith(STREAM_ERROR_PREFIX)) {\n return undefined\n }\n const afterPrefix = message.slice(STREAM_ERROR_PREFIX.length)\n const colonIndex = afterPrefix.indexOf(':')\n if (colonIndex === -1) {\n return undefined\n }\n const code = afterPrefix.slice(0, colonIndex)\n try {\n const payload = JSON.parse(\n afterPrefix.slice(colonIndex + 1),\n ) as StreamErrorPayload\n return { code, payload }\n } catch {\n return undefined\n }\n}\n\nexport function matchesStreamErrorCode(\n message: string | undefined,\n code: string,\n): boolean {\n return message?.startsWith(`${STREAM_ERROR_PREFIX}${code}:`) ?? false\n}\n","import { computed, toValue, type MaybeRefOrGetter } from 'vue'\nimport {\n matchesStreamErrorCode as matchesStreamCode,\n parseStreamError,\n type StreamErrorPayload,\n} from 'models'\n\nexport type { StreamErrorPayload }\n\ntype ErrorCode =\n | 'context_length_exceeded'\n | 'entity-not-found'\n | 'rate-limit-exceeded'\n | 'origin-not-allowed'\n | 'credit-exhausted'\n | 'conversation-blocked'\n | 'bad request'\n | 'internal-server-error'\n | 'gateway-disabled'\n | 'model-unavailable'\n\nfunction matchesCode(error: Error | undefined, code: ErrorCode): boolean {\n return error?.message?.toLowerCase().includes(code) ?? false\n}\n\nexport function getStreamErrorPayload(\n error: Error | undefined,\n): StreamErrorPayload | undefined {\n return parseStreamError(error?.message)?.payload\n}\n\nexport function useChatbotError(error: MaybeRefOrGetter<Error | undefined>) {\n const isContextWindowError = computed(() =>\n matchesCode(toValue(error), 'context_length_exceeded'),\n )\n const isNotFoundError = computed(() =>\n matchesCode(toValue(error), 'entity-not-found'),\n )\n const isRateLimitError = computed(() =>\n matchesCode(toValue(error), 'rate-limit-exceeded'),\n )\n const isOriginNotAllowedError = computed(() =>\n matchesCode(toValue(error), 'origin-not-allowed'),\n )\n const isCreditExhaustedError = computed(() =>\n matchesCode(toValue(error), 'credit-exhausted'),\n )\n const isConversationBlockedError = computed(() =>\n matchesCode(toValue(error), 'conversation-blocked'),\n )\n const isBadRequestError = computed(() =>\n matchesCode(toValue(error), 'bad request'),\n )\n const isInternalServerError = computed(() =>\n matchesCode(toValue(error), 'internal-server-error'),\n )\n const isGatewayConfigError = computed(() =>\n matchesStreamCode(toValue(error)?.message, 'GATEWAY_CONFIG'),\n )\n /**\n * The organization does not use the platform gateway and this agent's\n * model is one of its. A decision, not a hiccup: retrying in ten seconds\n * gets the same answer.\n */\n const isGatewayDisabledError = computed(() =>\n matchesCode(toValue(error), 'gateway-disabled'),\n )\n /**\n * The agent's model is on the organization's endpoint, which is off, gone\n * or no longer serves it. It lasts until somebody changes the endpoint or\n * the agent, so it is not retried either.\n */\n const isModelUnavailableError = computed(() =>\n matchesCode(toValue(error), 'model-unavailable'),\n )\n\n /** Errors that trigger an automatic retry countdown */\n const isRefreshableError = computed(\n () =>\n !isContextWindowError.value &&\n !isNotFoundError.value &&\n !isOriginNotAllowedError.value &&\n !isCreditExhaustedError.value &&\n !isConversationBlockedError.value &&\n !isBadRequestError.value &&\n !isInternalServerError.value &&\n !isGatewayConfigError.value &&\n !isGatewayDisabledError.value &&\n !isModelUnavailableError.value,\n )\n\n return {\n isContextWindowError,\n isNotFoundError,\n isRateLimitError,\n isOriginNotAllowedError,\n isCreditExhaustedError,\n isConversationBlockedError,\n isBadRequestError,\n isInternalServerError,\n isGatewayConfigError,\n isGatewayDisabledError,\n isModelUnavailableError,\n isRefreshableError,\n }\n}\n","<script lang=\"ts\" setup>\n import { computed, onBeforeUnmount, ref, watch } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { useChatbotError, getStreamErrorPayload } from 'composables'\n\n const props = defineProps<{\n error?: Error\n }>()\n\n const emit = defineEmits<{\n (e: 'retry'): void\n (e: 'reset'): void\n }>()\n\n const { t: $t } = useI18n({\n useScope: 'global',\n })\n\n const {\n isContextWindowError,\n isNotFoundError,\n isRateLimitError,\n isOriginNotAllowedError,\n isCreditExhaustedError,\n isConversationBlockedError,\n isBadRequestError,\n isInternalServerError,\n isGatewayConfigError,\n isGatewayDisabledError,\n isModelUnavailableError,\n isRefreshableError,\n } = useChatbotError(() => props.error)\n\n /**\n * Nothing the user of the chat can do about: a new conversation meets the\n * same answer, so the alert offers no button, as for exhausted credit.\n */\n const isOutOfUserReach = computed(\n () =>\n isOriginNotAllowedError.value ||\n isCreditExhaustedError.value ||\n isGatewayConfigError.value ||\n isGatewayDisabledError.value ||\n isModelUnavailableError.value,\n )\n\n const errorMessage = computed(() => {\n if (isGatewayConfigError.value) {\n const payload = getStreamErrorPayload(props.error)\n if (payload?.reason === 'disallowPromptTraining') {\n return $t('message.chatErrorGatewayPromptTraining', {\n model: payload.model,\n })\n }\n if (payload?.reason === 'zeroDataRetention') {\n return $t('message.chatErrorGatewayZdr', {\n model: payload.model,\n })\n }\n return $t('message.chatErrorGeneric')\n }\n if (isContextWindowError.value) {\n return $t('message.chatErrorContextWindow')\n }\n if (isNotFoundError.value) {\n return $t('message.chatErrorNotFound')\n }\n if (isRateLimitError.value) {\n return $t('message.chatErrorRateLimit', {\n seconds: retryCountdown.value,\n })\n }\n if (isOriginNotAllowedError.value) {\n return $t('message.chatErrorOriginNotAllowed')\n }\n if (isCreditExhaustedError.value) {\n return $t('message.chatErrorCreditExhausted')\n }\n if (isGatewayDisabledError.value) {\n return $t('message.chatErrorGatewayDisabled')\n }\n if (isModelUnavailableError.value) {\n return $t('message.chatErrorModelUnavailable')\n }\n if (isConversationBlockedError.value) {\n return $t('message.chatErrorConversationBlocked')\n }\n if (isBadRequestError.value) {\n return $t('message.chatErrorBadRequest')\n }\n if (isInternalServerError.value) {\n return $t('message.chatErrorInternalServer')\n }\n return $t('message.chatErrorGeneric', { seconds: retryCountdown.value })\n })\n\n const retryCountdown = ref<number>(0)\n const retryTimer = ref<ReturnType<typeof setTimeout>>()\n\n watch(\n () => props.error,\n (error) => {\n if (retryTimer.value) {\n clearTimeout(retryTimer.value)\n }\n\n if (error && isRefreshableError.value) {\n retryCountdown.value = 10\n const tick = () => {\n retryCountdown.value--\n if (retryCountdown.value <= 0) {\n emit('retry')\n return\n }\n retryTimer.value = setTimeout(tick, 1000)\n }\n retryTimer.value = setTimeout(tick, 1000)\n } else {\n retryCountdown.value = 0\n }\n },\n { immediate: true },\n )\n\n onBeforeUnmount(() => {\n if (retryTimer.value) {\n clearTimeout(retryTimer.value)\n }\n })\n</script>\n\n<template>\n <VvAlert\n :modifiers=\"isRefreshableError ? 'warning' : 'danger'\"\n class=\"rounded-lg\">\n <!-- The modifier already paints the alert and picks its icon: tinting\n the content again, with a 32px glyph nothing else in the chat\n matches, said the same thing three times (DESIGN.md). -->\n {{ errorMessage }}\n <template v-if=\"isRefreshableError || !isOutOfUserReach\" #footer>\n <VvButton\n v-if=\"isRefreshableError\"\n icon=\"ri:reset-right-line\"\n modifiers=\"action\"\n class=\"text-12\"\n :label=\"$t('action.retryNow')\"\n @click=\"$emit('retry')\" />\n <VvButton\n v-else-if=\"!isOutOfUserReach\"\n icon=\"reload\"\n modifiers=\"action\"\n :label=\"$t('label.newChat')\"\n @click=\"$emit('reset')\" />\n </template>\n </VvAlert>\n</template>\n","<script lang=\"ts\" setup>\n import { computed, onBeforeUnmount, ref, watch } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { useChatbotError, getStreamErrorPayload } from 'composables'\n\n const props = defineProps<{\n error?: Error\n }>()\n\n const emit = defineEmits<{\n (e: 'retry'): void\n (e: 'reset'): void\n }>()\n\n const { t: $t } = useI18n({\n useScope: 'global',\n })\n\n const {\n isContextWindowError,\n isNotFoundError,\n isRateLimitError,\n isOriginNotAllowedError,\n isCreditExhaustedError,\n isConversationBlockedError,\n isBadRequestError,\n isInternalServerError,\n isGatewayConfigError,\n isGatewayDisabledError,\n isModelUnavailableError,\n isRefreshableError,\n } = useChatbotError(() => props.error)\n\n /**\n * Nothing the user of the chat can do about: a new conversation meets the\n * same answer, so the alert offers no button, as for exhausted credit.\n */\n const isOutOfUserReach = computed(\n () =>\n isOriginNotAllowedError.value ||\n isCreditExhaustedError.value ||\n isGatewayConfigError.value ||\n isGatewayDisabledError.value ||\n isModelUnavailableError.value,\n )\n\n const errorMessage = computed(() => {\n if (isGatewayConfigError.value) {\n const payload = getStreamErrorPayload(props.error)\n if (payload?.reason === 'disallowPromptTraining') {\n return $t('message.chatErrorGatewayPromptTraining', {\n model: payload.model,\n })\n }\n if (payload?.reason === 'zeroDataRetention') {\n return $t('message.chatErrorGatewayZdr', {\n model: payload.model,\n })\n }\n return $t('message.chatErrorGeneric')\n }\n if (isContextWindowError.value) {\n return $t('message.chatErrorContextWindow')\n }\n if (isNotFoundError.value) {\n return $t('message.chatErrorNotFound')\n }\n if (isRateLimitError.value) {\n return $t('message.chatErrorRateLimit', {\n seconds: retryCountdown.value,\n })\n }\n if (isOriginNotAllowedError.value) {\n return $t('message.chatErrorOriginNotAllowed')\n }\n if (isCreditExhaustedError.value) {\n return $t('message.chatErrorCreditExhausted')\n }\n if (isGatewayDisabledError.value) {\n return $t('message.chatErrorGatewayDisabled')\n }\n if (isModelUnavailableError.value) {\n return $t('message.chatErrorModelUnavailable')\n }\n if (isConversationBlockedError.value) {\n return $t('message.chatErrorConversationBlocked')\n }\n if (isBadRequestError.value) {\n return $t('message.chatErrorBadRequest')\n }\n if (isInternalServerError.value) {\n return $t('message.chatErrorInternalServer')\n }\n return $t('message.chatErrorGeneric', { seconds: retryCountdown.value })\n })\n\n const retryCountdown = ref<number>(0)\n const retryTimer = ref<ReturnType<typeof setTimeout>>()\n\n watch(\n () => props.error,\n (error) => {\n if (retryTimer.value) {\n clearTimeout(retryTimer.value)\n }\n\n if (error && isRefreshableError.value) {\n retryCountdown.value = 10\n const tick = () => {\n retryCountdown.value--\n if (retryCountdown.value <= 0) {\n emit('retry')\n return\n }\n retryTimer.value = setTimeout(tick, 1000)\n }\n retryTimer.value = setTimeout(tick, 1000)\n } else {\n retryCountdown.value = 0\n }\n },\n { immediate: true },\n )\n\n onBeforeUnmount(() => {\n if (retryTimer.value) {\n clearTimeout(retryTimer.value)\n }\n })\n</script>\n\n<template>\n <VvAlert\n :modifiers=\"isRefreshableError ? 'warning' : 'danger'\"\n class=\"rounded-lg\">\n <!-- The modifier already paints the alert and picks its icon: tinting\n the content again, with a 32px glyph nothing else in the chat\n matches, said the same thing three times (DESIGN.md). -->\n {{ errorMessage }}\n <template v-if=\"isRefreshableError || !isOutOfUserReach\" #footer>\n <VvButton\n v-if=\"isRefreshableError\"\n icon=\"ri:reset-right-line\"\n modifiers=\"action\"\n class=\"text-12\"\n :label=\"$t('action.retryNow')\"\n @click=\"$emit('retry')\" />\n <VvButton\n v-else-if=\"!isOutOfUserReach\"\n icon=\"reload\"\n modifiers=\"action\"\n :label=\"$t('label.newChat')\"\n @click=\"$emit('reset')\" />\n </template>\n </VvAlert>\n</template>\n"],"mappings":"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"}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { t as e } from "./PkStreamingMarkdown-
|
|
1
|
+
import { t as e } from "./PkStreamingMarkdown-DIaZEedG.js";
|
|
2
2
|
import { t } from "./PkChatbotFilePreview-CwiVQDF2.js";
|
|
3
3
|
import { VvButton as n, VvDropdown as r, VvDropdownAction as i, VvIcon as a } from "@volverjs/ui-vue/components";
|
|
4
|
-
import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, mergeModels as h, mergeProps as
|
|
4
|
+
import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, mergeModels as h, mergeProps as g, nextTick as _, normalizeClass as v, normalizeProps as ee, onBeforeUnmount as y, onMounted as b, openBlock as x, ref as S, renderList as te, renderSlot as C, toDisplayString as w, unref as T, useId as ne, useModel as E, useTemplateRef as D, watch as re, withCtx as O, withKeys as ie, withModifiers as ae } from "vue";
|
|
5
5
|
import { useDropZone as oe } from "@vueuse/core";
|
|
6
6
|
//#region ../../node_modules/.pnpm/autosize@6.0.1/node_modules/autosize/dist/autosize.esm.js
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
var t =
|
|
7
|
+
var k = /* @__PURE__ */ new Map();
|
|
8
|
+
function A(e) {
|
|
9
|
+
var t = k.get(e);
|
|
10
10
|
t && t.destroy();
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
var t =
|
|
12
|
+
function j(e) {
|
|
13
|
+
var t = k.get(e);
|
|
14
14
|
t && t.update();
|
|
15
15
|
}
|
|
16
|
-
var
|
|
17
|
-
typeof window > "u" ? ((
|
|
16
|
+
var M = null;
|
|
17
|
+
typeof window > "u" ? ((M = function(e) {
|
|
18
18
|
return e;
|
|
19
19
|
}).destroy = function(e) {
|
|
20
20
|
return e;
|
|
21
|
-
},
|
|
21
|
+
}, M.update = function(e) {
|
|
22
22
|
return e;
|
|
23
|
-
}) : ((
|
|
23
|
+
}) : ((M = function(e, t) {
|
|
24
24
|
return e && Array.prototype.forEach.call(e.length ? e : [e], function(e) {
|
|
25
25
|
return function(e) {
|
|
26
|
-
if (e && e.nodeName && e.nodeName === "TEXTAREA" && !
|
|
26
|
+
if (e && e.nodeName && e.nodeName === "TEXTAREA" && !k.has(e)) {
|
|
27
27
|
var t, n = null, r = window.getComputedStyle(e), i = (t = e.value, function() {
|
|
28
28
|
o({
|
|
29
29
|
testForHeightReduction: t === "" || !e.value.startsWith(t),
|
|
@@ -32,7 +32,7 @@ typeof window > "u" ? ((j = function(e) {
|
|
|
32
32
|
}), a = function(t) {
|
|
33
33
|
e.removeEventListener("autosize:destroy", a), e.removeEventListener("autosize:update", s), e.removeEventListener("input", i), window.removeEventListener("resize", s), Object.keys(t).forEach(function(n) {
|
|
34
34
|
return e.style[n] = t[n];
|
|
35
|
-
}),
|
|
35
|
+
}), k.delete(e);
|
|
36
36
|
}.bind(e, {
|
|
37
37
|
height: e.style.height,
|
|
38
38
|
resize: e.style.resize,
|
|
@@ -41,7 +41,7 @@ typeof window > "u" ? ((j = function(e) {
|
|
|
41
41
|
overflowX: e.style.overflowX,
|
|
42
42
|
wordWrap: e.style.wordWrap
|
|
43
43
|
});
|
|
44
|
-
e.addEventListener("autosize:destroy", a), e.addEventListener("autosize:update", s), e.addEventListener("input", i), window.addEventListener("resize", s), e.style.overflowX = "hidden", e.style.wordWrap = "break-word",
|
|
44
|
+
e.addEventListener("autosize:destroy", a), e.addEventListener("autosize:update", s), e.addEventListener("input", i), window.addEventListener("resize", s), e.style.overflowX = "hidden", e.style.wordWrap = "break-word", k.set(e, {
|
|
45
45
|
destroy: a,
|
|
46
46
|
update: s
|
|
47
47
|
}), s();
|
|
@@ -73,14 +73,14 @@ typeof window > "u" ? ((j = function(e) {
|
|
|
73
73
|
}(e);
|
|
74
74
|
}), e;
|
|
75
75
|
}).destroy = function(e) {
|
|
76
|
-
return e && Array.prototype.forEach.call(e.length ? e : [e], k), e;
|
|
77
|
-
}, j.update = function(e) {
|
|
78
76
|
return e && Array.prototype.forEach.call(e.length ? e : [e], A), e;
|
|
77
|
+
}, M.update = function(e) {
|
|
78
|
+
return e && Array.prototype.forEach.call(e.length ? e : [e], j), e;
|
|
79
79
|
});
|
|
80
|
-
var
|
|
80
|
+
var N = M, P = ["type"], F = {
|
|
81
81
|
key: 0,
|
|
82
82
|
class: "pk-chat-button__label"
|
|
83
|
-
},
|
|
83
|
+
}, I = /* @__PURE__ */ m({
|
|
84
84
|
__name: "PkChatButton",
|
|
85
85
|
props: {
|
|
86
86
|
icon: {},
|
|
@@ -91,13 +91,13 @@ var M = j, N = ["type"], P = {
|
|
|
91
91
|
setup(e) {
|
|
92
92
|
return (t, n) => {
|
|
93
93
|
let r = a;
|
|
94
|
-
return
|
|
95
|
-
class:
|
|
94
|
+
return x(), u("button", {
|
|
95
|
+
class: v(["pk-chat-button", [e.modifiers ? `pk-chat-button--${e.modifiers}` : void 0, { "pk-chat-button--labelled": e.label }]]),
|
|
96
96
|
type: e.type
|
|
97
97
|
}, [p(r, {
|
|
98
98
|
name: e.icon,
|
|
99
99
|
class: "pk-chat-button__icon"
|
|
100
|
-
}, null, 8, ["name"]), e.label ? (
|
|
100
|
+
}, null, 8, ["name"]), e.label ? (x(), u("span", F, w(e.label), 1)) : l("", !0)], 10, P);
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
}), se = { class: "pk-chatbot-input" }, ce = {
|
|
@@ -115,9 +115,11 @@ var M = j, N = ["type"], P = {
|
|
|
115
115
|
"onClick"
|
|
116
116
|
], pe = ["accept"], me = ["accept"], he = { class: "pk-chatbot-input__content" }, ge = [
|
|
117
117
|
"value",
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
|
|
118
|
+
"aria-label",
|
|
119
|
+
"aria-describedby",
|
|
120
|
+
"aria-invalid",
|
|
121
|
+
"placeholder"
|
|
122
|
+
], _e = ["id"], ve = { class: "opacity-60" }, L = /* @__PURE__ */ m({
|
|
121
123
|
__name: "PkChatbotInput",
|
|
122
124
|
props: /*@__PURE__*/ h({
|
|
123
125
|
placeholder: {},
|
|
@@ -143,78 +145,84 @@ var M = j, N = ["type"], P = {
|
|
|
143
145
|
"voice-start"
|
|
144
146
|
], ["update:modelValue", "update:pendingAttachments"]),
|
|
145
147
|
setup(m, { emit: h }) {
|
|
146
|
-
let
|
|
147
|
-
|
|
148
|
-
}, ve = () => {
|
|
149
|
-
B(), O.value = R.value;
|
|
148
|
+
let k = E(m, "modelValue"), A = E(m, "pendingAttachments"), j = h, M = m, P = D("textareaEl"), F = D("fileInputEl"), L = D("cameraInputEl"), R = D("formEl"), z = S(k.value ?? ""), B = null, V = () => {
|
|
149
|
+
B !== null && (clearTimeout(B), B = null);
|
|
150
150
|
}, ye = () => {
|
|
151
|
-
|
|
152
|
-
O.value = R.value, z = null;
|
|
153
|
-
}, 300);
|
|
151
|
+
V(), k.value = z.value;
|
|
154
152
|
}, be = () => {
|
|
155
|
-
|
|
153
|
+
V(), B = setTimeout(() => {
|
|
154
|
+
k.value = z.value, B = null;
|
|
155
|
+
}, 300);
|
|
156
|
+
}, xe = () => {
|
|
157
|
+
z.value = P.value?.value ?? "", be();
|
|
156
158
|
};
|
|
157
|
-
|
|
158
|
-
e !==
|
|
159
|
-
|
|
159
|
+
re(k, (e) => {
|
|
160
|
+
e !== z.value && (z.value = e ?? "", _(() => {
|
|
161
|
+
P.value && N.update(P.value);
|
|
160
162
|
}));
|
|
161
163
|
});
|
|
162
|
-
let
|
|
163
|
-
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
},
|
|
167
|
-
for (let t of e)
|
|
168
|
-
},
|
|
164
|
+
let H = s(() => M.status === "streaming"), U = s(() => M.status === "submitted"), W = s(() => H.value || U.value), G = ne(), K = s(() => z.value.length), q = s(() => M.maxMessageLength !== void 0 && K.value > M.maxMessageLength), Se = s(() => A.value.some((e) => e.state === "uploading")), J = s(() => W.value || Se.value || q.value ? !1 : z.value.trim().length > 0), Ce = "capture" in document.createElement("input"), we = s(() => M.fileUpload?.allowedMimeTypes?.join(",") ?? ""), Y = s(() => (M.fileUpload?.allowedMimeTypes ?? []).filter((e) => e.startsWith("image/")).join(",")), X = s(() => Ce && Y.value.length > 0), Z = () => {
|
|
165
|
+
F.value?.click();
|
|
166
|
+
}, Te = () => {
|
|
167
|
+
L.value?.click();
|
|
168
|
+
}, Q = (e) => {
|
|
169
|
+
for (let t of e) j("file-select", t);
|
|
170
|
+
}, Ee = (e) => {
|
|
169
171
|
let t = e.target;
|
|
170
|
-
|
|
171
|
-
},
|
|
172
|
-
let t =
|
|
173
|
-
t && URL.revokeObjectURL(t.localUrl),
|
|
174
|
-
},
|
|
175
|
-
dataTypes: s(() =>
|
|
172
|
+
Q(Array.from(t.files ?? [])), t.value = "";
|
|
173
|
+
}, De = (e) => {
|
|
174
|
+
let t = A.value.find((t) => t.id === e);
|
|
175
|
+
t && URL.revokeObjectURL(t.localUrl), A.value = A.value.filter((t) => t.id !== e);
|
|
176
|
+
}, Oe = s(() => (M.enableDragDrop ?? !0) && !!M.fileUpload?.enabled), { isOverDropZone: ke } = oe(R, {
|
|
177
|
+
dataTypes: s(() => M.fileUpload?.allowedMimeTypes ?? []),
|
|
176
178
|
onDrop: (e) => {
|
|
177
|
-
|
|
179
|
+
Oe.value && e && Q(e);
|
|
178
180
|
}
|
|
179
|
-
}),
|
|
180
|
-
|
|
181
|
-
}, $ = s(() =>
|
|
181
|
+
}), Ae = S(!0), je = () => {
|
|
182
|
+
Ae.value = !1;
|
|
183
|
+
}, $ = s(() => M.attachmentNotice ? {
|
|
182
184
|
id: "limit",
|
|
183
185
|
icon: "ri:information-line",
|
|
184
|
-
text:
|
|
185
|
-
dismiss: () =>
|
|
186
|
-
} :
|
|
186
|
+
text: M.attachmentNotice,
|
|
187
|
+
dismiss: () => j("dismiss-attachment-notice")
|
|
188
|
+
} : M.dismissableNotice && Ae.value ? {
|
|
187
189
|
id: "dismissable",
|
|
188
|
-
markdown:
|
|
189
|
-
dismiss:
|
|
190
|
-
} : null),
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
markdown: M.dismissableNotice,
|
|
191
|
+
dismiss: je
|
|
192
|
+
} : null), Me = () => {
|
|
193
|
+
R.value?.querySelector("button:focus-visible") && P.value?.focus();
|
|
194
|
+
}, Ne = () => {
|
|
195
|
+
Me(), j("stop-generation");
|
|
196
|
+
}, Pe = () => {
|
|
197
|
+
J.value && (Me(), ye(), j("submit"), z.value = "", k.value = "", _(() => {
|
|
198
|
+
P.value && (P.value.value = "", N.update(P.value));
|
|
193
199
|
}));
|
|
200
|
+
}, Fe = (e) => {
|
|
201
|
+
e.shiftKey || e.isComposing || e.keyCode === 229 || (e.preventDefault(), Pe());
|
|
194
202
|
};
|
|
195
|
-
return
|
|
196
|
-
|
|
197
|
-
}),
|
|
198
|
-
|
|
199
|
-
for (let e of
|
|
203
|
+
return b(() => {
|
|
204
|
+
P.value && N(P.value);
|
|
205
|
+
}), y(() => {
|
|
206
|
+
V(), P.value && N.destroy(P.value);
|
|
207
|
+
for (let e of A.value) URL.revokeObjectURL(e.localUrl);
|
|
200
208
|
}), (s, h) => {
|
|
201
|
-
let
|
|
202
|
-
return
|
|
209
|
+
let _ = a, y = n, b = i, S = r;
|
|
210
|
+
return x(), u("div", se, [$.value ? (x(), u("div", {
|
|
203
211
|
key: $.value.id,
|
|
204
212
|
class: "pk-chatbot-input__notice",
|
|
205
213
|
role: "status"
|
|
206
214
|
}, [
|
|
207
|
-
$.value.icon ? (
|
|
215
|
+
$.value.icon ? (x(), c(_, {
|
|
208
216
|
key: 0,
|
|
209
217
|
name: $.value.icon,
|
|
210
218
|
class: "pk-chatbot-input__notice-icon"
|
|
211
219
|
}, null, 8, ["name"])) : l("", !0),
|
|
212
|
-
$.value.markdown ? (
|
|
220
|
+
$.value.markdown ? (x(), c(e, {
|
|
213
221
|
key: 1,
|
|
214
222
|
markdown: $.value.markdown,
|
|
215
223
|
class: "wysiwyg pk-chatbot-input__notice-text"
|
|
216
|
-
}, null, 8, ["markdown"])) : (
|
|
217
|
-
$.value.dismiss ? (
|
|
224
|
+
}, null, 8, ["markdown"])) : (x(), u("span", ce, w($.value.text), 1)),
|
|
225
|
+
$.value.dismiss ? (x(), c(y, {
|
|
218
226
|
key: 3,
|
|
219
227
|
title: s.$t("action.close"),
|
|
220
228
|
modifiers: "action-quiet",
|
|
@@ -224,15 +232,15 @@ var M = j, N = ["type"], P = {
|
|
|
224
232
|
}, null, 8, ["title"])) : l("", !0)
|
|
225
233
|
])) : l("", !0), d("form", {
|
|
226
234
|
ref_key: "formEl",
|
|
227
|
-
ref:
|
|
235
|
+
ref: R,
|
|
228
236
|
class: "pk-chatbot-input__form",
|
|
229
|
-
onSubmit:
|
|
237
|
+
onSubmit: ae(Pe, ["prevent"])
|
|
230
238
|
}, [
|
|
231
|
-
|
|
239
|
+
T(ke) && Oe.value ? (x(), u("div", le, [p(_, {
|
|
232
240
|
name: "ri:upload-cloud-2-line",
|
|
233
241
|
class: "pk-chatbot-input__drop-overlay-icon"
|
|
234
|
-
}), d("span", null,
|
|
235
|
-
|
|
242
|
+
}), d("span", null, w(s.$t("action.dropFile")), 1)])) : l("", !0),
|
|
243
|
+
A.value.length ? (x(), u("div", ue, [(x(!0), u(o, null, te(A.value, (e) => (x(), c(t, {
|
|
236
244
|
key: e.id,
|
|
237
245
|
"media-type": e.file.type,
|
|
238
246
|
url: e.localUrl,
|
|
@@ -242,7 +250,7 @@ var M = j, N = ["type"], P = {
|
|
|
242
250
|
error: e.state === "error" ? e.error : void 0,
|
|
243
251
|
removable: e.state !== "uploading",
|
|
244
252
|
compact: "",
|
|
245
|
-
onRemove: (t) =>
|
|
253
|
+
onRemove: (t) => De(e.id)
|
|
246
254
|
}, null, 8, [
|
|
247
255
|
"media-type",
|
|
248
256
|
"url",
|
|
@@ -254,108 +262,115 @@ var M = j, N = ["type"], P = {
|
|
|
254
262
|
"onRemove"
|
|
255
263
|
]))), 128))])) : l("", !0),
|
|
256
264
|
d("div", de, [
|
|
257
|
-
|
|
258
|
-
m.fileUpload && m.fileUpload.enabled && (
|
|
265
|
+
C(s.$slots, "prepend"),
|
|
266
|
+
m.fileUpload && m.fileUpload.enabled && (X.value || s.$slots["additional-actions"]) ? (x(), c(S, ee(g({ key: 0 }, {
|
|
259
267
|
placement: "top-start",
|
|
260
268
|
modifiers: "menu",
|
|
261
269
|
flip: !0,
|
|
262
270
|
offset: 3
|
|
263
271
|
})), {
|
|
264
|
-
default:
|
|
272
|
+
default: O(({ init: e, toggle: t, aria: n }) => [d("button", g({ ref: (t) => e(t) }, n, {
|
|
265
273
|
class: "pk-chat-button",
|
|
266
274
|
type: "button",
|
|
267
275
|
title: s.$t("action.attachFile"),
|
|
268
|
-
disabled:
|
|
276
|
+
disabled: W.value,
|
|
269
277
|
onClick: t
|
|
270
|
-
}), [p(
|
|
278
|
+
}), [p(_, {
|
|
271
279
|
name: "ri:add-line",
|
|
272
280
|
class: "pk-chat-button__icon"
|
|
273
281
|
})], 16, fe)]),
|
|
274
|
-
items:
|
|
275
|
-
|
|
282
|
+
items: O(() => [
|
|
283
|
+
X.value ? (x(), c(b, {
|
|
276
284
|
key: 0,
|
|
277
|
-
disabled:
|
|
278
|
-
onClick:
|
|
285
|
+
disabled: W.value || m.attachmentLimitReached,
|
|
286
|
+
onClick: Te
|
|
279
287
|
}, {
|
|
280
|
-
default:
|
|
288
|
+
default: O(() => [p(_, {
|
|
281
289
|
name: "ri:camera-line",
|
|
282
290
|
class: "pk-chatbot-input__dropdown-icon"
|
|
283
|
-
}), f(" " +
|
|
291
|
+
}), f(" " + w(s.$t("action.takePhoto")), 1)]),
|
|
284
292
|
_: 1
|
|
285
293
|
}, 8, ["disabled"])) : l("", !0),
|
|
286
|
-
p(
|
|
287
|
-
disabled:
|
|
288
|
-
onClick:
|
|
294
|
+
p(b, {
|
|
295
|
+
disabled: W.value || m.attachmentLimitReached,
|
|
296
|
+
onClick: Z
|
|
289
297
|
}, {
|
|
290
|
-
default:
|
|
298
|
+
default: O(() => [p(_, {
|
|
291
299
|
name: "ri:attachment-line",
|
|
292
300
|
class: "pk-chatbot-input__dropdown-icon"
|
|
293
|
-
}), f(" " +
|
|
301
|
+
}), f(" " + w(s.$t("action.attachFile")), 1)]),
|
|
294
302
|
_: 1
|
|
295
303
|
}, 8, ["disabled"]),
|
|
296
|
-
|
|
304
|
+
C(s.$slots, "additional-actions")
|
|
297
305
|
]),
|
|
298
306
|
_: 3
|
|
299
|
-
}, 16)) : m.fileUpload && m.fileUpload.enabled ? (
|
|
307
|
+
}, 16)) : m.fileUpload && m.fileUpload.enabled ? (x(), c(I, {
|
|
300
308
|
key: 1,
|
|
301
309
|
icon: "ri:add-line",
|
|
302
310
|
title: s.$t("action.attachFile"),
|
|
303
|
-
disabled:
|
|
304
|
-
onClick:
|
|
311
|
+
disabled: W.value || m.attachmentLimitReached,
|
|
312
|
+
onClick: Z
|
|
305
313
|
}, null, 8, ["title", "disabled"])) : l("", !0),
|
|
306
|
-
m.fileUpload && m.fileUpload.enabled ? (
|
|
314
|
+
m.fileUpload && m.fileUpload.enabled ? (x(), u("input", {
|
|
307
315
|
key: 2,
|
|
308
316
|
ref_key: "fileInputEl",
|
|
309
|
-
ref:
|
|
317
|
+
ref: F,
|
|
310
318
|
type: "file",
|
|
311
319
|
hidden: "",
|
|
312
320
|
multiple: "",
|
|
313
|
-
accept:
|
|
314
|
-
onChange:
|
|
321
|
+
accept: we.value,
|
|
322
|
+
onChange: Ee
|
|
315
323
|
}, null, 40, pe)) : l("", !0),
|
|
316
|
-
m.fileUpload && m.fileUpload.enabled &&
|
|
324
|
+
m.fileUpload && m.fileUpload.enabled && X.value ? (x(), u("input", {
|
|
317
325
|
key: 3,
|
|
318
326
|
ref_key: "cameraInputEl",
|
|
319
|
-
ref:
|
|
327
|
+
ref: L,
|
|
320
328
|
type: "file",
|
|
321
329
|
capture: "environment",
|
|
322
330
|
hidden: "",
|
|
323
|
-
accept:
|
|
324
|
-
onChange:
|
|
331
|
+
accept: Y.value,
|
|
332
|
+
onChange: Ee
|
|
325
333
|
}, null, 40, me)) : l("", !0),
|
|
326
334
|
d("div", he, [d("textarea", {
|
|
327
335
|
ref_key: "textareaEl",
|
|
328
|
-
ref:
|
|
329
|
-
value:
|
|
336
|
+
ref: P,
|
|
337
|
+
value: z.value,
|
|
330
338
|
class: "pk-chatbot-input__textarea",
|
|
331
339
|
name: "message",
|
|
332
340
|
rows: "1",
|
|
341
|
+
enterkeyhint: "send",
|
|
342
|
+
"aria-label": s.$t("label.message"),
|
|
343
|
+
"aria-describedby": m.maxMessageLength ? T(G) : void 0,
|
|
344
|
+
"aria-invalid": q.value || void 0,
|
|
333
345
|
placeholder: m.placeholder,
|
|
334
|
-
onInput:
|
|
335
|
-
onKeydown:
|
|
346
|
+
onInput: xe,
|
|
347
|
+
onKeydown: ie(Fe, ["enter"])
|
|
336
348
|
}, null, 40, ge)]),
|
|
337
|
-
m.maxMessageLength ? (
|
|
349
|
+
m.maxMessageLength ? (x(), u("div", {
|
|
338
350
|
key: 4,
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
351
|
+
id: T(G),
|
|
352
|
+
class: v(["pk-chatbot-input__counter", { "pk-chatbot-input__counter--over": q.value }])
|
|
353
|
+
}, [f(w(s.$n(K.value, "integer")) + "/", 1), d("span", ve, w(s.$n(m.maxMessageLength, "integer")), 1)], 10, _e)) : l("", !0),
|
|
354
|
+
m.voiceEnabled && !H.value ? (x(), c(I, {
|
|
342
355
|
key: 5,
|
|
343
356
|
icon: "ri:mic-line",
|
|
344
357
|
title: s.$t("action.talk"),
|
|
345
|
-
disabled:
|
|
346
|
-
onClick: h[1] ||= (e) =>
|
|
358
|
+
disabled: W.value,
|
|
359
|
+
onClick: h[1] ||= (e) => j("voice-start")
|
|
347
360
|
}, null, 8, ["title", "disabled"])) : l("", !0),
|
|
348
|
-
|
|
361
|
+
H.value ? (x(), c(I, {
|
|
349
362
|
key: 6,
|
|
350
|
-
icon: "ri:stop-
|
|
363
|
+
icon: "ri:stop-fill",
|
|
364
|
+
modifiers: "primary",
|
|
351
365
|
title: s.$t("action.stop"),
|
|
352
|
-
onClick:
|
|
353
|
-
}, null, 8, ["title"])) : (
|
|
366
|
+
onClick: Ne
|
|
367
|
+
}, null, 8, ["title"])) : (x(), c(I, {
|
|
354
368
|
key: 7,
|
|
355
369
|
type: "submit",
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
370
|
+
modifiers: "primary",
|
|
371
|
+
icon: U.value ? "loading-loop" : "ri:arrow-up-line",
|
|
372
|
+
title: s.$t("action.submit"),
|
|
373
|
+
disabled: !J.value
|
|
359
374
|
}, null, 8, [
|
|
360
375
|
"icon",
|
|
361
376
|
"title",
|
|
@@ -367,6 +382,6 @@ var M = j, N = ["type"], P = {
|
|
|
367
382
|
}
|
|
368
383
|
});
|
|
369
384
|
//#endregion
|
|
370
|
-
export {
|
|
385
|
+
export { I as n, L as t };
|
|
371
386
|
|
|
372
|
-
//# sourceMappingURL=PkChatbotInput-
|
|
387
|
+
//# sourceMappingURL=PkChatbotInput-pEl3D2O-.js.map
|