@opentiny/tiny-robot 0.1.0-alpha.0 → 0.2.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/dist/{bubble-item → bubble}/components/actions/copy.vue.d.ts +3 -3
  2. package/dist/{bubble-item → bubble}/components/actions/refresh.vue.d.ts +1 -1
  3. package/dist/bubble/index.d.ts +12 -0
  4. package/dist/bubble/index.type.d.ts +53 -0
  5. package/dist/bubble/useScroll.d.ts +4 -0
  6. package/dist/container/index.d.ts +7 -0
  7. package/dist/container/index.type.d.ts +16 -0
  8. package/dist/container/index.vue.d.ts +26 -0
  9. package/dist/index.d.ts +10 -5
  10. package/dist/index.js +31 -20
  11. package/dist/node_modules/.pnpm/@opentiny_utils@1.0.0/node_modules/@opentiny/utils/dist/opentiny-utils.es.js +832 -0
  12. package/dist/node_modules/.pnpm/@opentiny_utils@3.22.0/node_modules/@opentiny/utils/dist/index.es.js +959 -1496
  13. package/dist/node_modules/.pnpm/{@opentiny_vue-button@3.22.0 → @opentiny_vue-button@3.21.0}/node_modules/@opentiny/vue-button/lib/index.js +21 -21
  14. package/dist/node_modules/.pnpm/{@opentiny_vue-button@3.22.0 → @opentiny_vue-button@3.21.0}/node_modules/@opentiny/vue-button/lib/pc.js +3 -3
  15. package/dist/node_modules/.pnpm/@opentiny_vue-common@3.21.0/node_modules/@opentiny/vue-common/lib/index.js +727 -0
  16. package/dist/node_modules/.pnpm/@opentiny_vue-common@3.22.0/node_modules/@opentiny/vue-common/lib/index.js +144 -675
  17. package/dist/node_modules/.pnpm/{@opentiny_vue-dialog-box@3.22.0 → @opentiny_vue-dialog-box@3.21.0}/node_modules/@opentiny/vue-dialog-box/lib/index.js +9 -9
  18. package/dist/node_modules/.pnpm/{@opentiny_vue-dialog-box@3.22.0 → @opentiny_vue-dialog-box@3.21.0}/node_modules/@opentiny/vue-dialog-box/lib/pc.js +5 -5
  19. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/close.js +29 -0
  20. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/eyeclose.js +1 -1
  21. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/eyeopen.js +1 -1
  22. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/finish.js +1 -1
  23. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/fullscreen.js +1 -1
  24. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/loading-shadow.js +21 -22
  25. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/minscreen.js +1 -1
  26. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-add-column-after.js +1 -1
  27. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-add-column-before.js +1 -1
  28. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-add-row-after.js +1 -1
  29. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-add-row-before.js +1 -1
  30. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-align-center.js +1 -1
  31. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-align-left.js +1 -1
  32. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-align-right.js +1 -1
  33. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-bold.js +1 -1
  34. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-code-block.js +1 -1
  35. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-code-view.js +1 -1
  36. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-color.js +1 -1
  37. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-delete-column.js +1 -1
  38. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-delete-row.js +1 -1
  39. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-delete-table.js +1 -1
  40. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-font-size.js +1 -1
  41. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-format-clear.js +1 -1
  42. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-h1.js +1 -1
  43. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-h2.js +1 -1
  44. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-h3.js +1 -1
  45. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-h4.js +1 -1
  46. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-h5.js +1 -1
  47. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-h6.js +1 -1
  48. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-heading.js +1 -1
  49. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-high-light.js +1 -1
  50. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-image.js +1 -1
  51. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-italic.js +1 -1
  52. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-line-height.js +1 -1
  53. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-link-unlink.js +1 -1
  54. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-link.js +1 -1
  55. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-list-ordered.js +1 -1
  56. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-list-unordered.js +1 -1
  57. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-merge-cells-vertical.js +1 -1
  58. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-merge-cells.js +1 -1
  59. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-node-delete.js +1 -1
  60. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-paragraph.js +1 -1
  61. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-quote-text.js +1 -1
  62. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-redo.js +1 -1
  63. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-split-cells-horizontal.js +1 -1
  64. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-split-cells-vertical.js +1 -1
  65. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-strike-through.js +1 -1
  66. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-subscript.js +1 -1
  67. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-superscript.js +1 -1
  68. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-table.js +1 -1
  69. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-task-list.js +1 -1
  70. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-underline.js +1 -1
  71. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/rich-text-undo.js +1 -1
  72. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/sub-script.js +1 -1
  73. package/dist/node_modules/.pnpm/{@opentiny_vue-icon@3.22.0 → @opentiny_vue-icon@3.21.0}/node_modules/@opentiny/vue-icon/lib/warn.js +1 -1
  74. package/dist/node_modules/.pnpm/{@opentiny_vue-input@3.22.0 → @opentiny_vue-input@3.21.0}/node_modules/@opentiny/vue-input/lib/index.js +3 -3
  75. package/dist/node_modules/.pnpm/{@opentiny_vue-input@3.22.0 → @opentiny_vue-input@3.21.0}/node_modules/@opentiny/vue-input/lib/pc.js +36 -36
  76. package/dist/node_modules/.pnpm/{@opentiny_vue-locale@3.22.0 → @opentiny_vue-locale@3.21.0}/node_modules/@opentiny/vue-locale/lib/index.js +63 -63
  77. package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/button/index.js +1 -1
  78. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/browser.js +36 -0
  79. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/clickoutside.js +47 -0
  80. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/debounce.js +7 -0
  81. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/dom.js +45 -0
  82. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/popper.js +320 -0
  83. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/popup-manager.js +118 -0
  84. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/throttle.js +23 -0
  85. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/useEventListener.js +9 -0
  86. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/useInstanceSlots.js +14 -0
  87. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/useRelation.js +54 -0
  88. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/vue-popper.js +84 -0
  89. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/vue-popup.js +73 -0
  90. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/event.js +13 -0
  91. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/function.js +5 -0
  92. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/index.js +11 -0
  93. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/object.js +84 -0
  94. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/string.js +28 -0
  95. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/type.js +28 -0
  96. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/dialog-box/index.js +136 -0
  97. package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/dialog-box/vue.js +33 -34
  98. package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/input/index.js +22 -22
  99. package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/input/vue.js +9 -9
  100. package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/tall-storage/index.js +1 -1
  101. package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/tall-storage/vue.js +5 -5
  102. package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/tooltip/index.js +41 -40
  103. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/tooltip/vue.js +90 -0
  104. package/dist/node_modules/.pnpm/{@opentiny_vue-tooltip@3.22.0 → @opentiny_vue-tooltip@3.21.0}/node_modules/@opentiny/vue-tooltip/lib/index.js +3 -6
  105. package/dist/node_modules/.pnpm/{@opentiny_vue-tooltip@3.22.0 → @opentiny_vue-tooltip@3.21.0}/node_modules/@opentiny/vue-tooltip/lib/pc.js +2 -2
  106. package/dist/packages/components/src/{bubble-list → bubble}/bubble-list.vue.js +2 -2
  107. package/dist/packages/components/src/bubble/bubble-list.vue2.js +37 -0
  108. package/dist/packages/components/src/bubble/bubble.vue.js +7 -0
  109. package/dist/packages/components/src/bubble/bubble.vue2.js +118 -0
  110. package/dist/packages/components/src/bubble/components/actions/copy.vue.js +7 -0
  111. package/dist/packages/components/src/bubble/components/actions/copy.vue2.js +35 -0
  112. package/dist/packages/components/src/bubble/components/actions/refresh.vue.js +7 -0
  113. package/dist/packages/components/src/bubble/components/actions/refresh.vue2.js +16 -0
  114. package/dist/packages/components/src/bubble/index.js +18 -0
  115. package/dist/packages/components/src/bubble/useScroll.js +13 -0
  116. package/dist/packages/components/src/container/index.js +9 -0
  117. package/dist/packages/components/src/container/index.vue.js +7 -0
  118. package/dist/packages/components/src/container/index.vue2.js +55 -0
  119. package/dist/packages/components/src/conversations/index.js +1 -1
  120. package/dist/packages/components/src/prompts/index.js +18 -0
  121. package/dist/packages/components/src/prompts/prompt.vue.js +7 -0
  122. package/dist/packages/components/src/prompts/prompt.vue2.js +37 -0
  123. package/dist/packages/components/src/prompts/prompts.vue.js +7 -0
  124. package/dist/packages/components/src/prompts/prompts.vue2.js +36 -0
  125. package/dist/packages/components/src/question/components/CommonQuestions.vue.js +89 -0
  126. package/dist/packages/components/src/question/components/CommonQuestions.vue2.js +4 -0
  127. package/dist/packages/components/src/question/components/HotQuestions.vue.js +140 -0
  128. package/dist/packages/components/src/question/components/HotQuestions.vue2.js +4 -0
  129. package/dist/packages/components/src/question/composables/useQuestions.js +48 -0
  130. package/dist/packages/components/src/question/index.js +9 -0
  131. package/dist/packages/components/src/question/index.vue.js +113 -0
  132. package/dist/packages/components/src/question/index.vue2.js +4 -0
  133. package/dist/packages/components/src/sender/components/ActionButtons.vue.js +105 -123
  134. package/dist/packages/components/src/sender/composables/useInputHandler.js +26 -22
  135. package/dist/packages/components/src/sender/composables/useKeyboardHandler.js +11 -11
  136. package/dist/packages/components/src/sender/composables/useSpeechHandler.js +9 -9
  137. package/dist/packages/components/src/sender/index.vue.js +67 -66
  138. package/dist/packages/components/src/welcome/index.vue.js +5 -7
  139. package/dist/packages/components/src/welcome/index.vue2.js +32 -0
  140. package/dist/packages/svgs/dist/tiny-robot-svgs.js +223 -0
  141. package/dist/prompts/index.d.ts +12 -0
  142. package/dist/prompts/index.type.d.ts +55 -0
  143. package/dist/prompts/prompt.vue.d.ts +3 -0
  144. package/dist/prompts/prompts.vue.d.ts +20 -0
  145. package/dist/question/components/CommonQuestions.vue.d.ts +32 -0
  146. package/dist/question/components/HotQuestions.vue.d.ts +89 -0
  147. package/dist/question/composables/useQuestions.d.ts +17 -0
  148. package/dist/question/index.d.ts +7 -0
  149. package/dist/question/index.type.d.ts +74 -0
  150. package/dist/question/index.vue.d.ts +46 -0
  151. package/dist/sender/components/ActionButtons.vue.d.ts +6 -4
  152. package/dist/sender/composables/useSpeechHandler.d.ts +0 -6
  153. package/dist/sender/index.type.d.ts +1 -1
  154. package/dist/sender/index.vue.d.ts +3 -4
  155. package/dist/style.css +1 -1
  156. package/dist/welcome/index.type.d.ts +10 -0
  157. package/dist/welcome/index.vue.d.ts +17 -1
  158. package/package.json +6 -5
  159. package/src/bubble/bubble-list.vue +42 -0
  160. package/src/bubble/bubble.vue +247 -0
  161. package/src/bubble/components/actions/copy.vue +54 -0
  162. package/src/bubble/components/actions/refresh.vue +31 -0
  163. package/src/bubble/index.ts +23 -0
  164. package/src/bubble/index.type.ts +63 -0
  165. package/src/bubble/useScroll.ts +14 -0
  166. package/src/container/index.ts +12 -0
  167. package/src/container/index.type.ts +17 -0
  168. package/src/container/index.vue +135 -0
  169. package/src/conversations/index.ts +1 -1
  170. package/src/index.ts +26 -12
  171. package/src/prompts/index.ts +25 -0
  172. package/src/prompts/index.type.ts +59 -0
  173. package/src/prompts/prompt.vue +115 -0
  174. package/src/prompts/prompts.vue +50 -0
  175. package/src/question/components/CommonQuestions.vue +146 -0
  176. package/src/question/components/HotQuestions.vue +148 -0
  177. package/src/question/composables/useQuestions.ts +106 -0
  178. package/src/question/index.less +448 -0
  179. package/src/question/index.ts +12 -0
  180. package/src/question/index.type.ts +86 -0
  181. package/src/question/index.vue +140 -0
  182. package/src/question/vars.less +135 -0
  183. package/src/sender/components/ActionButtons.vue +42 -39
  184. package/src/sender/composables/useInputHandler.ts +15 -10
  185. package/src/sender/composables/useKeyboardHandler.ts +6 -4
  186. package/src/sender/composables/useSpeechHandler.ts +5 -11
  187. package/src/sender/index.less +3 -5
  188. package/src/sender/index.type.ts +1 -1
  189. package/src/sender/index.vue +3 -2
  190. package/src/welcome/index.type.ts +12 -0
  191. package/src/welcome/index.vue +68 -2
  192. package/.vscode/extensions.json +0 -3
  193. package/dist/bubble-item/components/icons/ai.vue.d.ts +0 -2
  194. package/dist/bubble-item/components/icons/index.d.ts +0 -2
  195. package/dist/bubble-item/components/icons/user.vue.d.ts +0 -2
  196. package/dist/bubble-item/index.d.ts +0 -7
  197. package/dist/bubble-list/index.d.ts +0 -8
  198. package/dist/bubble-list/index.type.d.ts +0 -55
  199. package/dist/node_modules/.pnpm/@opentiny_vue-directive@3.22.0/node_modules/@opentiny/vue-directive/index.js +0 -57
  200. package/dist/node_modules/.pnpm/@opentiny_vue-hooks@3.22.0/node_modules/@opentiny/vue-hooks/dist/src/vue-popper.js +0 -85
  201. package/dist/node_modules/.pnpm/@opentiny_vue-hooks@3.22.0/node_modules/@opentiny/vue-hooks/dist/src/vue-popup.js +0 -69
  202. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.22.0/node_modules/@opentiny/vue-renderless/dialog-box/index.js +0 -135
  203. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.22.0/node_modules/@opentiny/vue-renderless/tooltip/vue.js +0 -90
  204. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js +0 -5
  205. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js +0 -10
  206. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTrim.js +0 -8
  207. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js +0 -4
  208. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js +0 -15
  209. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js +0 -7
  210. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js +0 -5
  211. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_trimmedEndIndex.js +0 -9
  212. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/debounce.js +0 -54
  213. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js +0 -7
  214. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js +0 -6
  215. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSymbol.js +0 -9
  216. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/now.js +0 -7
  217. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toNumber.js +0 -22
  218. package/dist/packages/components/src/bubble-item/bubble-item.vue.js +0 -7
  219. package/dist/packages/components/src/bubble-item/bubble-item.vue2.js +0 -111
  220. package/dist/packages/components/src/bubble-item/components/actions/copy.vue.js +0 -46
  221. package/dist/packages/components/src/bubble-item/components/actions/copy.vue2.js +0 -4
  222. package/dist/packages/components/src/bubble-item/components/actions/refresh.vue.js +0 -12
  223. package/dist/packages/components/src/bubble-item/components/icons/ai.vue.js +0 -45
  224. package/dist/packages/components/src/bubble-item/components/icons/user.vue.js +0 -63
  225. package/dist/packages/components/src/bubble-item/index.js +0 -9
  226. package/dist/packages/components/src/bubble-list/bubble-list.vue2.js +0 -52
  227. package/dist/packages/components/src/bubble-list/index.js +0 -9
  228. package/src/bubble-item/bubble-item.vue +0 -264
  229. package/src/bubble-item/components/actions/copy.vue +0 -47
  230. package/src/bubble-item/components/actions/refresh.vue +0 -27
  231. package/src/bubble-item/components/icons/ai.vue +0 -30
  232. package/src/bubble-item/components/icons/index.ts +0 -2
  233. package/src/bubble-item/components/icons/user.vue +0 -78
  234. package/src/bubble-item/index.ts +0 -12
  235. package/src/bubble-list/bubble-list.vue +0 -53
  236. package/src/bubble-list/index.ts +0 -14
  237. package/src/bubble-list/index.type.ts +0 -65
  238. package/src/sender/global.d.ts +0 -44
  239. /package/dist/{bubble-list → bubble}/bubble-list.vue.d.ts +0 -0
  240. /package/dist/{bubble-item → bubble}/components/actions/index.d.ts +0 -0
  241. /package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/button/vue.js +0 -0
  242. /package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/chunk-G2ADBYYC.js +0 -0
  243. /package/dist/node_modules/.pnpm/{@opentiny_vue-renderless@3.22.0 → @opentiny_vue-renderless@3.21.2}/node_modules/@opentiny/vue-renderless/tall-storage/vue-storage-box.js +0 -0
  244. /package/src/{bubble-item → bubble}/components/actions/index.ts +0 -0
