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

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