@opentiny/genui-sdk-vue 1.3.0 → 1.3.1-alpha.2

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 (47) hide show
  1. package/README.md +11 -2
  2. package/dist/ConfigProvider-B_1dX_dv.js +131 -0
  3. package/dist/ConfigProvider-B_1dX_dv.js.map +1 -0
  4. package/dist/{GenuiChatWithMaterials.vue_vue_type_script_setup_true_lang-CxcSUrjG.js → GenuiChatWithMaterials.vue_vue_type_script_setup_true_lang-zsZgFWJw.js} +3 -3
  5. package/dist/{GenuiChatWithMaterials.vue_vue_type_script_setup_true_lang-CxcSUrjG.js.map → GenuiChatWithMaterials.vue_vue_type_script_setup_true_lang-zsZgFWJw.js.map} +1 -1
  6. package/dist/GenuiRenderer-f2_6u1TA.js +141 -0
  7. package/dist/GenuiRenderer-f2_6u1TA.js.map +1 -0
  8. package/dist/{GenuiRendererWithMaterials.vue_vue_type_script_setup_true_lang-o5SS6BG6.js → GenuiRendererWithMaterials.vue_vue_type_script_setup_true_lang-CMjFQe5i.js} +3 -3
  9. package/dist/{GenuiRendererWithMaterials.vue_vue_type_script_setup_true_lang-o5SS6BG6.js.map → GenuiRendererWithMaterials.vue_vue_type_script_setup_true_lang-CMjFQe5i.js.map} +1 -1
  10. package/dist/chat.d.ts +6 -0
  11. package/dist/chat.js +17 -15
  12. package/dist/chat.js.map +1 -1
  13. package/dist/chat.types-DEDNSs5o.js +1817 -0
  14. package/dist/chat.types-DEDNSs5o.js.map +1 -0
  15. package/dist/code-generator.d.ts +139 -0
  16. package/dist/code-generator.js +6 -0
  17. package/dist/code-generator.js.map +1 -0
  18. package/dist/config-provider.d.ts +24 -12
  19. package/dist/config-provider.js +2 -2
  20. package/dist/index.d.ts +168 -16
  21. package/dist/index.js +37 -31
  22. package/dist/index.js.map +1 -1
  23. package/dist/injection-tokens-DDgspg4x.js +9067 -0
  24. package/dist/injection-tokens-DDgspg4x.js.map +1 -0
  25. package/dist/legacy-chat.d.ts +9 -1
  26. package/dist/legacy-chat.js +3 -3
  27. package/dist/legacy-renderer.js +2 -2
  28. package/dist/picocolors.browser-nFqgZww8.js +50 -0
  29. package/dist/picocolors.browser-nFqgZww8.js.map +1 -0
  30. package/dist/renderer.d.ts +2 -2
  31. package/dist/renderer.js +1 -1
  32. package/dist/transform-jsx.d.ts +2 -3
  33. package/dist/transform-jsx.js +147312 -66873
  34. package/dist/transform-jsx.js.map +1 -1
  35. package/dist/vue-code-generator-CwPQ3GDh.js +573 -0
  36. package/dist/vue-code-generator-CwPQ3GDh.js.map +1 -0
  37. package/package.json +12 -5
  38. package/dist/ConfigProvider-BzxW9L3f.js +0 -95
  39. package/dist/ConfigProvider-BzxW9L3f.js.map +0 -1
  40. package/dist/GenuiRenderer-BVwM5pRp.js +0 -15163
  41. package/dist/GenuiRenderer-BVwM5pRp.js.map +0 -1
  42. package/dist/___vite-browser-external_commonjs-proxy-4gYZYw55.js +0 -57
  43. package/dist/___vite-browser-external_commonjs-proxy-4gYZYw55.js.map +0 -1
  44. package/dist/chat.types-DsoAmslj.js +0 -1794
  45. package/dist/chat.types-DsoAmslj.js.map +0 -1
  46. package/dist/injection-tokens-CuDQs1ne.js +0 -114
  47. package/dist/injection-tokens-CuDQs1ne.js.map +0 -1