@@ -0,0 +1,86 @@
1
+ export interface Category {
2
+ id: string
3
+ label: string
4
+ icon?: string
5
+ questions: Question[]
6
+ }
7
+
8
+ export interface Question {
9
+ id: string
10
+ text: string
11
+ keywords?: string[]
12
+ }
13
+
14
+ export interface TrQuestionPanel {
15
+ openModal: () => void
16
+ closeModal: () => void
17
+ toggleFloating: () => void
18
+ setActiveCategory: (categoryId: string) => void
19
+ refreshData: () => Promise<void>
20
+ }
21
+
22
+ export type ThemeType = 'light' | 'dark'
23
+
24
+ /**
25
+ * Question组件属性定义
26
+ */
27
+ export interface QuestionProps {
28
+ /**
29
+ * 问题分类列表
30
+ * 包含多个分类,每个分类下有多个问题
31
+ */
32
+ categories: Category[]
33
+
34
+ /**
35
+ * 浮动显示的问题列表
36
+ * 显示在组件底部的常见问题胶囊
37
+ */
38
+ commonQuestions: Question[]
39
+
40
+ /**
41
+ * 是否初始展开常见问题
42
+ * @default false
43
+ */
44
+ initialExpanded?: boolean
45
+
46
+ /**
47
+ * 弹窗宽度
48
+ * @default '640px'
49
+ */
50
+ modalWidth?: string
51
+
52
+ /**
53
+ * 主题类型
54
+ * @default 'light'
55
+ */
56
+ theme?: ThemeType
57
+
58
+ /**
59
+ * 是否点击外部关闭弹窗
60
+ * @default true
61
+ */
62
+ closeOnClickOutside?: boolean
63
+
64
+ /**
65
+ * 是否显示加载中状态
66
+ * @default false
67
+ */
68
+ loading?: boolean
69
+ }
70
+
71
+ /**
72
+ * Question组件事件定义
73
+ */
74
+ export type QuestionEmits = {
75
+ /**
76
+ * 问题点击事件
77
+ * @param question 被点击的问题对象
78
+ */
79
+ 'question-click': [question: Question]
80
+
81
+ /**
82
+ * 分类选择事件
83
+ * @param category 被选择的分类对象
84
+ */
85
+ 'select-category': [category: Category]
86
+ }
@@ -0,0 +1,140 @@
1
+ <script setup lang="ts">
2
+ import { computed, ref, defineProps, defineEmits, defineExpose, watch, onMounted, withDefaults } from 'vue'
3
+ import { useQuestions } from './composables/useQuestions'
4
+ import CommonQuestions from './components/CommonQuestions.vue'
5
+ import HotQuestions from './components/HotQuestions.vue'
6
+ import type { Category, Question, QuestionProps, QuestionEmits } from './index.type'
7
+
8
+ import { IconHotQuestion, IconArrowUp, IconArrowDown, IconTypeAll } from '@opentiny/tiny-robot-svgs'
9
+ import './index.less'
10
+
11
+ const props = withDefaults(defineProps<QuestionProps>(), {
12
+ categories: () => [] as Category[],
13
+ commonQuestions: () => [] as Question[],
14
+ initialExpanded: false,
15
+ modalWidth: '640px',
16
+ theme: 'light',
17
+ closeOnClickOutside: true,
18
+ loading: false,
19
+ })
20
+
21
+ // 切换问题展示
22
+ const toggleExpand = () => {
23
+ isExpanded.value = !isExpanded.value
24
+ }
25
+
26
+ const emit = defineEmits<QuestionEmits>()
27
+
28
+ const categories = computed(() => props.categories)
29
+ const isExpanded = ref(props.initialExpanded)
30
+
31
+ const { modalVisible, currentTheme, setActiveCategory, openModal, closeModal, setTheme, refreshData } =
32
+ useQuestions(categories)
33
+
34
+ // 同步 props 到内部状态
35
+ watch(
36
+ () => props.theme,
37
+ (value) => {
38
+ setTheme(value)
39
+ },
40
+ )
41
+
42
+ // 处理问题点击
43
+ const handleQuestionClick = (question: Question) => {
44
+ closeModal()
45
+ emit('question-click', question)
46
+ }
47
+
48
+ // 处理分类选择
49
+ const handleCategorySelect = (category: Category) => {
50
+ if (category) {
51
+ setActiveCategory(category.id)
52
+ emit('select-category', category)
53
+ }
54
+ }
55
+
56
+ // 处理按钮隐藏
57
+ const showExpandButton = ref(false)
58
+
59
+ const handleShowExpandButton = (value: boolean) => {
60
+ showExpandButton.value = value
61
+ }
62
+
63
+ // 组件挂载时初始化主题
64
+ onMounted(() => {
65
+ document.documentElement.setAttribute('data-theme', currentTheme.value)
66
+ })
67
+
68
+ // 暴露实例方法
69
+ defineExpose({
70
+ openModal,
71
+ closeModal,
72
+ toggleFloating: toggleExpand,
73
+ setActiveCategory,
74
+ refreshData,
75
+ })
76
+ </script>
77
+
78
+ <template>
79
+ <div class="tr-question-container" :class="[`theme-${theme}`]" :data-theme="theme">
80
+ <!-- 热门问题弹窗触发按钮 -->
81
+ <div class="tr-question-trigger" @click="openModal">
82
+ <IconHotQuestion />
83
+ </div>
84
+
85
+ <!-- 热门问题弹窗 -->
86
+ <HotQuestions
87
+ :visible="modalVisible"
88
+ :categories="categories"
89
+ :modal-width="modalWidth"
90
+ :loading="loading"
91
+ :close-on-click-outside="closeOnClickOutside"
92
+ @update:visible="modalVisible = $event"
93
+ @close="modalVisible = false"
94
+ @question-click="handleQuestionClick"
95
+ @select-category="handleCategorySelect"
96
+ >
97
+ <!-- 传递插槽内容 -->
98
+ <template #category-label="{ category }">
99
+ <slot name="category-label" :category="category">
100
+ <div class="category-icon">
101
+ <IconTypeAll />
102
+ </div>
103
+ <span>{{ category.label }}</span>
104
+ </slot>
105
+ </template>
106
+
107
+ <template #question-item="{ question, index }">
108
+ <slot name="question-item" :question="question" :index="index">
109
+ <span>{{ index + 1 }}.</span> {{ question.text }}
110
+ </slot>
111
+ </template>
112
+
113
+ <template #loading-indicator>
114
+ <slot name="loading-indicator">
115
+ <div class="tr-question-loading-spinner"></div>
116
+ </slot>
117
+ </template>
118
+
119
+ <template #empty-state>
120
+ <slot name="empty-state">
121
+ <p>暂无相关问题</p>
122
+ </slot>
123
+ </template>
124
+ </HotQuestions>
125
+
126
+ <!-- 常见问题胶囊 -->
127
+ <CommonQuestions
128
+ :isExpanded="isExpanded"
129
+ :questions="commonQuestions"
130
+ @show-expand-button="handleShowExpandButton"
131
+ @question-click="handleQuestionClick"
132
+ />
133
+
134
+ <!-- 常规问题完整内容触发按钮 -->
135
+ <div v-if="showExpandButton" class="tr-question-wrap-trigger" @click="toggleExpand">
136
+ <IconArrowUp v-if="!isExpanded" />
137
+ <IconArrowDown v-else />
138
+ </div>
139
+ </div>
140
+ </template>
@@ -0,0 +1,135 @@
1
+ /* ----------------- 颜色变量 ----------------- */
2
+ :root {
3
+ /* 主题基础颜色 */
4
+ --tr-question-primary-color: #1890ff;
5
+ --tr-question-background-color: #ffffff;
6
+ --tr-question-modal-background-color: #ffffff;
7
+ --tr-question-text-color: #333333;
8
+ --tr-question-text-color-secondary: #666666;
9
+ --tr-question-border-color: #e8e8e8;
10
+ --tr-question-hover-color: #f5f5f5;
11
+ --tr-question-tab-hover-bg: #f0f0f0;
12
+ --tr-question-active-tab-color: var(--tr-question-primary-color);
13
+ --tr-question-active-tab-bg: #e6f7ff;
14
+
15
+ /* 弹窗相关颜色 */
16
+ --tr-question-header-bg: #f9f9f9;
17
+ --tr-question-title-color: #1d2129;
18
+ --tr-question-close-icon-color: #86909c;
19
+ --tr-question-tab-active-bg: #e8f3ff;
20
+ --tr-question-tab-active-text: #1890ff;
21
+ --tr-question-tab-text: #4e5969;
22
+ --tr-question-tab-border: #f0f0f0;
23
+ --tr-question-list-divider-color: #f0f0f0;
24
+ --tr-question-modal-backdrop-color: rgba(0, 0, 0, 0.5);
25
+
26
+ /* 常见问题颜色 */
27
+ --tr-question-common-bg: #fff;
28
+ --tr-question-common-text: #191919;
29
+ --tr-question-common-hover-bg: #ebebeb;
30
+ --tr-question-common-shadow: rgba(0, 0, 0, 0.04);
31
+
32
+ /* 背景颜色 */
33
+ --tr-question-container-bg: #f8f8f8;
34
+ --tr-question-list-item-bg: #fff;
35
+ --tr-question-list-hover-shadow: rgba(0, 0, 0, 0.08);
36
+ --tr-question-category-bg: rgba(0, 0, 0, 0.04);
37
+ --tr-question-category-hover-bg: rgba(0, 0, 0, 0.08);
38
+ --tr-question-category-active-border: #191919;
39
+ --tr-question-item-border-color: rgba(0, 0, 0, 0.04);
40
+
41
+ /* 滚动条颜色 */
42
+ --tr-question-scrollbar-track-bg: rgba(16, 31, 28, 0.1);
43
+ --tr-question-scrollbar-thumb-bg: rgba(144, 147, 153, 0.5);
44
+ --tr-question-scrollbar-thumb-hover-bg: rgba(144, 147, 153, 0.3);
45
+
46
+ /* ----------------- 尺寸变量 ----------------- */
47
+ /* 圆角 */
48
+ --tr-question-border-radius: 24px;
49
+ --tr-question-category-border-radius: 8px;
50
+ --tr-question-list-border-radius: 12px;
51
+ --tr-question-common-border-radius: 16px;
52
+ --tr-question-scrollbar-border-radius: 2em;
53
+
54
+ /* 间距和尺寸 */
55
+ --tr-question-spacing: 16px;
56
+ --tr-question-icon-size: 16px;
57
+ --tr-question-container-height: 46px;
58
+ --tr-question-item-height: 56px;
59
+ --tr-question-trigger-size: 32px;
60
+ --tr-question-common-item-height: 32px;
61
+ --tr-question-category-height: 38px;
62
+ --tr-question-scrollbar-width: 4px;
63
+ --tr-question-modal-padding: 24px;
64
+ --tr-question-modal-max-height: 80vh;
65
+ --tr-question-modal-max-width: 640px;
66
+ --tr-question-content-max-height: calc(80vh - 120px);
67
+
68
+ /* ----------------- 文字变量 ----------------- */
69
+ /* 字体 */
70
+ --tr-question-font-size: 14px;
71
+ --tr-question-title-font-size: 18px;
72
+ --tr-question-title-font-weight: 600;
73
+ --tr-question-item-font-weight: 400;
74
+ --tr-question-line-height: 1.5;
75
+ --tr-question-item-line-height: 22px;
76
+
77
+ /* ----------------- 特效变量 ----------------- */
78
+ /* 阴影 */
79
+ --tr-question-panel-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
80
+ --tr-question-trigger-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
81
+ --tr-question-common-item-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
82
+ --tr-question-list-item-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
83
+ --tr-question-wrap-trigger-shadow: 2px 0 9px rgba(0, 0, 0, 0.04);
84
+
85
+ /* 动画 */
86
+ --tr-question-transition-duration: 0.3s;
87
+ --tr-question-transition-timing: ease;
88
+ --tr-question-hover-transition: all var(--tr-question-transition-duration) var(--tr-question-transition-timing);
89
+ }
90
+
91
+ /* ----------------- 暗色主题变量 ----------------- */
92
+ [data-theme='dark'] {
93
+ /* 主题基础颜色 */
94
+ --tr-question-primary-color: #177ddc;
95
+ --tr-question-background-color: #1f1f1f;
96
+ --tr-question-modal-background-color: #2a2a2a;
97
+ --tr-question-text-color: #f0f0f0;
98
+ --tr-question-text-color-secondary: #aaaaaa;
99
+ --tr-question-border-color: #434343;
100
+ --tr-question-hover-color: #303030;
101
+ --tr-question-tab-hover-bg: #3a3a3a;
102
+ --tr-question-active-tab-color: var(--tr-question-primary-color);
103
+ --tr-question-active-tab-bg: #113a5c;
104
+
105
+ /* 弹窗相关颜色 */
106
+ --tr-question-header-bg: #2a2a2a;
107
+ --tr-question-title-color: #c9d1d9;
108
+ --tr-question-close-icon-color: #8b949e;
109
+ --tr-question-tab-active-bg: #30363d;
110
+ --tr-question-tab-active-text: #58a6ff;
111
+ --tr-question-tab-text: #8b949e;
112
+ --tr-question-tab-border: #30363d;
113
+ --tr-question-list-divider-color: #30363d;
114
+ --tr-question-modal-backdrop-color: rgba(0, 0, 0, 0.7);
115
+
116
+ /* 常见问题颜色 */
117
+ --tr-question-common-bg: #2a2a2a;
118
+ --tr-question-common-text: #e6e6e6;
119
+ --tr-question-common-hover-bg: #3a3a3a;
120
+ --tr-question-common-shadow: rgba(0, 0, 0, 0.2);
121
+
122
+ /* 背景颜色 */
123
+ --tr-question-container-bg: #141414;
124
+ --tr-question-list-item-bg: #2a2a2a;
125
+ --tr-question-list-hover-shadow: rgba(0, 0, 0, 0.3);
126
+ --tr-question-category-bg: rgba(255, 255, 255, 0.04);
127
+ --tr-question-category-hover-bg: rgba(255, 255, 255, 0.08);
128
+ --tr-question-category-active-border: #e6e6e6;
129
+ --tr-question-item-border-color: rgba(255, 255, 255, 0.04);
130
+
131
+ /* 滚动条颜色 */
132
+ --tr-question-scrollbar-track-bg: rgba(255, 255, 255, 0.05);
133
+ --tr-question-scrollbar-thumb-bg: rgba(255, 255, 255, 0.2);
134
+ --tr-question-scrollbar-thumb-hover-bg: rgba(255, 255, 255, 0.3);
135
+ }
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
- import { TinyButton, TinyTooltip } from '@opentiny/vue'
3
+ import TinyButton from '@opentiny/vue-button'
4
4
  import { IconClose } from '@opentiny/vue-icon'
