@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.
Files changed (150) hide show
  1. package/dist/_chunks/{Agent-Su_LDF9_.js → Agent-tE7ZJPxG.js} +80 -78
  2. package/dist/_chunks/Agent-tE7ZJPxG.js.map +1 -0
  3. package/dist/_chunks/{Document-DecVclEe.js → Document-Bmx6774B.js} +33 -21
  4. package/dist/_chunks/Document-Bmx6774B.js.map +1 -0
  5. package/dist/_chunks/Media-Cft7Pwrh.js +108 -0
  6. package/dist/_chunks/Media-Cft7Pwrh.js.map +1 -0
  7. package/dist/_chunks/{PkStreamingMarkdown-CwqsJnJJ.js → PkStreamingMarkdown-DgBS4Ebc.js} +69 -59
  8. package/dist/_chunks/PkStreamingMarkdown-DgBS4Ebc.js.map +1 -0
  9. package/dist/_chunks/{PkToolRequestGeolocation-OokLeTf1.js → PkToolRequestGeolocation-pVys3x9M.js} +2 -2
  10. package/dist/_chunks/{PkToolRequestGeolocation-OokLeTf1.js.map → PkToolRequestGeolocation-pVys3x9M.js.map} +1 -1
  11. package/dist/_chunks/{PkToolRequestOAuthConnection-CtqKG6Yb.js → PkToolRequestOAuthConnection-BGChb_eC.js} +2 -2
  12. package/dist/_chunks/{PkToolRequestOAuthConnection-CtqKG6Yb.js.map → PkToolRequestOAuthConnection-BGChb_eC.js.map} +1 -1
  13. package/dist/_chunks/{PkToolShowArtifact-M6jlSmyJ.js → PkToolShowArtifact-CkTBIdQd.js} +2 -2
  14. package/dist/_chunks/{PkToolShowArtifact-M6jlSmyJ.js.map → PkToolShowArtifact-CkTBIdQd.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShowContactForm-D_dW59Dl.js → PkToolShowContactForm-Du7jX7K5.js} +2 -2
  16. package/dist/_chunks/{PkToolShowContactForm-D_dW59Dl.js.map → PkToolShowContactForm-Du7jX7K5.js.map} +1 -1
  17. package/dist/_chunks/PkToolShowDiagram-BdmG9gm8.js.map +1 -1
  18. package/dist/_chunks/{PkToolShowForm-DbJHMDbt.js → PkToolShowForm-Du2nk7pq.js} +3 -3
  19. package/dist/_chunks/PkToolShowForm-Du2nk7pq.js.map +1 -0
  20. package/dist/_chunks/{PkToolShowSources-Dot-W0Mj.js → PkToolShowSources-CsHLUF4L.js} +3 -3
  21. package/dist/_chunks/{PkToolShowSources-Dot-W0Mj.js.map → PkToolShowSources-CsHLUF4L.js.map} +1 -1
  22. package/dist/_chunks/{PkToolShowSuggestedReply-CKxSH0Y9.js → PkToolShowSuggestedReply-D7g_qymH.js} +2 -2
  23. package/dist/_chunks/{PkToolShowSuggestedReply-CKxSH0Y9.js.map → PkToolShowSuggestedReply-D7g_qymH.js.map} +1 -1
  24. package/dist/_chunks/PkToolShowWeather-LPd3tC77.js.map +1 -1
  25. package/dist/_chunks/PkUrl-BPbjZJ1A.js.map +1 -1
  26. package/dist/_chunks/{browser-NgY6LXg-.js → browser-B0Xnbqi7.js} +726 -751
  27. package/dist/_chunks/browser-B0Xnbqi7.js.map +1 -0
  28. package/dist/_chunks/text-DbSEK8si.js.map +1 -1
  29. package/dist/_chunks/utils-YJ0ZOLDG.js.map +1 -1
  30. package/dist/ai-elements.es.js +3010 -3052
  31. package/dist/ai-elements.es.js.map +1 -1
  32. package/dist-vue/PkChatbot.js +1 -1
  33. package/dist-vue/PkChatbotEmptyState.js +1 -1
  34. package/dist-vue/PkChatbotError.js +1 -1
  35. package/dist-vue/PkChatbotInput.js +1 -1
  36. package/dist-vue/PkChatbotMessages.js +1 -1
  37. package/dist-vue/PkChatbotSteps.js +1 -1
  38. package/dist-vue/PkChatbotViewChat.js +1 -1
  39. package/dist-vue/PkChatbotViewConversations.js +1 -1
  40. package/dist-vue/PkChatbotViewFiles.js +1 -1
  41. package/dist-vue/PkChatbotViewProfile.js +1 -1
  42. package/dist-vue/_chunks/{Agent-C8BsTAxk.js → Agent-De2gFNjR.js} +165 -176
  43. package/dist-vue/_chunks/Agent-De2gFNjR.js.map +1 -0
  44. package/dist-vue/_chunks/{Document-CaUfI_SZ.js → Document-8umjeTVS.js} +84 -72
  45. package/dist-vue/_chunks/Document-8umjeTVS.js.map +1 -0
  46. package/dist-vue/_chunks/Media-_HfFLHGD.js.map +1 -1
  47. package/dist-vue/_chunks/{PkChatbot-BPKSPIeC.js → PkChatbot-Di7R2CWN.js} +7 -7
  48. package/dist-vue/_chunks/PkChatbot-Di7R2CWN.js.map +1 -0
  49. package/dist-vue/_chunks/{PkChatbotEmptyState-BvaeBxhx.js → PkChatbotEmptyState-C_ITdvH7.js} +2 -2
  50. package/dist-vue/_chunks/{PkChatbotEmptyState-BvaeBxhx.js.map → PkChatbotEmptyState-C_ITdvH7.js.map} +1 -1
  51. package/dist-vue/_chunks/{PkChatbotError-CBP2mf-n.js → PkChatbotError-gvDpRcEz.js} +21 -19
  52. package/dist-vue/_chunks/PkChatbotError-gvDpRcEz.js.map +1 -0
  53. package/dist-vue/_chunks/{PkChatbotInput-JnHaRlfk.js → PkChatbotInput-pEl3D2O-.js} +139 -124
  54. package/dist-vue/_chunks/PkChatbotInput-pEl3D2O-.js.map +1 -0
  55. package/dist-vue/_chunks/{PkChatbotMessages-DAlkoMkY.js → PkChatbotMessages-CGALOKwe.js} +17 -17
  56. package/dist-vue/_chunks/PkChatbotMessages-CGALOKwe.js.map +1 -0
  57. package/dist-vue/_chunks/{PkChatbotSteps-rommD48p.js → PkChatbotSteps-BhFupvbz.js} +2 -2
  58. package/dist-vue/_chunks/{PkChatbotSteps-rommD48p.js.map → PkChatbotSteps-BhFupvbz.js.map} +1 -1
  59. package/dist-vue/_chunks/{PkChatbotViewChat-CEqzF1G9.js → PkChatbotViewChat-DT-rAU_r.js} +6 -6
  60. package/dist-vue/_chunks/{PkChatbotViewChat-CEqzF1G9.js.map → PkChatbotViewChat-DT-rAU_r.js.map} +1 -1
  61. package/dist-vue/_chunks/{PkChatbotViewConversations-C787v5ll.js → PkChatbotViewConversations-3LaZPFyw.js} +2 -2
  62. package/dist-vue/_chunks/{PkChatbotViewConversations-C787v5ll.js.map → PkChatbotViewConversations-3LaZPFyw.js.map} +1 -1
  63. package/dist-vue/_chunks/{PkChatbotViewFiles-CNFLt8YO.js → PkChatbotViewFiles-CTqnbsCj.js} +3 -3
  64. package/dist-vue/_chunks/{PkChatbotViewFiles-CNFLt8YO.js.map → PkChatbotViewFiles-CTqnbsCj.js.map} +1 -1
  65. package/dist-vue/_chunks/{PkChatbotViewProfile-7p0ci3qm.js → PkChatbotViewProfile-B-Mp1jGQ.js} +2 -2
  66. package/dist-vue/_chunks/{PkChatbotViewProfile-7p0ci3qm.js.map → PkChatbotViewProfile-B-Mp1jGQ.js.map} +1 -1
  67. package/dist-vue/_chunks/PkRelativeTime--1cIphlA.js.map +1 -1
  68. package/dist-vue/_chunks/{PkStreamingMarkdown-D8_LwZMR.js → PkStreamingMarkdown-DIaZEedG.js} +406 -396
  69. package/dist-vue/_chunks/PkStreamingMarkdown-DIaZEedG.js.map +1 -0
  70. package/dist-vue/_chunks/PkSvgViewer-D-0M5bqg.js.map +1 -1
  71. package/dist-vue/_chunks/{PkToolRequestGeolocation-Bxqz9oSo.js → PkToolRequestGeolocation-Q3N3jlO8.js} +2 -2
  72. package/dist-vue/_chunks/{PkToolRequestGeolocation-Bxqz9oSo.js.map → PkToolRequestGeolocation-Q3N3jlO8.js.map} +1 -1
  73. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-C6rXgb0s.js → PkToolRequestOAuthConnection-C0LW5Evp.js} +2 -2
  74. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-C6rXgb0s.js.map → PkToolRequestOAuthConnection-C0LW5Evp.js.map} +1 -1
  75. package/dist-vue/_chunks/{PkToolShowArtifact-CEXdfOGG.js → PkToolShowArtifact-BCCUucVQ.js} +2 -2
  76. package/dist-vue/_chunks/{PkToolShowArtifact-CEXdfOGG.js.map → PkToolShowArtifact-BCCUucVQ.js.map} +1 -1
  77. package/dist-vue/_chunks/{PkToolShowContactForm-DHmzAIVF.js → PkToolShowContactForm-BXGxWSc2.js} +2 -2
  78. package/dist-vue/_chunks/{PkToolShowContactForm-DHmzAIVF.js.map → PkToolShowContactForm-BXGxWSc2.js.map} +1 -1
  79. package/dist-vue/_chunks/{PkToolShowDiagram-dwCVZ1up.js → PkToolShowDiagram-CZgrWvBr.js} +2 -2
  80. package/dist-vue/_chunks/PkToolShowDiagram-CZgrWvBr.js.map +1 -0
  81. package/dist-vue/_chunks/{PkToolShowEmail-CavhsPvi.js → PkToolShowEmail-DpC517Vn.js} +2 -2
  82. package/dist-vue/_chunks/{PkToolShowEmail-CavhsPvi.js.map → PkToolShowEmail-DpC517Vn.js.map} +1 -1
  83. package/dist-vue/_chunks/{PkToolShowForm-CO5A_j9L.js → PkToolShowForm-CIZpfAGK.js} +3 -3
  84. package/dist-vue/_chunks/PkToolShowForm-CIZpfAGK.js.map +1 -0
  85. package/dist-vue/_chunks/{PkToolShowMessage-DQojxDiV.js → PkToolShowMessage-B7flxVCU.js} +2 -2
  86. package/dist-vue/_chunks/{PkToolShowMessage-DQojxDiV.js.map → PkToolShowMessage-B7flxVCU.js.map} +1 -1
  87. package/dist-vue/_chunks/{PkToolShowProductList-Cn0yewM3.js → PkToolShowProductList-B6fRtIpx.js} +2 -2
  88. package/dist-vue/_chunks/{PkToolShowProductList-Cn0yewM3.js.map → PkToolShowProductList-B6fRtIpx.js.map} +1 -1
  89. package/dist-vue/_chunks/{PkToolShowSources-7Q5Iogxi.js → PkToolShowSources-DDZokZow.js} +4 -4
  90. package/dist-vue/_chunks/{PkToolShowSources-7Q5Iogxi.js.map → PkToolShowSources-DDZokZow.js.map} +1 -1
  91. package/dist-vue/_chunks/{PkToolShowSuggestedReply-DQFOVonE.js → PkToolShowSuggestedReply-DWLkUh2L.js} +2 -2
  92. package/dist-vue/_chunks/{PkToolShowSuggestedReply-DQFOVonE.js.map → PkToolShowSuggestedReply-DWLkUh2L.js.map} +1 -1
  93. package/dist-vue/_chunks/PkToolShowWeather-Bzqalzh8.js.map +1 -1
  94. package/dist-vue/_chunks/{PkToolShowWebPages-Bzkkn9GV.js → PkToolShowWebPages-DY48ee6V.js} +2 -2
  95. package/dist-vue/_chunks/{PkToolShowWebPages-Bzkkn9GV.js.map → PkToolShowWebPages-DY48ee6V.js.map} +1 -1
  96. package/dist-vue/_chunks/{PkUrl-xUBKVJCv.js → PkUrl-DSGxrEM7.js} +2 -2
  97. package/dist-vue/_chunks/PkUrl-DSGxrEM7.js.map +1 -0
  98. package/dist-vue/_chunks/{createChatbotApiClient-D9f69brW.js → createChatbotApiClient-MkaPbGWB.js} +2 -2
  99. package/dist-vue/_chunks/createChatbotApiClient-MkaPbGWB.js.map +1 -0
  100. package/dist-vue/_chunks/{useChatbotStore-9Cw_oR6J.js → useChatbotStore-BzfqjiYz.js} +6 -3
  101. package/dist-vue/_chunks/useChatbotStore-BzfqjiYz.js.map +1 -0
  102. package/dist-vue/_chunks/useDialogConfirm-KWz0ohCQ.js.map +1 -1
  103. package/dist-vue/_chunks/utils-Coqik0XI.js.map +1 -1
  104. package/dist-vue/api.js +1 -1
  105. package/dist-vue/composables.js +2 -2
  106. package/dist-vue/index.js +3858 -3490
  107. package/dist-vue/index.js.map +1 -1
  108. package/dist-vue/locales.js +36 -8
  109. package/dist-vue/packages/components/src/chat/PkAgentSettingsPanel.d.ts +20 -3
  110. package/dist-vue/packages/components/src/chat/PkChatButton.d.ts +3 -2
  111. package/dist-vue/packages/components/src/chat/PkLanguageModel.d.ts +26 -2
  112. package/dist-vue/packages/components/src/chat/PkLanguageModelCombobox.d.ts +53 -1
  113. package/dist-vue/packages/components/src/chat/PkModelOption.d.ts +19 -0
  114. package/dist-vue/packages/components/src/chat/PkReasoningSettings.d.ts +6 -0
  115. package/dist-vue/packages/components/src/chat/constants.d.ts +5 -18
  116. package/dist-vue/packages/components/src/chat/index.d.ts +3 -1
  117. package/dist-vue/packages/components/src/chat/modelCatalog.d.ts +46 -0
  118. package/dist-vue/packages/components/src/table/PkTableSortable.d.ts +5 -1
  119. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +18 -0
  120. package/dist-vue/packages/composable/src/useChatbotError.d.ts +2 -0
  121. package/dist-vue/packages/models/src/schema/Agent.d.ts +70 -10
  122. package/dist-vue/packages/models/src/schema/Chat.d.ts +10 -0
  123. package/dist-vue/packages/models/src/schema/ModelProvider.d.ts +316 -0
  124. package/dist-vue/packages/models/src/schema/Organization.d.ts +142 -2
  125. package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +20 -0
  126. package/dist-vue/packages/models/src/schema/SubAgent.d.ts +20 -0
  127. package/dist-vue/packages/models/src/schema/UserOverview.d.ts +41 -0
  128. package/dist-vue/packages/models/src/schema/constants.d.ts +56 -91
  129. package/dist-vue/packages/models/src/schema/index.d.ts +1 -0
  130. package/dist-vue/style.css +1 -1
  131. package/package.json +1 -1
  132. package/dist/_chunks/Agent-Su_LDF9_.js.map +0 -1
  133. package/dist/_chunks/Document-DecVclEe.js.map +0 -1
  134. package/dist/_chunks/Media-C6SOQfJZ.js +0 -122
  135. package/dist/_chunks/Media-C6SOQfJZ.js.map +0 -1
  136. package/dist/_chunks/PkStreamingMarkdown-CwqsJnJJ.js.map +0 -1
  137. package/dist/_chunks/PkToolShowForm-DbJHMDbt.js.map +0 -1
  138. package/dist/_chunks/browser-NgY6LXg-.js.map +0 -1
  139. package/dist-vue/_chunks/Agent-C8BsTAxk.js.map +0 -1
  140. package/dist-vue/_chunks/Document-CaUfI_SZ.js.map +0 -1
  141. package/dist-vue/_chunks/PkChatbot-BPKSPIeC.js.map +0 -1
  142. package/dist-vue/_chunks/PkChatbotError-CBP2mf-n.js.map +0 -1
  143. package/dist-vue/_chunks/PkChatbotInput-JnHaRlfk.js.map +0 -1
  144. package/dist-vue/_chunks/PkChatbotMessages-DAlkoMkY.js.map +0 -1
  145. package/dist-vue/_chunks/PkStreamingMarkdown-D8_LwZMR.js.map +0 -1
  146. package/dist-vue/_chunks/PkToolShowDiagram-dwCVZ1up.js.map +0 -1
  147. package/dist-vue/_chunks/PkToolShowForm-CO5A_j9L.js.map +0 -1
  148. package/dist-vue/_chunks/PkUrl-xUBKVJCv.js.map +0 -1
  149. package/dist-vue/_chunks/createChatbotApiClient-D9f69brW.js.map +0 -1
  150. 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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OAAA"}