@@ -1,1794 +0,0 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(`.attachments-renderer[data-v-63821ae8]{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}.image-thumbnail[data-v-63821ae8]{position:relative;width:50px;height:50px;cursor:pointer;flex-shrink:0}.image-thumbnail .image-wrapper[data-v-63821ae8]{width:100%;height:100%;border-radius:6px;overflow:hidden;position:relative}.image-thumbnail img[data-v-63821ae8]{width:100%;height:100%;object-fit:cover;display:block}.image-thumbnail .delete-btn[data-v-63821ae8]{position:absolute;top:-8px;right:-8px;border-radius:50%;border:none;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all .2s;padding:0;background-color:transparent}.image-thumbnail .delete-btn .delete-btn-icon[data-v-63821ae8]{width:14px;height:14px}.image-thumbnail .hover-overlay[data-v-63821ae8]{position:absolute;top:0;left:0;right:0;bottom:0;background-color:#00000080;border-radius:8px;display:flex;align-items:center;justify-content:center;opacity:0;visibility:hidden;transition:opacity .2s,visibility .2s}.image-thumbnail .hover-overlay .preview-text[data-v-63821ae8]{color:#fff;font-size:12px;font-weight:500}.image-thumbnail:hover .hover-overlay[data-v-63821ae8]{opacity:1;visibility:visible}.file-item[data-v-63821ae8]{padding:8px 12px;background-color:#f5f5f5;border-radius:4px;display:inline-flex;align-items:center}.file-item .file-name[data-v-63821ae8]{font-size:14px;color:#333;word-break:break-all}.fullscreen-overlay[data-v-63821ae8]{position:fixed;top:0;left:0;right:0;bottom:0;background-color:#000c;display:flex;align-items:center;justify-content:center;z-index:9999;cursor:pointer;padding:20px}.fullscreen-overlay img[data-v-63821ae8]{max-width:90%;max-height:90%;object-fit:contain;cursor:default;border-radius:8px}.fullscreen-fade-enter-active[data-v-63821ae8]{transition:opacity .3s ease}.fullscreen-fade-leave-active[data-v-63821ae8]{transition:opacity .25s ease}.fullscreen-fade-enter-from[data-v-63821ae8],.fullscreen-fade-leave-to[data-v-63821ae8]{opacity:0}.image-scale-enter-active[data-v-63821ae8]{transition:transform .4s cubic-bezier(.34,1.56,.64,1),opacity .4s ease}.image-scale-leave-active[data-v-63821ae8]{transition:transform .3s cubic-bezier(.55,.055,.675,.19),opacity .3s ease}.image-scale-enter-from[data-v-63821ae8]{transform:scale(.2);opacity:0}.image-scale-leave-to[data-v-63821ae8]{transform:scale(.9);opacity:0}.template-data-renderer[data-v-e158cad0]{display:inline;word-break:break-word}.text-item[data-v-e158cad0]{display:inline}.template-item[data-v-e158cad0]{position:relative;display:inline}.template-item .template-text[data-v-e158cad0]{display:inline;cursor:pointer;color:#1476ff;background-color:#1476ff1a;padding:2px 4px;border-radius:4px}.image-preview[data-v-e158cad0]{max-width:200px;cursor:pointer}.image-preview .image-preview-img[data-v-e158cad0]{width:100%;height:100%;object-fit:contain}.fullscreen-overlay[data-v-e158cad0]{position:fixed;top:0;left:0;right:0;bottom:0;background-color:#000c;display:flex;align-items:center;justify-content:center;z-index:9999;cursor:pointer;padding:20px}.fullscreen-overlay img[data-v-e158cad0]{max-width:90%;max-height:90%;object-fit:contain;cursor:default;border-radius:8px}.fullscreen-fade-enter-active[data-v-e158cad0]{transition:opacity .3s ease}.fullscreen-fade-leave-active[data-v-e158cad0]{transition:opacity .25s ease}.fullscreen-fade-enter-from[data-v-e158cad0],.fullscreen-fade-leave-to[data-v-e158cad0]{opacity:0}.image-scale-enter-active[data-v-e158cad0]{transition:transform .4s cubic-bezier(.34,1.56,.64,1),opacity .4s ease}.image-scale-leave-active[data-v-e158cad0]{transition:transform .3s cubic-bezier(.55,.055,.675,.19),opacity .3s ease}.image-scale-enter-from[data-v-e158cad0]{transform:scale(.2);opacity:0}.image-scale-leave-to[data-v-e158cad0]{transform:scale(.9);opacity:0}.tr-bubble__reasoning[data-v-1ffff0cd]:not(:last-child){margin-top:8px}.header[data-v-1ffff0cd]{font-size:16px;line-height:1.5;color:var(--tr-text-secondary);display:flex;align-items:center;gap:8px;cursor:pointer}.header[data-v-1ffff0cd]:hover{color:var(--tr-text-primary);fill:var(--tr-text-primary)}.header .icon-and-text[data-v-1ffff0cd]{display:flex;align-items:center;gap:8px}.header .expand-icon.-rotate-90[data-v-1ffff0cd]{transform:rotate(-90deg)}@keyframes thinking-pulse-1ffff0cd{20%{opacity:1}50%{opacity:.5}80%{opacity:1}}.thinking[data-v-1ffff0cd]{animation:thinking-pulse-1ffff0cd 1.5s infinite linear}.detail[data-v-1ffff0cd]{color:var(--tr-text-secondary);margin-block:8px;display:flex;gap:8px;align-items:center;font-size:14px}.detail .detail-content[data-v-1ffff0cd]{max-height:300px;overflow-y:auto}.detail .detail-content[data-v-1ffff0cd]>*:first-child{margin-top:0}.detail .detail-content[data-v-1ffff0cd]>*:last-child{margin-bottom:0}.detail .side-border[data-v-1ffff0cd]{width:16px;flex-shrink:0;align-self:stretch;display:flex;flex-direction:column;align-items:center}.detail .side-border .dot-wrapper[data-v-1ffff0cd]{width:4px;height:16px;display:flex;align-items:center;flex-shrink:0}.detail .side-border .dot[data-v-1ffff0cd]{width:4px;height:4px;border-radius:50%;background-color:var(--tr-text-primary)}.detail .side-border .border-line[data-v-1ffff0cd]{flex:1;width:1.5px;background-color:#c2c2c2;border-radius:1px}.tr-bubble__step-tool[data-v-398a0327]{font-size:14px;line-height:24px;padding:12px;color:var(--tr-text-secondary);background-color:var(--tr-container-bg-default-2);border-radius:12px}.tr-bubble__step-tool .tr-bubble__step-tool-header[data-v-398a0327]{display:flex;align-items:center;justify-content:space-between;gap:8px}.tr-bubble__step-tool .tr-bubble__step-tool-left[data-v-398a0327]{display:flex;align-items:center;gap:8px}.tr-bubble__step-tool .tr-bubble__step-tool-left .tr-bubble__step-tool-icon[data-v-398a0327]{font-size:20px;flex-shrink:0}.tr-bubble__step-tool .tr-bubble__step-tool-left .tr-bubble__step-tool-icon.icon-running[data-v-398a0327]{color:#898989;animation:spin 1s linear infinite}.tr-bubble__step-tool .tr-bubble__step-tool-left .tr-bubble__step-tool-icon.icon-success[data-v-398a0327]{color:#898989}.tr-bubble__step-tool .tr-bubble__step-tool-left .tr-bubble__step-tool-icon.icon-failed[data-v-398a0327],.tr-bubble__step-tool .tr-bubble__step-tool-left .tr-bubble__step-tool-icon.icon-cancelled[data-v-398a0327]{color:var(--tr-color-error)}.tr-bubble__step-tool .tr-bubble__step-tool-left .tr-bubble__step-tool-title[data-v-398a0327]{word-break:break-word}.tr-bubble__step-tool .tr-bubble__step-tool-left .tr-bubble__step-tool-name[data-v-398a0327]{color:var(--tr-text-primary);font-weight:600}.tr-bubble__step-tool .tr-bubble__step-tool-expand[data-v-398a0327]{display:flex;align-items:center;justify-content:center;cursor:pointer;flex-shrink:0}.tr-bubble__step-tool .tr-bubble__step-tool-expand .expand-icon[data-v-398a0327]{font-size:16px}.tr-bubble__step-tool .tr-bubble__step-tool-expand .expand-icon.-rotate-90[data-v-398a0327]{transform:rotate(-90deg)}.tr-bubble__step-tool .tr-bubble__step-tool-hr[data-v-398a0327]{margin:12px 0;color:#dbdbdb}.tr-bubble__step-tool .tr-bubble__step-tool-params-content[data-v-398a0327]{white-space:pre-wrap;word-break:break-word;font-family:monospace;max-height:300px;overflow-y:auto}._key_1b448_2{color:var(--tr-bubble-tool-key-color)}._number_1b448_6{color:var(--tr-bubble-tool-number-color)}._string_1b448_10{color:var(--tr-bubble-tool-string-color)}._boolean_1b448_14{color:var(--tr-bubble-tool-boolean-color)}._null_1b448_18{color:var(--tr-bubble-tool-null-color)}.loading-wrapper[data-v-14a1c66c]{width:fit-content;max-width:100%;overflow:hidden;width:100%;min-height:45px;position:relative}.loading-container[type=loading-text][data-v-14a1c66c]{position:absolute;right:0;min-width:100%;margin:10px 0;color:#666;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:inline-block}@supports ((background-clip: text)){.loading-container[type=loading-text][data-v-14a1c66c]{background:linear-gradient(90deg,#666,#666 45%,#999,#999,#666 60%,#666);background-size:200% 100%;-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;animation:text-shimmer-14a1c66c 6s linear infinite}}@keyframes text-shimmer-14a1c66c{0%{background-position:200% 0}to{background-position:-200% 0}}.tg-playground-error-card[data-v-a0f77c05]{margin:8px 0;padding:16px 24px;border-radius:24px;background-color:var(--tv-color-error-bg-light);font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:var(--tr-bubble-text-font-size);line-height:var(--tr-bubble-text-line-height);overflow:hidden;color:var(--tr-text-primary)}.card-header[data-v-a0f77c05]{display:flex;position:relative;align-items:center;font-weight:500;gap:8px}.icon-error[data-v-a0f77c05]{width:18px;height:18px;fill:var(--tv-color-error-icon);transform:translateY(-1px)}.icon-right[data-v-a0f77c05]{width:16px;height:16px;position:absolute;fill:var(--tr-text-primary);right:0;top:50%;transform:translateY(-50%) rotate(0);cursor:pointer;transition:transform .2s ease-out}.icon-right.expanded[data-v-a0f77c05]{transform:translateY(-50%) rotate(90deg)}.card-title[data-v-a0f77c05]{white-space:nowrap}.card-body[data-v-a0f77c05]{margin:8px 0 0;background-color:var(--tr-bubble-content-bg);padding:8px 10px;border-radius:6px;max-height:60vh;overflow-x:auto;white-space:pre-wrap;word-break:break-all}.card-body.collapsed[data-v-a0f77c05]{height:0;padding:0;margin-top:0;overflow:hidden}.tg-chat-container[data-v-34bc2af9]{--ti-gen-chat-container-bg-color: #f0f0f0;--thinking-display: initial;--sender-bg: url("data:image/svg+xml,%3csvg%20viewBox='0%200%201244%20186'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='1244.000000'%20height='186.000000'%20fill='none'%3e%3cdefs%3e%3cclipPath%20id='clipPath_0'%3e%3crect%20width='1083.000122'%20height='276.998108'%20x='81.000000'%20y='0.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cradialGradient%20id='paint_radial_0'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(-229.7,0,0,-152.751,410.969,285.331)'%3e%3cstop%20stop-color='rgb(255,239,248)'%20offset='0'%20stop-opacity='1'%20/%3e%3cstop%20stop-color='rgb(255,239,248)'%20offset='1'%20stop-opacity='0'%20/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint_radial_1'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(372.771,0,0,193.995,774,236.999)'%3e%3cstop%20stop-color='rgb(230,240,255)'%20offset='0'%20stop-opacity='1'%20/%3e%3cstop%20stop-color='rgb(230,240,255)'%20offset='1'%20stop-opacity='0'%20/%3e%3c/radialGradient%3e%3c/defs%3e%3crect%20id='亮色背景'%20width='1244.000000'%20height='186.000000'%20x='0.000000'%20y='0.000000'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20/%3e%3cg%20id='对话框背景%201'%20clip-path='url(%23clipPath_0)'%20customFrame='url(%23clipPath_0)'%3e%3crect%20id='对话框背景%201'%20width='1083.000122'%20height='276.998108'%20x='81.000000'%20y='0.000000'%20/%3e%3crect%20id='容器%202'%20width='1083.000122'%20height='276.998108'%20x='81.000000'%20y='0.000000'%20fill='rgb(255,255,255)'%20fill-opacity='0'%20/%3e%3crect%20id='show_mask_2'%20width='460.000000'%20height='305.501465'%20x='180.969238'%20y='132.583984'%20rx='152.750717'%20fill='url(%23paint_radial_0)'%20/%3e%3crect%20id='show_mask_1'%20width='912.000000'%20height='474.000000'%20x='318.000000'%20y='0.000000'%20rx='237.000000'%20fill='url(%23paint_radial_1)'%20/%3e%3c/g%3e%3c/svg%3e") no-repeat center;--sender-border-color: #e5e5e5;--generating-bg-before: linear-gradient(90deg, #fff, #a2c7f4);--generating-bg-after: #fff;box-sizing:border-box;height:100%;color:var(--tr-text-primary);background-color:var(--ti-gen-chat-container-bg-color);position:relative;display:flex;flex-direction:column;overflow:auto}.tg-chat-container.dark[data-v-34bc2af9]{--ti-gen-chat-container-bg-color: #191919;--sender-bg: url("data:image/svg+xml,%3csvg%20viewBox='0%200%201244%20186'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='1244.000000'%20height='186.000000'%20fill='none'%3e%3cmask%20id='mask_3'%20width='528.384094'%20height='282.593811'%20x='111.420166'%20y='110.491211'%20maskUnits='userSpaceOnUse'%3e%3cg%20filter='url(%23pixso_custom_mask_type_outline)'%3e%3crect%20id='蒙版'%20width='528.384094'%20height='282.593811'%20x='111.420166'%20y='110.491211'%20rx='141.296906'%20fill='rgb(255,255,255)'%20/%3e%3c/g%3e%3c/mask%3e%3cmask%20id='mask_2'%20width='1047.578979'%20height='560.273071'%20x='276.827148'%20y='-104.525391'%20maskUnits='userSpaceOnUse'%3e%3cg%20filter='url(%23pixso_custom_mask_type_outline)'%3e%3crect%20id='蒙版'%20width='1047.578979'%20height='560.273071'%20x='276.827148'%20y='-104.525391'%20rx='235.379578'%20fill='rgb(255,255,255)'%20/%3e%3c/g%3e%3c/mask%3e%3cmask%20id='mask_1'%20width='639.804199'%20height='342.184357'%20x='374.463623'%20y='-30.191406'%20maskUnits='userSpaceOnUse'%3e%3cg%20filter='url(%23pixso_custom_mask_type_outline)'%3e%3crect%20id='蒙版'%20width='639.804199'%20height='342.184357'%20x='374.463623'%20y='-30.191406'%20rx='171.092178'%20fill='rgb(255,255,255)'%20/%3e%3c/g%3e%3c/mask%3e%3cmask%20id='mask_0'%20width='1244.000000'%20height='360.000000'%20x='0.000000'%20y='38.000000'%20maskUnits='userSpaceOnUse'%3e%3cg%20filter='url(%23pixso_custom_mask_type_alpha)'%3e%3cellipse%20id='椭圆形'%20rx='622.000000'%20ry='180.000000'%20cx='622'%20cy='218'%20fill='url(%23paint_radial_2)'%20/%3e%3cellipse%20id='椭圆形'%20rx='621.500000'%20ry='179.500000'%20cx='622'%20cy='218'%20stroke='rgb(151,151,151)'%20stroke-opacity='0'%20stroke-width='1'%20/%3e%3c/g%3e%3c/mask%3e%3cdefs%3e%3cclipPath%20id='clipPath_1'%3e%3crect%20width='1244.000000'%20height='148.000000'%20x='0.000000'%20y='38.000000'%20fill='rgb(255,255,255)'%20/%3e%3c/clipPath%3e%3cradialGradient%20id='paint_radial_2'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(689.165,0,0,158.722,622,218)'%3e%3cstop%20stop-color='rgb(0,0,0)'%20offset='0'%20stop-opacity='1'%20/%3e%3cstop%20stop-color='rgb(68.3036,68.2353,68.2353)'%20offset='0.309297144'%20stop-opacity='1'%20/%3e%3cstop%20stop-color='rgb(0,0,0)'%20offset='1'%20stop-opacity='0'%20/%3e%3c/radialGradient%3e%3cfilter%20id='pixso_custom_mask_type_alpha'%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%201%200%200%200%200%201%200%200%200%200%201%200%200%200%201%200%20'%20/%3e%3c/filter%3e%3cradialGradient%20id='paint_radial_3'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(319.485,0,0,171.092,694.366,140.901)'%3e%3cstop%20stop-color='rgb(144.576,104.098,32.8582)'%20offset='0'%20stop-opacity='1'%20/%3e%3cstop%20stop-color='rgb(129.777,92.7956,27.1351)'%20offset='1'%20stop-opacity='0'%20/%3e%3c/radialGradient%3e%3cfilter%20id='pixso_custom_mask_type_outline'%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%201%200%200%200%200%201%200%200%200%200%201%200%200%200%201%200%20'%20/%3e%3c/filter%3e%3cradialGradient%20id='paint_radial_4'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(652.421,0,0,349.387,800.617,175.611)'%3e%3cstop%20stop-color='rgb(18.6076,39.3967,70.5804)'%20offset='0'%20stop-opacity='1'%20/%3e%3cstop%20stop-color='rgb(22.209,47.0218,84.2411)'%20offset='1'%20stop-opacity='0'%20/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint_radial_5'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(263.848,0,0,141.297,375.612,251.788)'%3e%3cstop%20stop-color='rgb(75.1339,33.8103,57.0548)'%20offset='0'%20stop-opacity='1'%20/%3e%3cstop%20stop-color='rgb(75.1339,33.4688,56.9054)'%20offset='1'%20stop-opacity='0'%20/%3e%3c/radialGradient%3e%3c/defs%3e%3crect%20id='暗色背景'%20width='1244.000000'%20height='186.000000'%20x='0.000000'%20y='0.000000'%20fill='rgb(25,25,25)'%20fill-opacity='0'%20/%3e%3cg%20id='组合%205542'%3e%3cg%20id='容器%204'%20clip-path='url(%23clipPath_1)'%20customFrame='url(%23clipPath_1)'%3e%3crect%20id='容器%204'%20width='1244.000000'%20height='148.000000'%20x='0.000000'%20y='38.000000'%20fill='rgb(25,25,25)'%20fill-opacity='0'%20/%3e%3cg%20id='椭圆形%204'%20mask='url(%23mask_0)'%3e%3cg%20id='BLUE备份%202'%20opacity='0.100000001'%20showMaskRef='url(%23show_mask_0)'%20mask='url(%23mask_1)'%3e%3crect%20id='show_mask_0'%20width='639.804199'%20height='342.184357'%20x='374.463623'%20y='-30.191406'%20rx='171.092178'%20fill='url(%23paint_radial_3)'%20/%3e%3c/g%3e%3cg%20id='BLUE备份%203'%20showMaskRef='url(%23show_mask_1)'%20mask='url(%23mask_2)'%3e%3crect%20id='show_mask_1'%20width='1047.578979'%20height='560.273071'%20x='276.827148'%20y='-104.525391'%20rx='235.379578'%20fill='url(%23paint_radial_4)'%20/%3e%3c/g%3e%3cg%20id='BLUE备份%204'%20showMaskRef='url(%23show_mask_2)'%20mask='url(%23mask_3)'%3e%3crect%20id='show_mask_2'%20width='528.384094'%20height='282.593811'%20x='111.420166'%20y='110.491211'%20rx='141.296906'%20fill='url(%23paint_radial_5)'%20/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e") no-repeat center;--sender-border-color: #333;--generating-bg-before: linear-gradient(90deg, #262626, #808080);--generating-bg-after: #191919}.is-loading-in-top[data-v-34bc2af9]{margin-top:-48px}.messages-container[data-v-34bc2af9]{flex:1;overflow:auto;word-break:break-word}[data-v-34bc2af9] .tr-bubble__loading{margin-top:8px}[data-v-34bc2af9] .tr-bubble.placement-start .tr-bubble__content{padding:0;background:transparent;border-radius:0;box-shadow:none}[data-v-34bc2af9] .tr-bubble[data-role=assistant] .tr-bubble__content-items:has([type^=schema-card])>[type]:not([type=""]):not([type=schema-card]):not([type=loading-text]){display:var(--thinking-display, initial)}[data-v-34bc2af9] .tr-bubble__step-tool+.tr-bubble__step-tool{margin-top:16px}[data-v-34bc2af9] .tr-bubble.placement-end{width:100%}[data-v-34bc2af9] .tr-bubble__content-wrapper{max-width:calc(100% - var(--ti-gen-chat-avatar-and-gap-width, 56px) * 2)}[data-v-34bc2af9] .tr-bubble__content-wrapper .tr-bubble__content{max-width:100%}[data-v-34bc2af9] .tr-bubble__content-wrapper .tr-bubble__content-items{overflow-x:auto}.sender-container[data-v-34bc2af9]{position:relative;flex-shrink:0;padding:16px 0;background:var(--sender-bg)}.sender-container .attachments-container[data-v-34bc2af9]{padding:0 20px}.scroll-to-bottom-button[data-v-34bc2af9]{position:absolute;left:50%;transform:translate(-50%);top:-35px;width:40px;height:40px;background-color:var(--generating-bg-after);border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;border:1px solid var(--sender-border-color);z-index:1000}.scroll-to-bottom-button>svg[data-v-34bc2af9]{width:20px;height:20px}.scroll-to-bottom-button[data-v-34bc2af9]:hover{box-shadow:0 10px 20px #0000001a,0 0 1px #00000026}.scroll-to-bottom-button.is-generating[data-v-34bc2af9]{border:none;background-color:transparent}.scroll-to-bottom-button.is-generating[data-v-34bc2af9]:before{content:"";position:absolute;top:-2px;left:-2px;right:-2px;bottom:-2px;width:calc(100% + 4px);height:calc(100% + 4px);border-radius:50%;background:var(--generating-bg-before);z-index:0;animation:rotate-border-34bc2af9 2s linear infinite}.scroll-to-bottom-button.is-generating[data-v-34bc2af9]:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;border-radius:50%;background-color:var(--generating-bg-after);z-index:1}.scroll-to-bottom-button.is-generating>svg[data-v-34bc2af9]{z-index:2}.footer-text[data-v-34bc2af9]{font-size:12px;color:#999;text-align:center;margin-top:16px}[data-v-34bc2af9] .schema-render-container{min-width:min(calc(var(--messages-container-width) - 250px),400px)}@keyframes rotate-border-34bc2af9{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.tiny-sender[data-v-34bc2af9]{width:80%;margin:0 auto}`)),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
- import { ref as F, onMounted as ve, onUnmounted as nt, h as ee, nextTick as at, defineComponent as X, computed as O, createElementBlock as I, openBlock as E, createVNode as D, Fragment as le, renderList as he, createElementVNode as b, withModifiers as ot, unref as S, toDisplayString as H, Transition as ie, withCtx as j, createCommentVNode as V, withDirectives as Ae, normalizeClass as K, vShow as De, useCssModule as rt, createBlock as $e, resolveDynamicComponent as lt, createTextVNode as it, onBeforeUnmount as Oe, reactive as ue, toRaw as fe, isRef as Ne, isReactive as ct, watch as ce, readonly as te, inject as ut, normalizeStyle as Re, renderSlot as dt, createSlots as mt } from "vue";
3
- import "@opentiny/tiny-robot/dist/style.css";
4
- import { BubbleMarkdownContentRenderer as Be, TrBubbleProvider as pt, TrBubbleList as gt, TrSender as ht } from "@opentiny/tiny-robot";
5
- import { BaseModelProvider as ft, STATUS as q, GeneratingStatus as ae, AIClient as vt } from "@opentiny/tiny-robot-kit";
6
- import { IconFileRemove as yt, IconArrowDown as ye, IconLoading as _t, IconPlugin as ke, IconError as wt, IconCancelled as bt, IconUser as Ct, IconAi as Mt } from "@opentiny/tiny-robot-svgs";
7
- import { TinyNotify as xe, TinyPopover as St } from "@opentiny/vue";
8
- import { u as $, _ as Q, a as Rt } from "./injection-tokens-CuDQs1ne.js";
9
- import { G as kt, c as xt } from "./GenuiRenderer-BVwM5pRp.js";
10
- import { iconChevronRight as Et, iconOperationfaild as It } from "@opentiny/vue-icon";
11
- import { getPartialStartRegString as Ee, PatternExtractor as Ie } from "@opentiny/genui-sdk-core";
12
- import { v4 as Tt } from "uuid";
13
- const Ft = (t) => t.map((s) => ({
14
- name: s.name,
15
- description: s.description,
16
- parameters: s.parameters,
17
- return: s.return,
18
- async: s.async
19
- })), At = (t) => t.map((s) => {
20
- const { ref: e, ...n } = s;
21
- return n;
22
- }), Dt = async (t) => {
23
- const { url: s, messages: e, model: n, temperature: a, signal: p, customComponents: l, customSnippets: u, customExamples: r, customActions: i, customFetch: o } = t, m = {
24
- customComponents: At(l),
25
- customSnippets: u,
26
- customExamples: r,
27
- customActions: Ft(i)
28
- }, y = {
29
- tinygenui: JSON.stringify(m)
30
- }, f = {
31
- method: "POST",
32
- headers: {
33
- "Content-Type": "application/json"
34
- },
35
- signal: p,
36
- body: JSON.stringify({
37
- messages: e,
38
- model: n,
39
- temperature: a,
40
- metadata: y
41
- })
42
- }, v = await (o || fetch)(s, f);
43
- if (!v.ok) {
44
- const T = await v.text();
45
- throw new Error(`HTTP error! status: ${v.status}, details: ${T}`);
46
- }
47
- return v;
48
- };
49
- async function $t(t, s) {
50
- let e = "";
51
- const n = new TextDecoder("utf-8");
52
- for (; ; ) {
53
- const { done: a, value: p } = await t.read();
54
- if (a) break;
55
- for (e += n.decode(p, { stream: !0 }); ; ) {
56
- const l = e.indexOf(`
57
- `);
58
- if (l === -1) break;
59
- const u = e.slice(0, l).trim();
60
- if (e = e.slice(l + 1), !u.startsWith("data:")) continue;
61
- const r = u.slice(5).trim();
62
- if (r === "[DONE]") break;
63
- s(r);
64
- }
65
- }
66
- return !0;
67
- }
68
- class Ot extends ft {
69
- constructor({ getChatOptions: s }) {
70
- super({ provider: "custom" }), this.responseHandlers = [], this.getChatOptions = s;
71
- }
72
- validateRequest(s) {
73
- }
74
- setResponseHandlers(s) {
75
- this.responseHandlers = s;
76
- }
77
- async getData(s) {
78
- var o;
79
- const {
80
- url: e,
81
- model: n,
82
- temperature: a,
83
- customComponents: p,
84
- customSnippets: l,
85
- customExamples: u,
86
- customActions: r,
87
- customFetch: i
88
- } = this.getChatOptions();
89
- return await Dt({
90
- url: e,
91
- messages: s.messages,
92
- model: n,
93
- temperature: a,
94
- signal: (o = s.options) == null ? void 0 : o.signal,
95
- customComponents: p,
96
- customSnippets: l,
97
- customExamples: u,
98
- customActions: r,
99
- customFetch: i
100
- });
101
- }
102
- async chat(s) {
103
- return {};
104
- }
105
- async chatStream(s, e) {
106
- var m;
107
- const { onDone: n, onData: a, onError: p } = e;
108
- let l;
109
- try {
110
- l = await this.getData(s);
111
- } catch (y) {
112
- n({ type: "error", error: y });
113
- return;
114
- }
115
- const r = l.body.getReader(), i = {};
116
- this.setupStreamContext(i, s);
117
- const o = (m = s.options) == null ? void 0 : m.signal;
118
- o == null || o.addEventListener(
119
- "abort",
120
- () => {
121
- r.cancel(), this.handlerEnd(i);
122
- },
123
- { once: !0 }
124
- ), this.handlerStart(i, e), await $t(r, (y) => {
125
- this.handlerChunk(y, i);
126
- }), this.handlerEnd(i);
127
- }
128
- setupStreamContext(s, e) {
129
- const { chatConfig: n } = this.getChatOptions();
130
- s.chatConfig = n;
131
- }
132
- handlerChunk(s, e) {
133
- try {
134
- const n = JSON.parse(s);
135
- for (const a of this.responseHandlers)
136
- if (a.match(n, e)) {
137
- if (a.handler(n, e)) break;
138
- } else if (a.notMatchHandler && a.notMatchHandler(n, e))
139
- break;
140
- } catch (n) {
141
- console.error(n);
142
- }
143
- }
144
- handlerStart(s, e) {
145
- for (const n of this.responseHandlers)
146
- n.start && n.start(s, e);
147
- }
148
- handlerEnd(s) {
149
- for (const e of this.responseHandlers)
150
- e.end && e.end(s);
151
- }
152
- }
153
- function Nt(t, s) {
154
- let e = null, n = 0;
155
- return function(...a) {
156
- const p = Date.now(), l = p - n;
157
- if (l >= s)
158
- e && (clearTimeout(e), e = null), n = p, t.apply(this, a);
159
- else {
160
- e && clearTimeout(e);
161
- const u = s - l;
162
- e = setTimeout(() => {
163
- n = Date.now(), e = null, t.apply(this, a);
164
- }, u);
165
- }
166
- };
167
- }
168
- const Bt = (t) => {
169
- const s = F(!1), e = F(!1);
170
- let n = null;
171
- const a = () => {
172
- t.value && (s.value = t.value.scrollTop + t.value.clientHeight + 130 >= t.value.scrollHeight);
173
- }, p = () => {
174
- t.value && at(() => {
175
- var i;
176
- (i = t.value) == null || i.scrollTo({
177
- top: t.value.scrollHeight,
178
- behavior: "smooth"
179
- });
180
- });
181
- }, l = (i = 10, o = 150) => {
182
- if (!t.value) return;
183
- let m = 0, y = 0, f = 0;
184
- const R = () => {
185
- if (!t.value) return;
186
- const v = t.value.scrollHeight, T = t.value.scrollTop, G = t.value.clientHeight, L = T + G + 10 >= v;
187
- v !== y ? (y = v, f = 0, m = 0) : f++, !L && ((f >= 2 || m >= 2) && p(), !L && m < i && (m++, setTimeout(() => {
188
- requestAnimationFrame(() => {
189
- R();
190
- });
191
- }, o)));
192
- };
193
- setTimeout(() => {
194
- R(), a();
195
- }, 50);
196
- }, u = () => {
197
- !s.value || e.value || p();
198
- }, r = () => {
199
- e.value = !0, n && clearTimeout(n), n = setTimeout(() => {
200
- e.value = !1, n = null;
201
- }, 100);
202
- };
203
- return ve(() => {
204
- a(), t.value && (t.value.addEventListener("scroll", a, { passive: !0 }), t.value.addEventListener("wheel", r, { passive: !0 }), t.value.addEventListener("touchmove", r, { passive: !0 }));
205
- }), nt(() => {
206
- t.value && (t.value.removeEventListener("scroll", a), t.value.removeEventListener("wheel", r), t.value.removeEventListener("touchmove", r));
207
- }), {
208
- scrollToBottom: p,
209
- scrollToBottomWithRetry: l,
210
- autoScrollToBottom: u,
211
- isLastMessageInBottom: s,
212
- updateIsLastMessageInBottom: a
213
- };
214
- }, ge = (t) => {
215
- if (t)
216
- return typeof t == "function" && !("__name" in t || "setup" in t || "render" in t) ? t : (s) => ee(t, s);
217
- }, Pt = {
218
- // 图片格式
219
- jpg: "image/jpeg",
220
- jpeg: "image/jpeg",
221
- png: "image/png",
222
- gif: "image/gif",
223
- webp: "image/webp",
224
- bmp: "image/bmp",
225
- heic: "image/heic",
226
- tiff: "image/tiff",
227
- // 文档格式
228
- pdf: "application/pdf",
229
- doc: "application/msword",
230
- docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
231
- xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
232
- txt: "text/plain",
233
- md: "text/markdown",
234
- csv: "text/csv",
235
- json: "application/json",
236
- epub: "application/epub+zip",
237
- mobi: "application/x-mobipocket-ebook"
238
- }, _e = [
239
- "image/jpeg",
240
- "image/png",
241
- "image/gif",
242
- "image/webp",
243
- "image/bmp",
244
- "image/heic",
245
- "image/tiff"
246
- ];
247
- function Ht(t, s) {
248
- const { t: e } = $(), n = s * 1024 * 1024;
249
- if (t.size > n)
250
- throw new Error(e("fileUpload.error.fileSizeExceeded", {
251
- maxSizeMB: s,
252
- currentSizeMB: (t.size / 1024 / 1024).toFixed(2)
253
- }));
254
- }
255
- function Lt(t, s) {
256
- var l, u, r;
257
- const { t: e } = $();
258
- if (!s)
259
- return { valid: !1, error: e("fileUpload.error.unsupportedModel") };
260
- const n = ((l = t.name.split(".").pop()) == null ? void 0 : l.toLowerCase()) || "";
261
- if (!((u = s.supportImage) != null && u.supportedFileTypes.includes(n)))
262
- return {
263
- valid: !1,
264
- error: e("fileUpload.error.unsupportedFormat", { extension: n })
265
- };
266
- const a = ((r = s.supportImage) == null ? void 0 : r.maxImageSize) || 0, p = a * 1024 * 1024;
267
- return t.size > p ? {
268
- valid: !1,
269
- error: e("fileUpload.error.sizeLimitExceeded", { maxSize: a })
270
- } : { valid: !0 };
271
- }
272
- function Ut(t) {
273
- return _e.includes(t) ? "image" : "document";
274
- }
275
- const zt = async (t, s) => {
276
- var a;
277
- const { t: e } = $();
278
- if (!s)
279
- throw new Error(e("fileUpload.error.unsupportedModel"));
280
- if ((a = s.supportImage) != null && a.maxFilesPerRequest && t.length > s.supportImage.maxFilesPerRequest)
281
- throw new Error(e("fileUpload.error.maxFilesExceeded", { maxFiles: s.supportImage.maxFilesPerRequest }));
282
- return await Promise.all(t.map((p) => qt(p, s)));
283
- }, qt = async (t, s) => {
284
- var l;
285
- const { t: e } = $(), n = Ut(t.type), a = Lt(t, s);
286
- if (!a.valid)
287
- throw new Error(a.error);
288
- const p = ((l = s.supportImage) == null ? void 0 : l.maxImageSize) || 0;
289
- if (Ht(t, p), n === "image")
290
- return {
291
- type: "image_url",
292
- image_url: {
293
- url: t.base64
294
- },
295
- filename: t.name
296
- };
297
- if (n === "document")
298
- return {
299
- type: "file",
300
- mediaType: t.type,
301
- data: t.base64,
302
- filename: t.name
303
- };
304
- throw new Error(e("fileUpload.error.unsupportedFileType", { fileCategory: n }));
305
- }, Gt = (t) => new Promise((s, e) => {
306
- const n = new FileReader();
307
- n.readAsDataURL(t), n.onload = () => {
308
- const a = {
309
- name: t.name,
310
- type: t.type,
311
- size: t.size,
312
- lastModified: t.lastModified,
313
- base64: n.result
314
- };
315
- s(a);
316
- }, n.onerror = (a) => e(a);
317
- }), Jt = () => {
318
- const { t } = $(), s = F([]), e = F([]);
319
- return {
320
- attachments: s,
321
- templateData: e,
322
- processAttachments: async (u, r) => {
323
- let i = [];
324
- if (u.length === 0)
325
- return { apiContent: i };
326
- try {
327
- return i = await zt(u, r), {
328
- apiContent: i
329
- };
330
- } catch (o) {
331
- return xe({
332
- type: "error",
333
- title: t("fileUpload.error.processFailed"),
334
- message: o instanceof Error ? o.message : t("fileUpload.error.unknownError"),
335
- position: "top-right"
336
- }), null;
337
- }
338
- },
339
- clearAttachments: () => {
340
- s.value = [];
341
- },
342
- handleFilesSelected: async (u, r) => {
343
- if (!(!u || u.length === 0)) {
344
- e.value.length || e.value.unshift({
345
- type: "text",
346
- content: r
347
- });
348
- for (const i of u) {
349
- e.value.push({
350
- type: "template",
351
- content: i.name || ""
352
- });
353
- try {
354
- if (s.value.find((m) => m.name === i.name))
355
- continue;
356
- const o = await Gt(i);
357
- s.value.push(o);
358
- } catch (o) {
359
- xe({
360
- type: "error",
361
- title: t("fileUpload.error.validationFailed"),
362
- message: o instanceof Error ? o.message : t("fileUpload.error.unknownError"),
363
- position: "top-right"
364
- });
365
- }
366
- }
367
- }
368
- },
369
- handleTemplateEdit: (u, r) => {
370
- const i = u.value, o = new Set(
371
- s.value.map((f) => f.name).filter((f) => !!f)
372
- ), m = i.filter((f) => {
373
- if (f.type === "template") {
374
- const R = f.content;
375
- return R && o.has(R);
376
- }
377
- return !0;
378
- }), y = new Set(
379
- m.filter((f) => f.type === "template" && f.content).map((f) => f.content)
380
- );
381
- for (let f = s.value.length - 1; f >= 0; f--) {
382
- const v = s.value[f].name;
383
- v && !y.has(v) && s.value.splice(f, 1);
384
- }
385
- return m;
386
- }
387
- };
388
- }, Wt = { class: "attachments-renderer" }, jt = ["onClick"], Vt = { class: "image-wrapper" }, Kt = ["src", "alt"], Zt = ["onClick"], Yt = { class: "file-name" }, Xt = ["src", "alt"], Qt = /* @__PURE__ */ X({
389
- __name: "AttachmentsRenderer",
390
- props: {
391
- attachments: {}
392
- },
393
- emits: ["remove"],
394
- setup(t, { emit: s }) {
395
- const e = t, n = s, a = F(null), p = (m) => _e.includes(m.type), l = O(() => e.attachments.filter((m) => p(m))), u = O(() => e.attachments.filter((m) => !p(m))), r = (m) => {
396
- n("remove", m);
397
- }, i = (m) => {
398
- a.value = m, document.body.style.overflow = "hidden";
399
- }, o = () => {
400
- a.value = null, document.body.style.overflow = "";
401
- };
402
- return (m, y) => (E(), I("div", Wt, [
403
- (E(!0), I(le, null, he(l.value, (f, R) => (E(), I("div", {
404
- key: f.name,
405
- class: "image-thumbnail",
406
- onClick: (v) => i(f)
407
- }, [
408
- b("div", Vt, [
409
- b("img", {
410
- src: f.base64,
411
- alt: f.name
412
- }, null, 8, Kt)
413
- ]),
414
- b("button", {
415
- class: "delete-btn",
416
- onClick: ot((v) => r(f), ["stop"]),
417
- type: "button"
418
- }, [
419
- D(S(yt), { class: "delete-btn-icon" })
420
- ], 8, Zt),
421
- y[0] || (y[0] = b("div", { class: "hover-overlay" }, [
422
- b("span", { class: "preview-text" }, "预览")
423
- ], -1))
424
- ], 8, jt))), 128)),
425
- (E(!0), I(le, null, he(u.value, (f) => (E(), I("div", {
426
- key: f.name,
427
- class: "file-item"
428
- }, [
429
- b("span", Yt, H(f.name), 1)
430
- ]))), 128)),
431
- D(ie, { name: "fullscreen-fade" }, {
432
- default: j(() => [
433
- a.value ? (E(), I("div", {
434
- key: 0,
435
- class: "fullscreen-overlay",
436
- onClick: o
437
- }, [
438
- D(ie, { name: "image-scale" }, {
439
- default: j(() => [
440
- a.value ? (E(), I("img", {
441
- key: 0,
442
- src: a.value.base64,
443
- alt: a.value.name
444
- }, null, 8, Xt)) : V("", !0)
445
- ]),
446
- _: 1
447
- })
448
- ])) : V("", !0)
449
- ]),
450
- _: 1
451
- })
452
- ]));
453
- }
454
- }), es = /* @__PURE__ */ Q(Qt, [["__scopeId", "data-v-63821ae8"]]), ts = { class: "template-data-renderer" }, ss = {
455
- key: 0,
456
- class: "text-item"
457
- }, ns = {
458
- key: 1,
459
- class: "template-item"
460
- }, as = ["onClick"], os = {
461
- key: 0,
462
- class: "image-preview"
463
- }, rs = ["src", "alt", "onClick"], ls = ["src", "alt"], is = /* @__PURE__ */ X({
464
- __name: "TemplateDataRenderer",
465
- props: {
466
- templateData: { default: () => [] },
467
- attachments: { default: () => [] }
468
- },
469
- setup(t) {
470
- const s = t, e = F(null), n = (i) => {
471
- if (i.type !== "template" || !i.content)
472
- return !1;
473
- const o = s.attachments.find((m) => m.name === i.content);
474
- return o ? _e.includes(o.type) : !1;
475
- }, a = (i) => {
476
- if (i.type !== "template" || !i.content)
477
- return "";
478
- const o = s.attachments.find((m) => m.name === i.content);
479
- return (o == null ? void 0 : o.base64) || "";
480
- }, p = (i) => {
481
- if (!(i.type !== "template" || !i.content))
482
- return s.attachments.find((o) => o.name === i.content);
483
- }, l = (i) => {
484
- const o = p(i);
485
- o && u(o);
486
- }, u = (i) => {
487
- e.value = i, document.body.style.overflow = "hidden";
488
- }, r = () => {
489
- e.value = null, document.body.style.overflow = "";
490
- };
491
- return (i, o) => (E(), I("div", ts, [
492
- (E(!0), I(le, null, he(t.templateData, (m, y) => (E(), I(le, { key: y }, [
493
- m.type === "text" ? (E(), I("span", ss, H(m.content), 1)) : m.type === "template" ? (E(), I("span", ns, [
494
- D(S(St), {
495
- width: "200",
496
- trigger: "hover",
497
- content: m.content,
498
- placement: "top"
499
- }, {
500
- reference: j(() => [
501
- b("span", {
502
- class: "template-text",
503
- onClick: (f) => l(m)
504
- }, H(m.content), 9, as)
505
- ]),
506
- default: j(() => [
507
- n(m) ? (E(), I("div", os, [
508
- b("img", {
509
- class: "image-preview-img",
510
- src: a(m),
511
- alt: m.content,
512
- onClick: (f) => l(m)
513
- }, null, 8, rs)
514
- ])) : V("", !0)
515
- ]),
516
- _: 2
517
- }, 1032, ["content"])
518
- ])) : V("", !0)
519
- ], 64))), 128)),
520
- D(ie, { name: "fullscreen-fade" }, {
521
- default: j(() => [
522
- e.value ? (E(), I("div", {
523
- key: 0,
524
- class: "fullscreen-overlay",
525
- onClick: r
526
- }, [
527
- D(ie, { name: "image-scale" }, {
528
- default: j(() => [
529
- e.value ? (E(), I("img", {
530
- key: 0,
531
- src: e.value.base64,
532
- alt: e.value.name
533
- }, null, 8, ls)) : V("", !0)
534
- ]),
535
- _: 1
536
- })
537
- ])) : V("", !0)
538
- ]),
539
- _: 1
540
- })
541
- ]));
542
- }
543
- }), cs = /* @__PURE__ */ Q(is, [["__scopeId", "data-v-e158cad0"]]), us = {
544
- class: "tr-bubble__reasoning",
545
- "data-type": "reasoning"
546
- }, ds = { class: "title" }, ms = { class: "detail" }, ps = /* @__PURE__ */ X({
547
- __name: "ReasoningRenderer",
548
- props: {
549
- content: {},
550
- thinking: { type: Boolean }
551
- },
552
- setup(t) {
553
- const s = t, e = F(!1), { t: n } = $(), a = () => {
554
- e.value = !e.value;
555
- }, p = new Be({
556
- defaultAttrs: { class: "markdown-content" },
557
- mdConfig: { html: !0 }
558
- }), l = (u) => p.render({ content: u.content });
559
- return (u, r) => (E(), I("div", us, [
560
- b("div", {
561
- class: "header",
562
- onClick: a
563
- }, [
564
- b("div", {
565
- class: K(["icon-and-text", { thinking: s.thinking }])
566
- }, [
567
- r[0] || (r[0] = b("svg", {
568
- class: "thinking-icon",
569
- width: "1em",
570
- height: "1em",
571
- viewBox: "0 0 24 24",
572
- xmlns: "http://www.w3.org/2000/svg",
573
- fill: "none",
574
- stroke: "currentColor",
575
- "stroke-width": "2",
576
- "stroke-linecap": "round",
577
- "stroke-linejoin": "round"
578
- }, [
579
- b("circle", {
580
- cx: "12",
581
- cy: "12",
582
- r: "1"
583
- }),
584
- b("path", { d: "M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z" }),
585
- b("path", { d: "M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z" })
586
- ], -1)),
587
- b("span", ds, H(s.thinking ? S(n)("reasoning.thinking") : S(n)("reasoning.thinkingEnd")), 1)
588
- ], 2),
589
- D(S(ye), {
590
- class: K(["expand-icon", { "-rotate-90": !e.value }])
591
- }, null, 8, ["class"])
592
- ]),
593
- Ae(b("div", ms, [
594
- r[1] || (r[1] = b("div", { class: "side-border" }, [
595
- b("div", { class: "dot-wrapper" }, [
596
- b("div", { class: "dot" })
597
- ]),
598
- b("div", { class: "border-line" })
599
- ], -1)),
600
- D(l, {
601
- content: s.content,
602
- class: "detail-content"
603
- }, null, 8, ["content"])
604
- ], 512), [
605
- [De, e.value]
606
- ])
607
- ]));
608
- }
609
- }), gs = /* @__PURE__ */ Q(ps, [["__scopeId", "data-v-1ffff0cd"]]), hs = { class: "tr-bubble__step-tool" }, fs = { class: "tr-bubble__step-tool-header" }, vs = { class: "tr-bubble__step-tool-left" }, ys = { class: "tr-bubble__step-tool-title" }, _s = { class: "tr-bubble__step-tool-name" }, ws = { class: "tr-bubble__step-tool-expand" }, bs = {
610
- key: 0,
611
- class: "tr-bubble__step-tool-params"
612
- }, Cs = ["innerHTML"], Ms = 100, Ss = /* @__PURE__ */ X({
613
- __name: "ToolRenderer",
614
- props: {
615
- name: {},
616
- status: {},
617
- content: {},
618
- formatPretty: { type: Boolean },
619
- defaultOpen: { type: Boolean }
620
- },
621
- setup(t) {
622
- const s = (o, m) => {
623
- let y = 0;
624
- const f = (R) => {
625
- if (!R || typeof R != "object")
626
- return !1;
627
- if (Array.isArray(R)) {
628
- for (const v of R)
629
- if (f(v))
630
- return !0;
631
- return !1;
632
- }
633
- for (const v of Object.values(R))
634
- if (y += 1, y > m || f(v))
635
- return !0;
636
- return !1;
637
- };
638
- return f(o);
639
- }, e = (o) => o.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), n = t, { t: a } = $(), p = F(n.defaultOpen ?? !1), l = /* @__PURE__ */ new Map([
640
- ["running", { text: a("toolStatus.running"), icon: _t }],
641
- ["success", { text: a("toolStatus.success"), icon: ke }],
642
- ["failed", { text: a("toolStatus.failed"), icon: wt }],
643
- ["cancelled", { text: a("toolStatus.cancelled"), icon: bt }]
644
- ]), u = O(() => l.get(n.status) || { text: "", icon: ke }), r = rt(), i = (o) => {
645
- if (!o)
646
- return "";
647
- let m = "", y = o;
648
- const f = n.formatPretty ? 2 : 0;
649
- try {
650
- typeof o == "string" ? (y = JSON.parse(o), m = JSON.stringify(y, null, f)) : (y = o, m = JSON.stringify(o, null, f));
651
- } catch (v) {
652
- console.warn(v);
653
- }
654
- return s(y, Ms) ? e(m) : (m = m.replace(
655
- /("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g,
656
- (v) => {
657
- let T = "number";
658
- return /^"/.test(v) ? T = /:$/.test(v) ? "key" : "string" : /true|false/.test(v) ? T = "boolean" : /null/.test(v) && (T = "null"), `<span class="${r[T]}">${e(v)}</span>`;
659
- }
660
- ), m);
661
- };
662
- return (o, m) => (E(), I("div", hs, [
663
- b("div", fs, [
664
- b("div", vs, [
665
- (E(), $e(lt(u.value.icon), {
666
- class: K(["tr-bubble__step-tool-icon", `icon-${n.status}`])
667
- }, null, 8, ["class"])),
668
- b("span", ys, [
669
- it(H(u.value.text) + " ", 1),
670
- b("span", _s, H(n.name), 1)
671
- ])
672
- ]),
673
- b("div", ws, [
674
- D(S(ye), {
675
- class: K(["expand-icon", { "-rotate-90": !p.value }]),
676
- onClick: m[0] || (m[0] = (y) => p.value = !p.value)
677
- }, null, 8, ["class"])
678
- ])
679
- ]),
680
- p.value ? (E(), I("div", bs, [
681
- m[1] || (m[1] = b("hr", { class: "tr-bubble__step-tool-hr" }, null, -1)),
682
- b("div", {
683
- class: "tr-bubble__step-tool-params-content",
684
- innerHTML: i(n.content)
685
- }, null, 8, Cs)
686
- ])) : V("", !0)
687
- ]));
688
- }
689
- }), Rs = "_key_1b448_2", ks = "_number_1b448_6", xs = "_string_1b448_10", Es = "_boolean_1b448_14", Is = {
690
- key: Rs,
691
- number: ks,
692
- string: xs,
693
- boolean: Es,
694
- null: "_null_1b448_18"
695
- }, Ts = {
696
- $style: Is
697
- }, Fs = /* @__PURE__ */ Q(Ss, [["__cssModules", Ts], ["__scopeId", "data-v-398a0327"]]);
698
- class As {
699
- constructor() {
700
- this.events = {}, this.events = /* @__PURE__ */ Object.create(null);
701
- }
702
- /**
703
- * @param {string} eventName - 事件名
704
- * @param {Function} callback - 回调函数
705
- * @param {boolean} [once=false] - 是否只触发一次
706
- */
707
- on(s, e, n = !1) {
708
- if (typeof e != "function")
709
- throw new TypeError("回调必须是函数");
710
- this.events[s] || (this.events[s] = []), this.events[s].push({ callback: e, once: n });
711
- }
712
- /**
713
- * @param {string} eventName - 事件名
714
- * @param {Function} callback - 要移除的回调(必须是注册时的同一个函数引用)
715
- */
716
- off(s, e) {
717
- this.events[s] && (this.events[s] = this.events[s].filter((n) => n.callback !== e), this.events[s].length === 0 && delete this.events[s]);
718
- }
719
- /**
720
- * @param {string} eventName - 事件名
721
- * @param {...any} args - 传递给回调的参数
722
- */
723
- emit(s, ...e) {
724
- if (!this.events[s]) return;
725
- [...this.events[s]].forEach((a, p) => {
726
- const { callback: l, once: u } = a;
727
- l.apply(this, e), u && this.events[s].splice(p, 1);
728
- }), this.events[s].length === 0 && delete this.events[s];
729
- }
730
- /**
731
- * @param {string} eventName - 事件名
732
- * @param {Function} callback - 回调函数
733
- */
734
- once(s, e) {
735
- this.on(s, e, !0);
736
- }
737
- }
738
- const oe = new As(), Ds = {
739
- key: 0,
740
- class: "loading-wrapper"
741
- }, $s = {
742
- class: "loading-container",
743
- type: "loading-text"
744
- }, Os = /* @__PURE__ */ X({
745
- __name: "GeneratingComponent",
746
- props: {
747
- emitter: {},
748
- message: {},
749
- showThinkingResult: { type: Boolean }
750
- },
751
- setup(t) {
752
- const s = t, { t: e } = $(), n = F(e("loading.response")), a = F(!1), p = /* @__PURE__ */ new Map([
753
- ["running", { textKey: "toolStatus.running" }],
754
- ["success", { textKey: "toolStatus.success" }],
755
- ["failed", { textKey: "toolStatus.failed" }],
756
- ["cancelled", { textKey: "toolStatus.cancelled" }]
757
- ]), l = (u) => {
758
- var i, o;
759
- if (u.type === "done") {
760
- n.value = "";
761
- return;
762
- }
763
- if (u.type === "schema-card") {
764
- n.value = e("loading.generatingCard");
765
- return;
766
- }
767
- if (s.showThinkingResult) {
768
- n.value = e("loading.response");
769
- return;
770
- }
771
- if (u.type === "tool") {
772
- const { toolCallData: m } = u, y = ((i = p.get(m.status)) == null ? void 0 : i.textKey) || "loading.response";
773
- n.value = `${e(y)} ${m.name}...`;
774
- return;
775
- }
776
- const r = u.chatMessage.messages[u.chatMessage.messages.length - 1];
777
- r && (a.value || (a.value = (o = u.chatMessage.messages) == null ? void 0 : o.some((m) => m.type.startsWith("schema-card"))), n.value = a.value ? `${r.content}...` : e("loading.response"));
778
- };
779
- return ve(() => {
780
- s.emitter.on("notification", l);
781
- }), Oe(() => {
782
- s.emitter.off("notification", l);
783
- }), (u, r) => n.value ? (E(), I("div", Ds, [
784
- b("div", $s, H(n.value), 1)
785
- ])) : V("", !0);
786
- }
787
- }), Ns = /* @__PURE__ */ Q(Os, [["__scopeId", "data-v-14a1c66c"]]);
788
- function Bs({
789
- chat: t,
790
- saveState: s
791
- }) {
792
- const { t: e } = $();
793
- return {
794
- continueChatAction: {
795
- name: "continueChat",
796
- description: e("continueChat.description"),
797
- execute: (n, a) => {
798
- t({
799
- llmFriendlyMessage: `${n.message},${e("continueChat.messageParam")}${JSON.stringify(a.state || {})}`,
800
- humanFriendlyMessage: n.message,
801
- context: a
802
- });
803
- },
804
- parameters: {
805
- type: "object",
806
- properties: {
807
- message: {
808
- type: "string",
809
- description: e("continueChat.paramDescription")
810
- }
811
- }
812
- }
813
- },
814
- saveStateAction: {
815
- name: "saveState",
816
- description: e("saveState.description"),
817
- execute: (n, a) => {
818
- s(a);
819
- },
820
- parameters: { type: "null" }
821
- }
822
- };
823
- }
824
- const Ps = { class: "tg-playground-error-card" }, Hs = { class: "card-title" }, Ls = /* @__PURE__ */ X({
825
- __name: "ErrorText",
826
- props: {
827
- content: {}
828
- },
829
- setup(t) {
830
- const s = Et(), e = It(), { t: n } = $(), a = F(!1), p = () => {
831
- a.value = !a.value;
832
- };
833
- return (l, u) => (E(), I("div", Ps, [
834
- b("div", {
835
- class: "card-header",
836
- onClick: p
837
- }, [
838
- D(S(e), { class: "icon-error" }),
839
- b("span", Hs, H(S(n)("error.title")), 1),
840
- D(S(s), {
841
- class: K(["icon-right", { expanded: a.value }])
842
- }, null, 8, ["class"])
843
- ]),
844
- b("pre", {
845
- class: K(["card-body", { collapsed: !a.value }])
846
- }, " " + H(t.content) + `
847
- `, 3)
848
- ]));
849
- }
850
- }), Us = /* @__PURE__ */ Q(Ls, [["__scopeId", "data-v-a0f77c05"]]);
851
- function zs(t) {
852
- const s = F(0), e = F(0);
853
- let n = null, a = null;
854
- const p = (r) => {
855
- if (!r) {
856
- s.value = 0, e.value = 0;
857
- return;
858
- }
859
- const i = r.getBoundingClientRect();
860
- s.value = i.width, e.value = i.height;
861
- }, l = (r) => {
862
- a !== null && cancelAnimationFrame(a), a = requestAnimationFrame(() => {
863
- p(r), a = null;
864
- });
865
- }, u = () => {
866
- n && t.value && n.unobserve(t.value), n = null, a !== null && (cancelAnimationFrame(a), a = null);
867
- };
868
- return ve(() => {
869
- typeof ResizeObserver > "u" || !t.value || (n = new ResizeObserver((r) => {
870
- const o = r[0].target;
871
- l(o);
872
- }), n.observe(t.value), p(t.value));
873
- }), Oe(() => {
874
- u();
875
- }), {
876
- width: s,
877
- height: e
878
- };
879
- }
880
- function Pe(t) {
881
- const { t: s } = $(), { client: e, useStreamByDefault: n = !0, errorMessage: a = s("message.requestFailed"), initialMessages: p = [] } = t, l = F([...p]), u = F(""), r = F(n);
882
- let i = null;
883
- const o = ue({
884
- status: q.INIT,
885
- errorMsg: null
886
- }), m = (C) => {
887
- var _;
888
- const g = (_ = t.events) == null ? void 0 : _.onReceiveData;
889
- let h = !1;
890
- if (g && g(C, l, () => {
891
- h = !0;
892
- }), !h) {
893
- const k = {
894
- role: "assistant",
895
- content: C.choices[0].message.content
896
- };
897
- l.value.push(k);
898
- }
899
- }, y = async (C) => {
900
- const g = await e.chat({
901
- messages: fe(l.value),
902
- options: {
903
- stream: !1,
904
- signal: C.signal
905
- }
906
- });
907
- m(g);
908
- }, f = (C) => {
909
- var _, k;
910
- const g = (_ = t.events) == null ? void 0 : _.onReceiveData;
911
- let h = !1;
912
- if (g && g(C, l, () => {
913
- h = !0;
914
- }), !h) {
915
- l.value[l.value.length - 1].role === "user" && l.value.push({ role: "assistant", content: "" });
916
- const B = (k = C.choices) == null ? void 0 : k[0];
917
- B && B.delta.content && (l.value[l.value.length - 1].content += B.delta.content);
918
- }
919
- }, R = async (C) => {
920
- await e.chatStream(
921
- {
922
- messages: fe(l.value),
923
- options: {
924
- stream: !0,
925
- signal: C.signal
926
- }
927
- },
928
- {
929
- onData: (g) => {
930
- o.status = q.STREAMING, f(g);
931
- },
932
- onError: (g) => {
933
- o.status = q.ERROR, o.errorMsg = a, console.error("Stream request error:", g);
934
- },
935
- onDone: (g) => {
936
- var k;
937
- const h = (k = t.events) == null ? void 0 : k.onFinish;
938
- let _ = !1;
939
- if (h && h(g, { messages: l, messageState: o }, () => {
940
- _ = !0;
941
- }), !_) {
942
- if (g === "aborted" || o.status === q.ABORTED)
943
- return;
944
- o.status = q.FINISHED;
945
- }
946
- }
947
- }
948
- );
949
- }, v = async () => {
950
- o.status = q.PROCESSING, o.errorMsg = null, i = new AbortController();
951
- try {
952
- r.value ? await R(i) : await y(i);
953
- } catch (C) {
954
- o.errorMsg = a, o.status = q.ERROR, console.error("Send message error:", C);
955
- } finally {
956
- i = null;
957
- }
958
- }, T = async (C = u.value, g = !0) => {
959
- if (ae.includes(o.status) || !C || typeof C == "string" && !C.trim() || Array.isArray(C) && C.length === 0)
960
- return;
961
- const h = {
962
- role: "user",
963
- content: C
964
- };
965
- l.value.push(h), g && (u.value = ""), await v();
966
- }, G = async () => {
967
- ae.includes(o.status) || await v();
968
- }, L = () => {
969
- i && (i.abort(), i = null, o.status = q.ABORTED);
970
- }, N = async (C) => {
971
- C === 0 || !l.value[C] || l.value[C].role === "user" || (l.value.splice(C), await v());
972
- }, J = () => {
973
- l.value = [], o.errorMsg = null;
974
- }, Z = (C) => {
975
- Array.isArray(C) ? l.value.push(...C) : l.value.push(C);
976
- };
977
- return {
978
- conversationId: t.conversationId,
979
- messages: l,
980
- messageState: o,
981
- inputMessage: u,
982
- useStream: r,
983
- sendMessage: T,
984
- send: G,
985
- clearMessages: J,
986
- addMessage: Z,
987
- abortRequest: L,
988
- retryRequest: N
989
- };
990
- }
991
- class qs {
992
- constructor(s, e) {
993
- this.messageManagerMap = /* @__PURE__ */ new Map(), this.messageManagerMap = /* @__PURE__ */ new Map(), this.conversationState = s, this.options = e;
994
- }
995
- getMessageManager(s) {
996
- const e = this.messageManagerMap.get(s);
997
- if (e)
998
- return e;
999
- if (!this.conversationState.conversations.find(
1000
- (a) => a.id === s
1001
- ))
1002
- throw new Error(`Conversation not found for id: ${s}`);
1003
- return this.setMessageManager(s);
1004
- }
1005
- setMessageManager(s, e) {
1006
- if (this.messageManagerMap.has(s))
1007
- return this.messageManagerMap.get(s);
1008
- const n = Pe(e ?? { ...this.options, conversationId: s });
1009
- return this.messageManagerMap.set(s, n), n;
1010
- }
1011
- deleteMessageManager(s) {
1012
- this.messageManagerMap.delete(s);
1013
- }
1014
- }
1015
- const ne = (t) => Ne(t) ? ne(S(t)) : ct(t) ? ne(fe(t)) : Array.isArray(t) ? t.map(ne) : t && typeof t == "object" ? Object.keys(t).reduce((s, e) => (s[e] = ne(t[e]), s), {}) : t;
1016
- class Gs {
1017
- constructor(s = "genui-ai", e = "conversations", n = "conversations-list") {
1018
- this.db = null, this.dbName = s, this.storeName = e, this.dataKey = n;
1019
- }
1020
- async openDB() {
1021
- return this.db ? this.db : new Promise((s, e) => {
1022
- const n = indexedDB.open(this.dbName, 1);
1023
- n.onerror = () => {
1024
- e(new Error("打开 IndexedDB 失败"));
1025
- }, n.onsuccess = () => {
1026
- this.db = n.result, s(this.db);
1027
- }, n.onupgradeneeded = (a) => {
1028
- const p = a.target.result;
1029
- p.objectStoreNames.contains(this.storeName) || p.createObjectStore(this.storeName);
1030
- };
1031
- });
1032
- }
1033
- async saveConversations(s) {
1034
- try {
1035
- const a = (await this.openDB()).transaction([this.storeName], "readwrite").objectStore(this.storeName), p = ne(s);
1036
- return new Promise((l, u) => {
1037
- const r = a.put(p, this.dataKey);
1038
- r.onsuccess = () => l(), r.onerror = () => {
1039
- console.error("保存会话失败:", r.error), u(r.error);
1040
- };
1041
- });
1042
- } catch (e) {
1043
- throw console.error("保存会话失败:", e), e;
1044
- }
1045
- }
1046
- async loadConversations() {
1047
- try {
1048
- const n = (await this.openDB()).transaction([this.storeName], "readonly").objectStore(this.storeName);
1049
- return new Promise((a, p) => {
1050
- const l = n.get(this.dataKey);
1051
- l.onsuccess = () => {
1052
- const u = l.result;
1053
- if (!u) {
1054
- a([]);
1055
- return;
1056
- }
1057
- let r = [];
1058
- if (typeof u == "string")
1059
- try {
1060
- r = JSON.parse(u);
1061
- } catch (i) {
1062
- console.error("解析会话数据失败:", i), a([]);
1063
- return;
1064
- }
1065
- else
1066
- r = Array.isArray(u) ? u : [];
1067
- a(r);
1068
- }, l.onerror = () => {
1069
- console.error("加载会话失败:", l.error), p(l.error);
1070
- };
1071
- });
1072
- } catch (s) {
1073
- return console.error("加载会话失败:", s), [];
1074
- }
1075
- }
1076
- }
1077
- function Js() {
1078
- return Date.now().toString(36) + Math.random().toString(36).substring(2, 9);
1079
- }
1080
- function Ws(t) {
1081
- const { t: s } = $(), {
1082
- client: e,
1083
- storage: n = new Gs(),
1084
- autoSave: a = !0,
1085
- allowEmpty: p = !1,
1086
- useStreamByDefault: l = !0,
1087
- errorMessage: u,
1088
- events: r
1089
- } = t, i = u || s("message.requestFailed"), o = ue({
1090
- conversations: [],
1091
- currentId: null,
1092
- loading: !1
1093
- });
1094
- let m = !1;
1095
- const y = new qs(o, {
1096
- client: e,
1097
- useStreamByDefault: l,
1098
- conversationId: "",
1099
- errorMessage: i,
1100
- initialMessages: [],
1101
- events: {
1102
- onReceiveData: r == null ? void 0 : r.onReceiveData,
1103
- onFinish: r == null ? void 0 : r.onFinish
1104
- }
1105
- }), f = O(() => o.currentId ? y.getMessageManager(o.currentId) : Pe({
1106
- client: e,
1107
- useStreamByDefault: l,
1108
- conversationId: "",
1109
- errorMessage: i,
1110
- initialMessages: [],
1111
- events: {
1112
- onReceiveData: r == null ? void 0 : r.onReceiveData,
1113
- onFinish: r == null ? void 0 : r.onFinish
1114
- }
1115
- }));
1116
- ce(
1117
- () => f.value,
1118
- () => {
1119
- y.messageManagerMap.forEach((g) => {
1120
- const h = g.messages.value;
1121
- if (o.currentId && h.length > 0) {
1122
- const _ = o.conversations.findIndex((k) => k.id === g.conversationId);
1123
- _ !== -1 && (o.conversations[_].messages = [...h], o.conversations[_].updatedAt = Date.now(), a && N());
1124
- }
1125
- });
1126
- },
1127
- { deep: !0 }
1128
- );
1129
- const R = (g, h = {}) => {
1130
- const _ = g || s("conversation.newConversation");
1131
- if (!p && f.value.messages.value.length === 0 && o.currentId)
1132
- return o.currentId;
1133
- const k = Js(), B = {
1134
- id: k,
1135
- title: _,
1136
- createdAt: Date.now(),
1137
- updatedAt: Date.now(),
1138
- messages: [],
1139
- metadata: h
1140
- };
1141
- return o.conversations.unshift(B), y.setMessageManager(k, { ...t, conversationId: k }), v(k), a && N(), k;
1142
- }, v = (g) => {
1143
- const h = o.conversations.find((_) => _.id === g);
1144
- h && (o.currentId = g, y.setMessageManager(g, { ...t, initialMessages: h.messages, conversationId: g }));
1145
- }, T = (g) => {
1146
- const h = o.conversations.findIndex((_) => _.id === g);
1147
- h !== -1 && (y.deleteMessageManager(g), o.conversations.splice(h, 1), o.currentId === g && (o.conversations.length > 0 ? v(o.conversations[0].id) : o.currentId = null), a && N());
1148
- }, G = (g, h) => {
1149
- const _ = o.conversations.find((k) => k.id === g);
1150
- _ && (_.title = h, _.updatedAt = Date.now(), a && N());
1151
- }, L = (g, h) => {
1152
- const _ = o.conversations.find((k) => k.id === g);
1153
- _ && (_.metadata = { ..._.metadata, ...h }, _.updatedAt = Date.now(), a && N());
1154
- }, N = async () => {
1155
- try {
1156
- await n.saveConversations(o.conversations);
1157
- } catch (g) {
1158
- console.error("保存会话失败:", g);
1159
- }
1160
- }, J = async () => {
1161
- o.loading = !0;
1162
- try {
1163
- const g = await n.loadConversations();
1164
- o.conversations = g, g.length > 0 && !o.currentId && v(g[0].id), !m && (r != null && r.onLoaded) && (m = !0, r.onLoaded(g));
1165
- } catch (g) {
1166
- console.error("加载会话失败:", g);
1167
- } finally {
1168
- o.loading = !1;
1169
- }
1170
- }, Z = async (g) => {
1171
- const h = o.conversations.find((_) => _.id === g);
1172
- if (!h || h.messages.length < 2)
1173
- return (h == null ? void 0 : h.title) || s("conversation.newConversation");
1174
- try {
1175
- const _ = {
1176
- role: "system",
1177
- content: "请根据以下对话内容,生成一个简短的标题(不超过20个字符)。只需要返回标题文本,不需要任何解释或额外内容。"
1178
- }, k = h.messages.slice(0, Math.min(4, h.messages.length)), U = (await e.chat({
1179
- messages: [_, ...k],
1180
- options: {
1181
- stream: !1,
1182
- max_tokens: 30
1183
- }
1184
- })).choices[0].message.content.trim();
1185
- return G(g, U), U;
1186
- } catch (_) {
1187
- return console.error("生成标题失败:", _), h.title;
1188
- }
1189
- }, C = () => o.currentId && o.conversations.find((g) => g.id === o.currentId) || null;
1190
- return J(), {
1191
- state: o,
1192
- messageManager: f,
1193
- createConversation: R,
1194
- switchConversation: v,
1195
- deleteConversation: T,
1196
- updateTitle: G,
1197
- updateMetadata: L,
1198
- saveConversations: N,
1199
- loadConversations: J,
1200
- generateTitle: Z,
1201
- getCurrentConversation: C
1202
- };
1203
- }
1204
- class js {
1205
- constructor() {
1206
- this.thinkStartFlag = "<think>", this.thinkEndFlag = "</think>", this.startRegex = new RegExp(`${this.thinkStartFlag}`), this.endRegex = new RegExp(`${this.thinkEndFlag}`), this.partialStartRegex = new RegExp(`${Ee(this.thinkStartFlag)}$`), this.partialEndRegex = new RegExp(`${Ee(this.thinkEndFlag)}$`);
1207
- }
1208
- get regExpMap() {
1209
- return {
1210
- start: {
1211
- full: this.startRegex,
1212
- partial: this.partialStartRegex
1213
- },
1214
- end: {
1215
- full: this.endRegex,
1216
- partial: this.partialEndRegex
1217
- }
1218
- };
1219
- }
1220
- }
1221
- const W = (t) => {
1222
- var s, e;
1223
- return ((e = (s = t.choices) == null ? void 0 : s[0]) == null ? void 0 : e.delta) ?? {};
1224
- };
1225
- function Vs(t, s, e, n, a) {
1226
- const {
1227
- id: p,
1228
- function: { arguments: l, result: u }
1229
- } = t[0], r = e[p];
1230
- if (r && (r.status = "success", r.content = JSON.stringify({ arguments: l, result: u }, null, 2), oe.emit("notification", {
1231
- type: "tool",
1232
- delta: s,
1233
- toolCallData: te(r),
1234
- chatMessage: te(n)
1235
- }), a)) {
1236
- const { t: i } = $();
1237
- n.content += i("toolCall.context", {
1238
- toolName: r.name,
1239
- toolParams: JSON.stringify(l),
1240
- toolResult: JSON.stringify(u)
1241
- }) + `
1242
-
1243
- `;
1244
- }
1245
- }
1246
- function Ks(t, s, e, n, a) {
1247
- t.forEach((p) => {
1248
- const {
1249
- id: l,
1250
- function: { name: u, arguments: r }
1251
- } = p;
1252
- let i;
1253
- if (l)
1254
- a.inProcessToolCallId = l, i = ue({
1255
- type: "tool",
1256
- name: u,
1257
- formatPretty: !0,
1258
- status: "running",
1259
- content: JSON.stringify({ arguments: r || "" }, null, 2),
1260
- id: l
1261
- }), e[l] = i, n.messages.push(i);
1262
- else {
1263
- i = e[a.inProcessToolCallId];
1264
- const m = JSON.parse(i.content).arguments + (r || "");
1265
- i.content = JSON.stringify({ arguments: m }, null, 2);
1266
- }
1267
- oe.emit("notification", {
1268
- type: "tool",
1269
- delta: s,
1270
- toolCallData: te(i),
1271
- chatMessage: te(n)
1272
- });
1273
- });
1274
- }
1275
- function Te(t, s, e) {
1276
- let a = e.messages[e.messages.length - 1];
1277
- return (a == null ? void 0 : a.type) === "reasoning" ? a.content += t : (a = {
1278
- type: "reasoning",
1279
- content: t,
1280
- thinking: !0
1281
- }, e.messages.push(a)), we(s, e), a;
1282
- }
1283
- function He(t) {
1284
- (t == null ? void 0 : t.type) === "reasoning" && (t.thinking = !1);
1285
- }
1286
- function we(t, s) {
1287
- const e = s.messages[s.messages.length - 1];
1288
- e && oe.emit("notification", {
1289
- type: e.type,
1290
- delta: t,
1291
- chatMessage: te(s)
1292
- });
1293
- }
1294
- function Zs(t, s, e) {
1295
- e.messages.length > 0 && e.messages[e.messages.length - 1].type === "markdown" ? e.messages[e.messages.length - 1].content += t : e.messages.push({
1296
- type: "markdown",
1297
- content: t
1298
- }), we(s, e);
1299
- }
1300
- function Ys(t, s, e) {
1301
- e.messages.length > 0 && e.messages[e.messages.length - 1].type === "schema-card" ? e.messages[e.messages.length - 1].content += t : e.messages.push({
1302
- type: "schema-card",
1303
- content: t,
1304
- id: Tt()
1305
- }), we(s, e);
1306
- }
1307
- function Fe(t) {
1308
- t.unWatchReasoning = ce(
1309
- () => [...t.chatMessage.messages],
1310
- (s) => {
1311
- var e, n;
1312
- t.handleReasoning && ((e = s[s.length - 1]) == null ? void 0 : e.type) !== "reasoning" && (t.handleReasoning = !1, He(t.reasoningMessage), (n = t.unWatchReasoning) == null || n.call(t));
1313
- },
1314
- { flush: "sync" }
1315
- );
1316
- }
1317
- const Xs = [
1318
- {
1319
- name: "init",
1320
- match: (t, s) => !1,
1321
- handler: (t, s) => !1,
1322
- start: (t, s) => {
1323
- const e = ue({
1324
- role: "assistant",
1325
- content: "",
1326
- messages: []
1327
- });
1328
- return t.chatMessage = e, t.handlers = s, s.onData(e), !1;
1329
- },
1330
- end: (t) => {
1331
- t.handlers.onDone(), oe.emit("notification", {
1332
- type: "done",
1333
- delta: {},
1334
- chatMessage: te(t.chatMessage)
1335
- });
1336
- }
1337
- },
1338
- {
1339
- name: "finish-info",
1340
- match: (t, s) => {
1341
- var a;
1342
- const { choices: e, usage: n } = t;
1343
- return ((a = e == null ? void 0 : e[0]) == null ? void 0 : a.finish_reason) && !!n;
1344
- },
1345
- handler: (t, s) => (s.chatMessage.finishInfo = t, !0)
1346
- },
1347
- {
1348
- name: "reasoning",
1349
- match: (t, s) => !!W(t).reasoning_content,
1350
- handler: (t, s) => {
1351
- const e = W(t);
1352
- return s.reasoningMessage = Te(e.reasoning_content, e, s.chatMessage), s.handleReasoning || (Fe(s), s.handleReasoning = !0), !0;
1353
- },
1354
- start: (t, s) => {
1355
- t.handleReasoning = !1;
1356
- },
1357
- end: (t) => {
1358
- var s;
1359
- (s = t.unWatchReasoning) == null || s.call(t), t.handleReasoning && (t.handleReasoning = !1, He(t.reasoningMessage));
1360
- }
1361
- },
1362
- {
1363
- name: "toolCall",
1364
- match: (t, s) => {
1365
- var n;
1366
- return ((n = W(t).tool_calls) == null ? void 0 : n.length) > 0;
1367
- },
1368
- handler: (t, s) => {
1369
- const e = W(t);
1370
- return Ks(e.tool_calls, e, s.toolCallIdMap, s.chatMessage, s.toolCallStatus), !0;
1371
- },
1372
- start: (t, s) => {
1373
- t.toolCallIdMap = {}, t.toolCallStatus = { inProcessToolCallId: null };
1374
- }
1375
- },
1376
- {
1377
- name: "toolResult",
1378
- match: (t, s) => {
1379
- var n;
1380
- return ((n = W(t).tool_calls_result) == null ? void 0 : n.length) > 0;
1381
- },
1382
- handler: (t, s) => {
1383
- const e = W(t);
1384
- return Vs(
1385
- e.tool_calls_result,
1386
- e,
1387
- s.toolCallIdMap,
1388
- s.chatMessage,
1389
- s.chatConfig.addToolCallContext
1390
- ), !0;
1391
- }
1392
- },
1393
- {
1394
- name: "content",
1395
- match: (t, s) => !!W(t).content,
1396
- handler: (t, s) => {
1397
- const e = W(t);
1398
- return s.delta = e, s.patternExtractor.handleContent(e.content), s.chatMessage.content += e.content, !0;
1399
- },
1400
- start: (t, s) => {
1401
- const e = new Ie({
1402
- onNormalWrite: (n) => Zs(n, t.delta, t.chatMessage),
1403
- onHandledWrite: (n) => {
1404
- t.reasoningMessage = Te(n, t.delta, t.chatMessage), t.handleReasoning || (Fe(t), t.handleReasoning = !0);
1405
- },
1406
- regExpMap: new js().regExpMap
1407
- });
1408
- t.patternExtractor = new Ie({
1409
- onNormalWrite: (n) => e.handleContent(n),
1410
- onHandledWrite: (n) => Ys(n, t.delta, t.chatMessage)
1411
- });
1412
- }
1413
- }
1414
- ], Qs = { class: "sender-container" }, en = { class: "attachments-container" }, tn = { class: "footer-text" }, sn = /* @__PURE__ */ X({
1415
- __name: "GenuiChat",
1416
- props: {
1417
- url: {},
1418
- model: {},
1419
- temperature: {},
1420
- messages: {},
1421
- chatConfig: {},
1422
- requiredCompleteFieldSelectors: {},
1423
- customComponents: {},
1424
- customSnippets: {},
1425
- customExamples: {},
1426
- customActions: {},
1427
- rendererSlots: {},
1428
- thinkComponent: { type: [Object, Function] },
1429
- roles: {},
1430
- features: {},
1431
- customFetch: { type: Function }
1432
- },
1433
- setup(t, { expose: s }) {
1434
- var Me;
1435
- const e = t, n = ut(Rt, null), { t: a } = $(), p = O(() => {
1436
- var d;
1437
- const c = (d = e.features) == null ? void 0 : d.supportImage;
1438
- return !!(c && (c == null ? void 0 : c.enabled) !== !1);
1439
- }), l = O(() => {
1440
- var w, M;
1441
- const c = (M = (w = e.features) == null ? void 0 : w.supportImage) == null ? void 0 : M.supportedFileTypes;
1442
- return {
1443
- file: {
1444
- disabled: !1,
1445
- accept: c == null ? void 0 : c.map((x) => Pt[x.toLowerCase()]).join(",")
1446
- }
1447
- };
1448
- }), u = {
1449
- assistant: {
1450
- placement: "start",
1451
- avatar: ee(Mt, { style: { fontSize: "32px" } }),
1452
- maxWidth: "100%",
1453
- customContentField: "messages"
1454
- },
1455
- user: {
1456
- placement: "end",
1457
- maxWidth: "90%",
1458
- avatar: ee(Ct, { style: { fontSize: "32px" } }),
1459
- customContentField: "messages"
1460
- }
1461
- }, r = (c) => {
1462
- if (!c)
1463
- return;
1464
- const d = {};
1465
- return Object.keys(c).forEach((w) => {
1466
- d[w] = (M) => {
1467
- const x = O(() => M.bubbleProps.role !== "assistant" ? !0 : M.index !== h.value.messages.value.length - 1 || !T.value), A = ge(c[w]);
1468
- return A ? A({ ...M, isFinished: x.value, messageManager: h.value, chatMessage: h.value.messages.value[M.index] }) : null;
1469
- };
1470
- }), d;
1471
- }, i = O(() => {
1472
- var d;
1473
- const c = { ...u };
1474
- for (const w in e.roles) {
1475
- const M = w;
1476
- c[M] = {
1477
- ...u[M],
1478
- ...e.roles[M],
1479
- slots: r((d = e.roles[M]) == null ? void 0 : d.slots)
1480
- };
1481
- }
1482
- return c;
1483
- }), o = (c) => c.filter((d) => d.role === "assistant").reduce((d, w) => {
1484
- const M = w.messages;
1485
- return Array.isArray(M) ? d.concat(...M) : d;
1486
- }, []), m = (c) => o(P.value).find((w) => "id" in w && w.id === c), y = (c) => {
1487
- const d = c[xt], w = m(d);
1488
- w && (w.state = JSON.parse(JSON.stringify(c.state || {}))), U();
1489
- }, f = ({ llmFriendlyMessage: c, humanFriendlyMessage: d, context: w }) => {
1490
- y(w), h.value.addMessage({
1491
- role: "user",
1492
- content: c,
1493
- messages: [{ type: "text", content: d }]
1494
- }), h.value.send();
1495
- }, { continueChatAction: R, saveStateAction: v } = Bs({ chat: f, saveState: y }), T = O(() => ae.includes(h.value.messageState.status)), G = new Be({
1496
- defaultAttrs: { class: "markdown-content" },
1497
- mdConfig: { html: !0 }
1498
- }), L = O(() => {
1499
- const c = P.value[P.value.length - 1];
1500
- if ((c == null ? void 0 : c.role) !== "assistant")
1501
- return null;
1502
- const d = c == null ? void 0 : c.messages;
1503
- return !Array.isArray(d) || !(d != null && d.length) ? null : d[d.length - 1].id;
1504
- }), N = {
1505
- "custom-text": (c) => ee("span", { class: "tr-bubble__body-text" }, c.content),
1506
- "schema-card": (c) => {
1507
- var M, x;
1508
- const d = {};
1509
- e.customComponents && e.customComponents.forEach((A) => {
1510
- A.ref && A.component && (d[A.component] = A.ref);
1511
- });
1512
- const w = {};
1513
- return e.customActions && e.customActions.forEach((A) => {
1514
- A.name && (w[A.name] = A);
1515
- }), ee(
1516
- "div",
1517
- {},
1518
- ee(
1519
- kt,
1520
- {
1521
- ...c,
1522
- requiredCompleteFieldSelectors: e.requiredCompleteFieldSelectors || [],
1523
- generating: L.value === c.id ? T.value : !1,
1524
- customComponents: d,
1525
- customActions: {
1526
- ...w,
1527
- continueChat: R,
1528
- saveState: v
1529
- },
1530
- key: c.id
1531
- },
1532
- {
1533
- header: ge((M = e.rendererSlots) == null ? void 0 : M.header),
1534
- footer: ge((x = e.rendererSlots) == null ? void 0 : x.footer)
1535
- }
1536
- )
1537
- );
1538
- },
1539
- tool: Fs,
1540
- reasoning: gs,
1541
- markdown: G,
1542
- templateData: cs,
1543
- "loading-text": e.thinkComponent || Ns,
1544
- "error-text": Us
1545
- }, J = F(Xs), Z = new Ot({
1546
- getChatOptions: () => ({
1547
- url: e.url,
1548
- model: e.model || "",
1549
- temperature: e.temperature ?? 0.3,
1550
- chatConfig: e.chatConfig || { addToolCallContext: !1, showThinkingResult: !1 },
1551
- customComponents: e.customComponents || [],
1552
- customSnippets: e.customSnippets || [],
1553
- customExamples: e.customExamples || [],
1554
- customActions: [...e.customActions || [], R, v],
1555
- customFetch: e.customFetch
1556
- })
1557
- });
1558
- Z.setResponseHandlers(J.value);
1559
- const C = new vt({
1560
- provider: "custom",
1561
- providerImplementation: Z
1562
- });
1563
- let g = Ws({
1564
- client: C,
1565
- autoSave: !1,
1566
- events: {
1567
- onReceiveData(c, d, w) {
1568
- d.value.push(c), w();
1569
- },
1570
- onLoaded(c) {
1571
- var d;
1572
- if (c.length || (_(), U()), (d = e.messages) != null && d.length) {
1573
- const w = h.value.messages.value;
1574
- w.splice(0, w.length, ...e.messages);
1575
- }
1576
- },
1577
- onFinish(c, d) {
1578
- (c == null ? void 0 : c.type) === "error" && d.messages.value.push({
1579
- role: "assistant",
1580
- content: "",
1581
- messages: [{ type: "error-text", content: c.error.message }]
1582
- }), U();
1583
- }
1584
- }
1585
- });
1586
- const { messageManager: h, createConversation: _, updateTitle: k, state: B, saveConversations: U } = g, P = O(() => h.value.messages.value), Y = O({
1587
- get: () => h.value.inputMessage.value,
1588
- set: (c) => {
1589
- h.value.inputMessage.value = c;
1590
- }
1591
- }), Le = (c) => {
1592
- Y.value = c;
1593
- };
1594
- (Me = e.messages) != null && Me.length && P.value.splice(0, P.value.length, ...e.messages);
1595
- const { attachments: se, templateData: z, clearAttachments: Ue, processAttachments: ze, handleFilesSelected: qe, handleTemplateEdit: Ge } = Jt(), Je = (c) => {
1596
- const d = Ge(z, Y.value);
1597
- Y.value = "", z.value = d;
1598
- }, be = O(() => {
1599
- var w;
1600
- let c = P.value;
1601
- if (h.value.messageState.status === q.PROCESSING)
1602
- return [
1603
- ...c,
1604
- {
1605
- role: "assistant",
1606
- content: a("loading.thinking"),
1607
- loading: !0
1608
- }
1609
- ];
1610
- const d = P.value[P.value.length - 1];
1611
- if (T.value && (d == null ? void 0 : d.role) === "assistant") {
1612
- const M = Array.isArray(d == null ? void 0 : d.messages) ? d.messages : [];
1613
- if (!M.some((A) => A.type === "loading-text"))
1614
- return [
1615
- ...c.slice(0, -1),
1616
- {
1617
- ...d,
1618
- messages: [
1619
- ...M,
1620
- {
1621
- type: "loading-text",
1622
- emitter: oe,
1623
- message: d,
1624
- showThinkingResult: (w = e.chatConfig) == null ? void 0 : w.showThinkingResult
1625
- }
1626
- ]
1627
- }
1628
- ];
1629
- }
1630
- return c;
1631
- }), We = (c) => {
1632
- var M;
1633
- const d = (M = B.conversations.find(
1634
- (x) => x.id === B.currentId
1635
- )) == null ? void 0 : M.title, w = a("conversation.newConversation");
1636
- if (d === w && B.currentId) {
1637
- const x = typeof c == "string" ? c : JSON.stringify(c);
1638
- k(B.currentId, x.substring(0, 20));
1639
- }
1640
- }, Ce = () => {
1641
- Y.value = "", z.value = [], Ue();
1642
- }, je = (c) => {
1643
- c && (se.value = se.value.filter((d) => c.name !== d.name), z.value = z.value.filter((d) => d.type !== "template" || d.content !== c.name));
1644
- }, Ve = async (c) => {
1645
- const d = c, w = [];
1646
- let M = [];
1647
- const x = se.value.slice(), A = z.value.slice(), me = {
1648
- role: "user",
1649
- content: d
1650
- };
1651
- if (P.value.push(me), x.length > 0) {
1652
- const Se = await ze(x, e.features || {});
1653
- if (!Se) {
1654
- h.value.send(), re();
1655
- return;
1656
- }
1657
- M = A.map((pe) => pe.type === "template" ? Se.apiContent.find((st) => st.filename === pe.content) : {
1658
- type: "text",
1659
- text: pe.content
1660
- }), A.length > 0 && w.push({
1661
- type: "templateData",
1662
- templateData: A,
1663
- attachments: x
1664
- }), me.content = M, me.messages = w;
1665
- }
1666
- h.value.send(), Ce(), We(d), U(), re();
1667
- }, Ke = () => {
1668
- _(), U();
1669
- }, Ze = () => {
1670
- h.value.abortRequest(), U();
1671
- }, de = F(), { width: Ye } = zs(de), { scrollToBottom: re, scrollToBottomWithRetry: Xe, autoScrollToBottom: Qe, isLastMessageInBottom: et } = Bt(de), tt = Nt(Qe, 400);
1672
- return ce(() => P.value, tt, { deep: !0 }), ce(
1673
- () => B.currentId,
1674
- () => {
1675
- Xe(10, 150);
1676
- }
1677
- ), s({
1678
- setInputMessage: Le,
1679
- handleNewConversation: Ke,
1680
- // @experimental
1681
- getProps: () => e,
1682
- getConversation: () => g,
1683
- // experimental, not stable
1684
- getResponseHandlers: () => J.value,
1685
- // experimental, not stable
1686
- setResponseHandlers: (c) => {
1687
- J.value = c, Z.setResponseHandlers(c);
1688
- },
1689
- getMessageRenderers: () => N,
1690
- setMessageRenderer: (c, d) => {
1691
- N[c] = d;
1692
- },
1693
- generating: T,
1694
- // @experimental
1695
- lastSchemaCardId: L,
1696
- continueChatAction: R,
1697
- saveStateAction: v
1698
- }), (c, d) => {
1699
- var w, M;
1700
- return E(), I("div", {
1701
- class: K(["tg-chat-container", { dark: ((w = S(n)) == null ? void 0 : w.theme) === "dark" }]),
1702
- style: Re((M = e.chatConfig) != null && M.showThinkingResult ? {} : { "--thinking-display": "none" })
1703
- }, [
1704
- b("div", {
1705
- class: "messages-container",
1706
- ref_key: "messagesContainer",
1707
- ref: de,
1708
- style: Re({ "--messages-container-width": S(Ye) + "px" })
1709
- }, [
1710
- be.value.length ? (E(), $e(S(pt), {
1711
- key: 0,
1712
- "content-renderers": N
1713
- }, {
1714
- default: j(() => [
1715
- D(S(gt), {
1716
- items: be.value,
1717
- roles: i.value,
1718
- "auto-scroll": ""
1719
- }, null, 8, ["items", "roles"])
1720
- ]),
1721
- _: 1
1722
- })) : dt(c.$slots, "empty", { key: 1 }, void 0, !0)
1723
- ], 4),
1724
- b("div", Qs, [
1725
- Ae(b("div", {
1726
- class: K(["scroll-to-bottom-button", { "is-generating": T.value }]),
1727
- onClick: d[0] || (d[0] = //@ts-ignore
1728
- (...x) => S(re) && S(re)(...x))
1729
- }, [
1730
- D(S(ye), { class: "icon-arrow-down" })
1731
- ], 2), [
1732
- [De, !S(et)]
1733
- ]),
1734
- D(S(ht), {
1735
- modelValue: Y.value,
1736
- "onUpdate:modelValue": d[1] || (d[1] = (x) => Y.value = x),
1737
- placeholder: S(ae).includes(S(h).messageState.status) ? S(a)("placeholder.thinking") : S(a)("placeholder.input"),
1738
- clearable: !0,
1739
- "allow-files": p.value,
1740
- buttonGroup: l.value,
1741
- loading: S(ae).includes(S(h).messageState.status),
1742
- onFilesSelected: d[2] || (d[2] = (x) => S(qe)(x, Y.value)),
1743
- "template-data": S(z),
1744
- "onUpdate:templateData": [
1745
- d[3] || (d[3] = (x) => Ne(z) ? z.value = x : null),
1746
- Je
1747
- ],
1748
- showWordLimit: !0,
1749
- maxLength: 1e3,
1750
- onClear: Ce,
1751
- onSubmit: Ve,
1752
- onCancel: Ze
1753
- }, mt({ _: 2 }, [
1754
- S(se).length > 0 ? {
1755
- name: "header",
1756
- fn: j(() => [
1757
- b("div", en, [
1758
- D(es, {
1759
- attachments: S(se),
1760
- onRemove: je
1761
- }, null, 8, ["attachments"])
1762
- ])
1763
- ]),
1764
- key: "0"
1765
- } : void 0
1766
- ]), 1032, ["modelValue", "placeholder", "allow-files", "buttonGroup", "loading", "template-data"]),
1767
- b("div", tn, H(S(a)("footer.aiGenerated")), 1)
1768
- ])
1769
- ], 6);
1770
- };
1771
- }
1772
- }), hn = /* @__PURE__ */ Q(sn, [["__scopeId", "data-v-34bc2af9"]]), fn = {
1773
- enabled: !0,
1774
- maxImageSize: 10,
1775
- maxFilesPerRequest: 3,
1776
- supportedFileTypes: ["jpg", "jpeg", "png", "gif", "webp", "bmp", "heic", "tiff"]
1777
- };
1778
- export {
1779
- Ot as C,
1780
- fn as D,
1781
- As as E,
1782
- hn as G,
1783
- Gs as I,
1784
- qs as M,
1785
- js as T,
1786
- Pe as a,
1787
- Nt as b,
1788
- Xs as d,
1789
- oe as e,
1790
- Bt as s,
1791
- ge as t,
1792
- Ws as u
1793
- };
1794
- //# sourceMappingURL=chat.types-DsoAmslj.js.map