5
5
  import { ActionButtonsProps } from '../index.type'
6
6
 
@@ -46,41 +46,32 @@ const props = withDefaults(defineProps<ActionButtonsProps>(), {
46
46
  submitType: 'enter',
47
47
  })
48
48
 
49
- const emit = defineEmits({
49
+ const emit = defineEmits<{
50
50
  /**
51
51
  * 清除内容事件
52
52
  */
53
- clear: () => true,
53
+ (e: 'clear'): void
54
54
  /**
55
55
  * 切换语音识别状态事件
56
- * @param {boolean} state - 新的语音识别状态
57
56
  */
58
- 'toggle-speech': (state: boolean) => Boolean(state),
57
+ (e: 'toggle-speech', state: boolean): void
59
58
  /**
60
59
  * 提交内容事件
61
60
  */
62
- submit: () => true,
63
- })
61
+ (e: 'submit'): void
62
+ /**
63
+ * 取消发送事件,用于取消加载状态
64
+ */
65
+ (e: 'cancel'): void
66
+ }>()
64
67
 
65
68
  /**
66
69
  * 是否启用语音功能
67
70
  */
68
71
  const speechEnabled = computed(() => props.allowSpeech)
69
72
 
70
- /**
71
- * 语音按钮提示文本
72
- */
73
- const speechButtonText = computed(() => (props.speechStatus.isRecording ? '停止录音' : '开始语音输入'))
74
-
75
73
  const isSpeechRecording = computed(() => props.speechStatus.isRecording)