@@ -1,29 +1,29 @@
1
- import { t as e } from "./PkStreamingMarkdown-D8_LwZMR.js";
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 ee, nextTick as g, normalizeClass as _, normalizeProps as te, onBeforeUnmount as v, onMounted as y, openBlock as b, ref as x, renderList as ne, renderSlot as S, toDisplayString as C, unref as re, useModel as w, useTemplateRef as T, watch as ie, withCtx as E, withKeys as ae, withModifiers as D } from "vue";
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 O = /* @__PURE__ */ new Map();
8
- function k(e) {
9
- var t = O.get(e);
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 A(e) {
13
- var t = O.get(e);
12
+ function j(e) {
13
+ var t = k.get(e);
14
14
  t && t.update();
15
15
  }
16
- var j = null;
17
- typeof window > "u" ? ((j = function(e) {
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
- }, j.update = function(e) {
21
+ }, M.update = function(e) {
22
22
  return e;
23
- }) : ((j = function(e, t) {
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" && !O.has(e)) {
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
- }), O.delete(e);
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", O.set(e, {
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 M = j, N = ["type"], P = {
80
+ var N = M, P = ["type"], F = {
81
81
  key: 0,
82
82
  class: "pk-chat-button__label"
83
- }, F = /* @__PURE__ */ m({
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 b(), u("button", {
95
- class: _(["pk-chat-button", [e.modifiers ? `pk-chat-button--${e.modifiers}` : void 0, { "pk-chat-button--labelled": e.label }]]),
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 ? (b(), u("span", P, C(e.label), 1)) : l("", !0)], 10, N);
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
- "placeholder",
119
- "onKeydown"
120
- ], _e = { class: "opacity-60" }, I = /* @__PURE__ */ m({
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 O = w(m, "modelValue"), k = w(m, "pendingAttachments"), A = h, j = m, N = T("textareaEl"), P = T("fileInputEl"), I = T("cameraInputEl"), L = T("formEl"), R = x(O.value ?? ""), z = null, B = () => {
147
- z !== null && (clearTimeout(z), z = null);
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
- B(), z = setTimeout(() => {
152
- O.value = R.value, z = null;
153
- }, 300);
151
+ V(), k.value = z.value;
154
152
  }, be = () => {
155
- R.value = N.value?.value ?? "", ye();
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
- ie(O, (e) => {
158
- e !== R.value && (R.value = e ?? "", g(() => {
159
- N.value && M.update(N.value);
159
+ re(k, (e) => {
160
+ e !== z.value && (z.value = e ?? "", _(() => {
161
+ P.value && N.update(P.value);
160
162
  }));
161
163
  });
162
- let V = s(() => j.status === "streaming"), H = s(() => j.status === "submitted"), U = s(() => V.value || H.value), W = s(() => R.value.length), G = s(() => j.maxMessageLength !== void 0 && W.value > j.maxMessageLength), xe = s(() => k.value.some((e) => e.state === "uploading")), K = s(() => U.value || xe.value || G.value ? !1 : R.value.trim().length > 0), Se = "capture" in document.createElement("input"), Ce = s(() => j.fileUpload?.allowedMimeTypes?.join(",") ?? ""), q = s(() => (j.fileUpload?.allowedMimeTypes ?? []).filter((e) => e.startsWith("image/")).join(",")), J = s(() => Se && q.value.length > 0), Y = () => {
163
- P.value?.click();
164
- }, we = () => {
165
- I.value?.click();
166
- }, X = (e) => {
167
- for (let t of e) A("file-select", t);
168
- }, Z = (e) => {
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
- X(Array.from(t.files ?? [])), t.value = "";
171
- }, Te = (e) => {
172
- let t = k.value.find((t) => t.id === e);
173
- t && URL.revokeObjectURL(t.localUrl), k.value = k.value.filter((t) => t.id !== e);
174
- }, Q = s(() => (j.enableDragDrop ?? !0) && !!j.fileUpload?.enabled), { isOverDropZone: Ee } = oe(L, {
175
- dataTypes: s(() => j.fileUpload?.allowedMimeTypes ?? []),
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
- Q.value && e && X(e);
179
+ Oe.value && e && Q(e);
178
180
  }
179
- }), De = x(!0), Oe = () => {
180
- De.value = !1;
181
- }, $ = s(() => j.attachmentNotice ? {
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: j.attachmentNotice,
185
- dismiss: () => A("dismiss-attachment-notice")
186
- } : j.dismissableNotice && De.value ? {
186
+ text: M.attachmentNotice,
187
+ dismiss: () => j("dismiss-attachment-notice")
188
+ } : M.dismissableNotice && Ae.value ? {
187
189
  id: "dismissable",
188
- markdown: j.dismissableNotice,
189
- dismiss: Oe
190
- } : null), ke = () => {
191
- K.value && (ve(), A("submit"), R.value = "", O.value = "", g(() => {
192
- N.value && (N.value.value = "", M.update(N.value));
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 y(() => {
196
- N.value && M(N.value);
197
- }), v(() => {
198
- B(), N.value && M.destroy(N.value);
199
- for (let e of k.value) URL.revokeObjectURL(e.localUrl);
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 g = a, v = n, y = i, x = r;
202
- return b(), u("div", se, [$.value ? (b(), u("div", {
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 ? (b(), c(g, {
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 ? (b(), c(e, {
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"])) : (b(), u("span", ce, C($.value.text), 1)),
217
- $.value.dismiss ? (b(), c(v, {
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: L,
235
+ ref: R,
228
236
  class: "pk-chatbot-input__form",
229
- onSubmit: D(ke, ["prevent"])
237
+ onSubmit: ae(Pe, ["prevent"])
230
238
  }, [
231
- re(Ee) && Q.value ? (b(), u("div", le, [p(g, {
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, C(s.$t("action.dropFile")), 1)])) : l("", !0),
235
- k.value.length ? (b(), u("div", ue, [(b(!0), u(o, null, ne(k.value, (e) => (b(), c(t, {
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) => Te(e.id)
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
- S(s.$slots, "prepend"),
258
- m.fileUpload && m.fileUpload.enabled && (J.value || s.$slots["additional-actions"]) ? (b(), c(x, te(ee({ key: 0 }, {
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: E(({ init: e, toggle: t, aria: n }) => [d("button", ee({ ref: (t) => e(t) }, n, {
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: U.value,
276
+ disabled: W.value,
269
277
  onClick: t
270
- }), [p(g, {
278
+ }), [p(_, {
271
279
  name: "ri:add-line",
272
280
  class: "pk-chat-button__icon"
273
281
  })], 16, fe)]),
274
- items: E(() => [
275
- J.value ? (b(), c(y, {
282
+ items: O(() => [
283
+ X.value ? (x(), c(b, {
276
284
  key: 0,
277
- disabled: U.value || m.attachmentLimitReached,
278
- onClick: we
285
+ disabled: W.value || m.attachmentLimitReached,
286
+ onClick: Te
279
287
  }, {
280
- default: E(() => [p(g, {
288
+ default: O(() => [p(_, {
281
289
  name: "ri:camera-line",
282
290
  class: "pk-chatbot-input__dropdown-icon"
283
- }), f(" " + C(s.$t("action.takePhoto")), 1)]),
291
+ }), f(" " + w(s.$t("action.takePhoto")), 1)]),
284
292
  _: 1
285
293
  }, 8, ["disabled"])) : l("", !0),
286
- p(y, {
287
- disabled: U.value || m.attachmentLimitReached,
288
- onClick: Y
294
+ p(b, {
295
+ disabled: W.value || m.attachmentLimitReached,
296
+ onClick: Z
289
297
  }, {
290
- default: E(() => [p(g, {
298
+ default: O(() => [p(_, {
291
299
  name: "ri:attachment-line",
292
300
  class: "pk-chatbot-input__dropdown-icon"
293
- }), f(" " + C(s.$t("action.attachFile")), 1)]),
301
+ }), f(" " + w(s.$t("action.attachFile")), 1)]),
294
302
  _: 1
295
303
  }, 8, ["disabled"]),
296
- S(s.$slots, "additional-actions")
304
+ C(s.$slots, "additional-actions")
297
305
  ]),
298
306
  _: 3
299
- }, 16)) : m.fileUpload && m.fileUpload.enabled ? (b(), c(F, {
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: U.value || m.attachmentLimitReached,
304
- onClick: Y
311
+ disabled: W.value || m.attachmentLimitReached,
312
+ onClick: Z
305
313
  }, null, 8, ["title", "disabled"])) : l("", !0),
306
- m.fileUpload && m.fileUpload.enabled ? (b(), u("input", {
314
+ m.fileUpload && m.fileUpload.enabled ? (x(), u("input", {
307
315
  key: 2,
308
316
  ref_key: "fileInputEl",
309
- ref: P,
317
+ ref: F,
310
318
  type: "file",
311
319
  hidden: "",
312
320
  multiple: "",
313
- accept: Ce.value,
314
- onChange: Z
321
+ accept: we.value,
322
+ onChange: Ee
315
323
  }, null, 40, pe)) : l("", !0),
316
- m.fileUpload && m.fileUpload.enabled && J.value ? (b(), u("input", {
324
+ m.fileUpload && m.fileUpload.enabled && X.value ? (x(), u("input", {
317
325
  key: 3,
318
326
  ref_key: "cameraInputEl",
319
- ref: I,
327
+ ref: L,
320
328
  type: "file",
321
329
  capture: "environment",
322
330
  hidden: "",
323
- accept: q.value,
324
- onChange: Z
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: N,
329
- value: R.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: be,
335
- onKeydown: ae(D(ke, ["prevent"]), ["enter"])
346
+ onInput: xe,
347
+ onKeydown: ie(Fe, ["enter"])
336
348
  }, null, 40, ge)]),
337
- m.maxMessageLength ? (b(), u("div", {
349
+ m.maxMessageLength ? (x(), u("div", {
338
350
  key: 4,
339
- class: _(["pk-chatbot-input__counter", { "pk-chatbot-input__counter--over": G.value }])
340
- }, [f(C(s.$n(W.value, "integer")) + "/", 1), d("span", _e, C(s.$n(m.maxMessageLength, "integer")), 1)], 2)) : l("", !0),
341
- m.voiceEnabled && !V.value ? (b(), c(F, {
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: U.value,
346
- onClick: h[1] ||= (e) => A("voice-start")
358
+ disabled: W.value,
359
+ onClick: h[1] ||= (e) => j("voice-start")
347
360
  }, null, 8, ["title", "disabled"])) : l("", !0),
348
- V.value ? (b(), c(F, {
361
+ H.value ? (x(), c(I, {
349
362
  key: 6,
350
- icon: "ri:stop-circle-line",
363
+ icon: "ri:stop-fill",
364
+ modifiers: "primary",
351
365
  title: s.$t("action.stop"),
352
- onClick: h[2] ||= (e) => A("stop-generation")
353
- }, null, 8, ["title"])) : (b(), c(F, {
366
+ onClick: Ne
367
+ }, null, 8, ["title"])) : (x(), c(I, {
354
368
  key: 7,
355
369
  type: "submit",
356
- icon: H.value ? "loading-loop" : K.value ? "ri:send-ins-fill" : "ri:send-ins-line",
357
- title: K.value ? s.$t("action.submit") : s.$t("label.disabled"),
358
- disabled: !K.value
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 { F as n, I as t };
385
+ export { I as n, L as t };
371
386
 
372
- //# sourceMappingURL=PkChatbotInput-JnHaRlfk.js.map
387
+ //# sourceMappingURL=PkChatbotInput-pEl3D2O-.js.map