76
74
 
77
- /**
78
- * 提交按钮tooltip
79
- */
80
- const submitTooltip = computed(() => {
81
- return props.loading ? `发送中...` : '发送消息'
82
- })
83
-
84
75
  /**
85
76
  * 整体禁用状态
86
77
  */
@@ -113,6 +104,15 @@ const handleSubmit = () => {
113
104
  emit('submit')
114
105
  }
115
106
  }
107
+
108
+ /**
109
+ * 处理取消操作
110
+ */
111
+ const handleCancel = () => {
112
+ if (!isDisabled.value) {
113
+ emit('cancel')
114
+ }
115
+ }
116
116
  </script>
117
117
 
118
118
  <template>
@@ -128,18 +128,16 @@ const handleSubmit = () => {
128
128
 
129
129
  <!-- 语音按钮:仅在启用语音功能时显示 -->
130
130
  <template v-if="speechEnabled && !loading">
131
- <tiny-tooltip :content="speechButtonText" placement="top">
132
- <tiny-button
133
- type="text"
134
- :disabled="isDisabled"
135
- @click="handleToggleSpeech"
136
- class="speech-button"
137
- :class="{ 'is-recording': isSpeechRecording }"
138
- >
139
- <img v-if="!isSpeechRecording" src="../../assets/icons/voice.svg" class="button-icon" alt="录音" />
140
- <img v-else src="../../assets/icons/loading-speech.svg" class="button-icon recording-icon" alt="语音中" />
141
- </tiny-button>
142
- </tiny-tooltip>
131
+ <tiny-button
132
+ type="text"
133
+ :disabled="isDisabled"
134
+ @click="handleToggleSpeech"
135
+ class="speech-button"
136
+ :class="{ 'is-recording': isSpeechRecording }"
137
+ >
138
+ <img v-if="!isSpeechRecording" src="../../assets/icons/voice.svg" class="button-icon" alt="录音" />
139
+ <img v-else src="../../assets/icons/loading-speech.svg" class="button-icon recording-icon" alt="语音中" />
140
+ </tiny-button>
143
141
  </template>
144
142
 
145
143
  <template v-if="showClear">
@@ -152,14 +150,19 @@ const handleSubmit = () => {
152
150
 
153
151
  <!-- 提交按钮:主操作按钮 -->
154
152
  <template v-if="hasContent || loading">
155
- <tiny-tooltip :content="submitTooltip" placement="top">
156
- <tiny-button type="text" @click="handleSubmit" class="submit-button" :disabled="isDisabled">
157
- <div class="button-content">
158
- <img v-if="!loading" src="../../assets/icons/send.svg" alt="发送" />
159
- <img v-else src="../../assets/icons/loading.svg" alt="加载中" class="loading" />
160
- </div>
161
- </tiny-button>
162
- </tiny-tooltip>
153
+ <tiny-button
154
+ type="text"
155
+ :class="loading ? 'cancel-button' : 'submit-button'"
156
+ :disabled="isDisabled"
157
+ @click="loading ? handleCancel() : handleSubmit()"
158
+ >
159
+ <div class="button-content">
160
+ <img v-if="!loading" src="../../assets/icons/send.svg" alt="发送" />
161
+ <tiny-tooltip v-else content="停止生成" placement="top">
162
+ <img src="../../assets/icons/loading.svg" alt="加载中" class="loading" />
163
+ </tiny-tooltip>
164
+ </div>
165
+ </tiny-button>
163
166
  </template>
164
167
  </div>
165
168
  </template>
@@ -1,5 +1,4 @@
1
1
  import { ref, watch } from 'vue'
2
- import { debounce } from 'lodash-es'
3
2
  import type { SenderProps, SenderEmits } from '../index.type'
4
3
 
5
4
  /**
@@ -10,7 +9,7 @@ import type { SenderProps, SenderEmits } from '../index.type'
10
9
  * @param emit 组件方法
11
10
  */
12
11
  export function useInputHandler(props: SenderProps, emit: SenderEmits) {
13
- const inputValue = ref(props.defaultValue || '')
12
+ const inputValue = ref(props.modelValue || props.defaultValue || '')
14
13
  const inputWrapper = ref<HTMLElement | null>(null)
15
14
 
16
15
  // 同步外部值变化
@@ -23,23 +22,29 @@ export function useInputHandler(props: SenderProps, emit: SenderEmits) {
23
22
  },
24
23
  )
25
24
 
25
+ // 监听内部值变化,触发update:modelValue事件
26
+ watch(
27
+ () => inputValue.value,
28
+ (val) => {
29
+ emit('update:modelValue', val)
30
+ },
31
+ )
32
+
26
33
  // 双向绑定处理
27
34
  const handleChange = (value: string) => {
28
35
  inputValue.value = value
29
36
  emit('update:modelValue', value)
30
37
  }
31
38
 
32
- // 防抖提交
33
- const debouncedSubmit = debounce((value: string) => {
34
- if (!props.disabled && !props.loading && value.trim()) {
35
- emit('submit', value)
36
- }
37
- }, props.debounceSubmit)
38
-
39
39
  // 提交处理
40
40
  const handleSubmit = (event?: Event) => {
41
41
  event?.preventDefault()
42
- debouncedSubmit(inputValue.value)
42
+
43
+ const submitValue = inputValue.value
44
+
45
+ if (!props.disabled && !props.loading && submitValue.trim()) {
46
+ emit('submit', submitValue)
47
+ }
43
48
  }
44
49
 
45
50
  // 清空输入
@@ -34,7 +34,6 @@ export function useKeyboardHandler(
34
34
  */
35
35
  const triggerSubmit = () => {
36
36
  if (!validateSubmission(inputValue.value)) return
37
- alert('提交成功')
38
37
  emit('submit', inputValue.value.trim())
39
38
  }
40
39
 
@@ -42,6 +41,12 @@ export function useKeyboardHandler(
42
41
  * 检查是否为指定的提交快捷键
43
42
  * @param event 键盘事件
44
43
  * @param submitType 提交类型
44
+ * @returns 是否触发提交
45
+ *
46
+ * 提交行为说明:
47
+ * - 当 submitType 为 enter 时:按 Enter 键提交
48
+ * - 当 submitType 为 ctrlEnter 时:按 Ctrl+Enter 提交,单独按 Enter 换行
49
+ * - 当 submitType 为 shiftEnter 时:按 Shift+Enter 提交,单独按 Enter 换行
45
50
  */
46
51
  const checkSubmitShortcut = (event: KeyboardEvent, submitType: SubmitTrigger): boolean => {
47
52
  const isEnter = event.key === 'Enter'
@@ -49,13 +54,10 @@ export function useKeyboardHandler(
49
54
 
50
55
  switch (submitType) {
51
56
  case 'enter':
52
- console.log('enter')
53
57
  return !event.shiftKey && !event.ctrlKey && !event.metaKey
54
58
  case 'ctrlEnter':
55
- console.log('ctrlEnter')
56
59
  return (event.ctrlKey || event.metaKey) && !event.shiftKey
57
60
  case 'shiftEnter':
58
- console.log('shiftEnter')
59
61
  return event.shiftKey && !event.ctrlKey && !event.metaKey
60
62
  default:
61
63
  return false
@@ -1,13 +1,6 @@
1
1
  import { reactive } from 'vue'
2
2
  import type { SpeechHookOptions, SpeechHandler, SpeechState } from '../index.type'
3
3
 
4
- declare global {
5
- interface Window {
6
- webkitSpeechRecognition: typeof SpeechRecognition
7
- SpeechRecognition: typeof SpeechRecognition
8
- }
9
- }
10
-
11
4
  /**
12
5
  * 语音识别处理 Hook
13
6
  * 集中管理语音识别相关逻辑
@@ -19,17 +12,18 @@ export function useSpeechHandler(options: SpeechHookOptions): SpeechHandler {
19
12
  // 语音识别状态
20
13
  const speechState = reactive<SpeechState>({
21
14
  isRecording: false,
22
- isSupported: 'webkitSpeechRecognition' in window || 'SpeechRecognition' in window,
15
+ isSupported:
16
+ (typeof window !== 'undefined' && 'webkitSpeechRecognition' in window) || 'SpeechRecognition' in window,
23
17
  error: undefined,
24
18
  })
25
19
 
26
20
  // 创建语音识别实例
27
- const recognition = speechState.isSupported
21
+ const recognition: SpeechRecognition | undefined = speechState.isSupported
28
22
  ? new (window.webkitSpeechRecognition || window.SpeechRecognition)()
29
- : null
23
+ : undefined
30
24
 
31
25
  // 初始化语音识别配置
32
- if (recognition) {
26
+ if (recognition !== undefined) {
33
27
  recognition.continuous = options.continuous ?? false
34
28
  recognition.interimResults = options.interimResults ?? true
35
29
  recognition.lang = options.lang ?? navigator.language
@@ -2,13 +2,9 @@
2
2
 
3
3
  // 主要组件样式
4
4
  .tiny-sender {
5
- border: 1px solid var(--tr-sender-border-color);
6
- border-radius: var(--tr-sender-border-radius);
7
5
  background: var(--tr-sender-bg-color);
8
6
  position: relative;
9
7
  color: var(--tr-sender-text-color);
10
- padding: var(--tr-sender-padding-top) var(--tr-sender-padding-right) var(--tr-sender-padding-bottom)
11
- var(--tr-sender-padding-left);
12
8
 
13
9
  // TinyUI 输入框调整
14
10
  .tiny-input__prefix {
@@ -166,11 +162,12 @@
166
162
  min-width: var(--tr-sender-prefix-min-width);
167
163
  flex: 0 0 var(--tr-sender-prefix-width); /* 固定宽度,不可伸缩 */
168
164
  display: flex;
169
- align-items: center;
165
+ align-items: start;
170
166
  justify-content: center;
171
167
  background: var(--tr-sender-bg-color);
172
168
  border-radius: var(--tr-sender-border-radius) 0 0 var(--tr-sender-border-radius);
173
169
  transition: background-color var(--tr-sender-transition-duration);
170
+ padding-top: 8px;
174
171
  padding-left: var(--tr-sender-prefix-padding-left);
175
172
  padding-right: calc(var(--tr-sender-padding-right) / 2);
176
173
 
@@ -290,6 +287,7 @@
290
287
  var(--tr-sender-padding-left);
291
288
  background: var(--tr-sender-bg-color);
292
289
  border-radius: var(--tr-sender-border-radius);
290
+ align-items: center;
293
291
 
294
292
  /* 按钮图标统一样式 */
295
293
  .button-icon {
@@ -31,7 +31,6 @@ export interface SenderProps {
31
31
  clearable?: boolean // 是否显示清除按钮
32
32
  disabled?: boolean // 禁用状态
33
33
  defaultValue?: string | null // 默认值
34
- debounceSubmit?: number // 提交防抖时间(ms)
35
34
  loading?: boolean // 加载状态
36
35
  modelValue?: string // 双向绑定值
37
36
  mode?: InputMode // 输入框模式:单行/多行
@@ -72,6 +71,7 @@ export type SenderEmits = {
72
71
  (e: 'focus', event: FocusEvent): void
73
72
  (e: 'blur', event: FocusEvent): void
74
73
  (e: 'escape-press'): void // 按下Esc键时触发
74
+ (e: 'cancel'): void // 取消发送状态时触发
75
75
  }
76
76
 
77
77
  // 语音识别状态