@opentiny/tiny-robot 0.1.0-alpha.0 → 0.1.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 (234) 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/index.d.ts +9 -5
  7. package/dist/index.js +25 -18
  8. package/dist/node_modules/.pnpm/@opentiny_utils@1.0.0/node_modules/@opentiny/utils/dist/opentiny-utils.es.js +832 -0
  9. package/dist/node_modules/.pnpm/@opentiny_utils@3.22.0/node_modules/@opentiny/utils/dist/index.es.js +959 -1496
  10. 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
  11. 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
  12. package/dist/node_modules/.pnpm/@opentiny_vue-common@3.21.0/node_modules/@opentiny/vue-common/lib/index.js +727 -0
  13. package/dist/node_modules/.pnpm/@opentiny_vue-common@3.22.0/node_modules/@opentiny/vue-common/lib/index.js +144 -675
  14. 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
  15. 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
  16. package/dist/node_modules/.pnpm/@opentiny_vue-icon@3.21.0/node_modules/@opentiny/vue-icon/lib/close.js +29 -0
  17. 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
  18. 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
  19. 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
  20. 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
  21. 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
  22. 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
  23. 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
  24. 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
  25. 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
  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-row-before.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-align-center.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-align-left.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-align-right.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-bold.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-code-block.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-code-view.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-color.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-delete-column.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-delete-row.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-delete-table.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-font-size.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-format-clear.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-h1.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-h2.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-h3.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-h4.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-h5.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-h6.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-heading.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-high-light.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-image.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-italic.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-line-height.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-link-unlink.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-link.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-list-ordered.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-list-unordered.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-merge-cells-vertical.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-merge-cells.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-node-delete.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-paragraph.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-quote-text.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-redo.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-split-cells-horizontal.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-split-cells-vertical.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-strike-through.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-subscript.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-superscript.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-table.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-task-list.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-underline.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-undo.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/sub-script.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/warn.js +1 -1
  71. 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
  72. 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
  73. 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
  74. 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
  75. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/browser.js +36 -0
  76. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/clickoutside.js +47 -0
  77. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/debounce.js +7 -0
  78. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/dom.js +45 -0
  79. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/popper.js +320 -0
  80. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/popup-manager.js +118 -0
  81. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/throttle.js +23 -0
  82. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/useEventListener.js +9 -0
  83. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/useInstanceSlots.js +14 -0
  84. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/useRelation.js +54 -0
  85. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/vue-popper.js +84 -0
  86. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/deps/vue-popup.js +73 -0
  87. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/event.js +13 -0
  88. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/function.js +5 -0
  89. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/index.js +11 -0
  90. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/object.js +84 -0
  91. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/string.js +28 -0
  92. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/common/type.js +28 -0
  93. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/dialog-box/index.js +136 -0
  94. 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
  95. 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
  96. 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
  97. 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
  98. 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
  99. 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
  100. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.21.2/node_modules/@opentiny/vue-renderless/tooltip/vue.js +90 -0
  101. 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
  102. 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
  103. package/dist/packages/components/src/{bubble-list → bubble}/bubble-list.vue.js +2 -2
  104. package/dist/packages/components/src/bubble/bubble-list.vue2.js +38 -0
  105. package/dist/packages/components/src/bubble/bubble.vue.js +7 -0
  106. package/dist/packages/components/src/bubble/bubble.vue2.js +118 -0
  107. package/dist/packages/components/src/bubble/components/actions/copy.vue.js +7 -0
  108. package/dist/packages/components/src/bubble/components/actions/copy.vue2.js +35 -0
  109. package/dist/packages/components/src/bubble/components/actions/refresh.vue.js +7 -0
  110. package/dist/packages/components/src/bubble/components/actions/refresh.vue2.js +16 -0
  111. package/dist/packages/components/src/bubble/index.js +18 -0
  112. package/dist/packages/components/src/bubble/useScroll.js +13 -0
  113. package/dist/packages/components/src/conversations/index.js +1 -1
  114. package/dist/packages/components/src/prompts/index.js +18 -0
  115. package/dist/packages/components/src/prompts/prompt.vue.js +7 -0
  116. package/dist/packages/components/src/prompts/prompt.vue2.js +37 -0
  117. package/dist/packages/components/src/prompts/prompts.vue.js +7 -0
  118. package/dist/packages/components/src/prompts/prompts.vue2.js +36 -0
  119. package/dist/packages/components/src/question/components/CommonQuestions.vue.js +89 -0
  120. package/dist/packages/components/src/question/components/CommonQuestions.vue2.js +4 -0
  121. package/dist/packages/components/src/question/components/HotQuestions.vue.js +140 -0
  122. package/dist/packages/components/src/question/components/HotQuestions.vue2.js +4 -0
  123. package/dist/packages/components/src/question/composables/useQuestions.js +48 -0
  124. package/dist/packages/components/src/question/index.js +9 -0
  125. package/dist/packages/components/src/question/index.vue.js +113 -0
  126. package/dist/packages/components/src/question/index.vue2.js +4 -0
  127. package/dist/packages/components/src/sender/components/ActionButtons.vue.js +105 -123
  128. package/dist/packages/components/src/sender/composables/useInputHandler.js +26 -22
  129. package/dist/packages/components/src/sender/composables/useKeyboardHandler.js +11 -11
  130. package/dist/packages/components/src/sender/composables/useSpeechHandler.js +9 -9
  131. package/dist/packages/components/src/sender/index.vue.js +67 -66
  132. package/dist/packages/components/src/welcome/index.vue.js +5 -7
  133. package/dist/packages/components/src/welcome/index.vue2.js +32 -0
  134. package/dist/packages/svgs/dist/tiny-robot-svgs.js +144 -0
  135. package/dist/prompts/index.d.ts +12 -0
  136. package/dist/prompts/index.type.d.ts +55 -0
  137. package/dist/prompts/prompt.vue.d.ts +3 -0
  138. package/dist/prompts/prompts.vue.d.ts +20 -0
  139. package/dist/question/components/CommonQuestions.vue.d.ts +32 -0
  140. package/dist/question/components/HotQuestions.vue.d.ts +89 -0
  141. package/dist/question/composables/useQuestions.d.ts +17 -0
  142. package/dist/question/index.d.ts +7 -0
  143. package/dist/question/index.type.d.ts +74 -0
  144. package/dist/question/index.vue.d.ts +46 -0
  145. package/dist/sender/components/ActionButtons.vue.d.ts +6 -4
  146. package/dist/sender/composables/useSpeechHandler.d.ts +0 -6
  147. package/dist/sender/index.type.d.ts +1 -1
  148. package/dist/sender/index.vue.d.ts +1 -2
  149. package/dist/style.css +1 -1
  150. package/dist/welcome/index.type.d.ts +10 -0
  151. package/dist/welcome/index.vue.d.ts +17 -1
  152. package/package.json +5 -3
  153. package/src/bubble/bubble-list.vue +44 -0
  154. package/src/bubble/bubble.vue +247 -0
  155. package/src/bubble/components/actions/copy.vue +54 -0
  156. package/src/bubble/components/actions/refresh.vue +31 -0
  157. package/src/bubble/index.ts +23 -0
  158. package/src/bubble/index.type.ts +63 -0
  159. package/src/bubble/useScroll.ts +14 -0
  160. package/src/conversations/index.ts +1 -1
  161. package/src/index.ts +23 -12
  162. package/src/prompts/index.ts +25 -0
  163. package/src/prompts/index.type.ts +59 -0
  164. package/src/prompts/prompt.vue +115 -0
  165. package/src/prompts/prompts.vue +50 -0
  166. package/src/question/components/CommonQuestions.vue +146 -0
  167. package/src/question/components/HotQuestions.vue +148 -0
  168. package/src/question/composables/useQuestions.ts +106 -0
  169. package/src/question/index.less +448 -0
  170. package/src/question/index.ts +12 -0
  171. package/src/question/index.type.ts +86 -0
  172. package/src/question/index.vue +140 -0
  173. package/src/question/vars.less +135 -0
  174. package/src/sender/components/ActionButtons.vue +42 -39
  175. package/src/sender/composables/useInputHandler.ts +15 -10
  176. package/src/sender/composables/useKeyboardHandler.ts +6 -4
  177. package/src/sender/composables/useSpeechHandler.ts +5 -11
  178. package/src/sender/index.less +3 -5
  179. package/src/sender/index.type.ts +1 -1
  180. package/src/sender/index.vue +3 -2
  181. package/src/welcome/index.type.ts +12 -0
  182. package/src/welcome/index.vue +68 -2
  183. package/dist/bubble-item/components/icons/ai.vue.d.ts +0 -2
  184. package/dist/bubble-item/components/icons/index.d.ts +0 -2
  185. package/dist/bubble-item/components/icons/user.vue.d.ts +0 -2
  186. package/dist/bubble-item/index.d.ts +0 -7
  187. package/dist/bubble-list/index.d.ts +0 -8
  188. package/dist/bubble-list/index.type.d.ts +0 -55
  189. package/dist/node_modules/.pnpm/@opentiny_vue-directive@3.22.0/node_modules/@opentiny/vue-directive/index.js +0 -57
  190. package/dist/node_modules/.pnpm/@opentiny_vue-hooks@3.22.0/node_modules/@opentiny/vue-hooks/dist/src/vue-popper.js +0 -85
  191. package/dist/node_modules/.pnpm/@opentiny_vue-hooks@3.22.0/node_modules/@opentiny/vue-hooks/dist/src/vue-popup.js +0 -69
  192. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.22.0/node_modules/@opentiny/vue-renderless/dialog-box/index.js +0 -135
  193. package/dist/node_modules/.pnpm/@opentiny_vue-renderless@3.22.0/node_modules/@opentiny/vue-renderless/tooltip/vue.js +0 -90
  194. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js +0 -5
  195. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js +0 -10
  196. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTrim.js +0 -8
  197. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js +0 -4
  198. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js +0 -15
  199. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js +0 -7
  200. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js +0 -5
  201. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_trimmedEndIndex.js +0 -9
  202. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/debounce.js +0 -54
  203. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js +0 -7
  204. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js +0 -6
  205. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSymbol.js +0 -9
  206. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/now.js +0 -7
  207. package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toNumber.js +0 -22
  208. package/dist/packages/components/src/bubble-item/bubble-item.vue.js +0 -7
  209. package/dist/packages/components/src/bubble-item/bubble-item.vue2.js +0 -111
  210. package/dist/packages/components/src/bubble-item/components/actions/copy.vue.js +0 -46
  211. package/dist/packages/components/src/bubble-item/components/actions/copy.vue2.js +0 -4
  212. package/dist/packages/components/src/bubble-item/components/actions/refresh.vue.js +0 -12
  213. package/dist/packages/components/src/bubble-item/components/icons/ai.vue.js +0 -45
  214. package/dist/packages/components/src/bubble-item/components/icons/user.vue.js +0 -63
  215. package/dist/packages/components/src/bubble-item/index.js +0 -9
  216. package/dist/packages/components/src/bubble-list/bubble-list.vue2.js +0 -52
  217. package/dist/packages/components/src/bubble-list/index.js +0 -9
  218. package/src/bubble-item/bubble-item.vue +0 -264
  219. package/src/bubble-item/components/actions/copy.vue +0 -47
  220. package/src/bubble-item/components/actions/refresh.vue +0 -27
  221. package/src/bubble-item/components/icons/ai.vue +0 -30
  222. package/src/bubble-item/components/icons/index.ts +0 -2
  223. package/src/bubble-item/components/icons/user.vue +0 -78
  224. package/src/bubble-item/index.ts +0 -12
  225. package/src/bubble-list/bubble-list.vue +0 -53
  226. package/src/bubble-list/index.ts +0 -14
  227. package/src/bubble-list/index.type.ts +0 -65
  228. package/src/sender/global.d.ts +0 -44
  229. /package/dist/{bubble-list → bubble}/bubble-list.vue.d.ts +0 -0
  230. /package/dist/{bubble-item → bubble}/components/actions/index.d.ts +0 -0
  231. /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
  232. /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
  233. /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
  234. /package/src/{bubble-item → bubble}/components/actions/index.ts +0 -0
@@ -1,2 +1,18 @@
1
- declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
1
+ import { WelcomeProps, WelcomeSlots } from './index.type';
2
+ declare function __VLS_template(): {
3
+ attrs: Partial<{}>;
4
+ slots: Readonly<WelcomeSlots> & WelcomeSlots;
5
+ refs: {};
6
+ rootEl: HTMLDivElement;
7
+ };
8
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
9
+ declare const __VLS_component: import('vue').DefineComponent<WelcomeProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<WelcomeProps> & Readonly<{}>, {
10
+ align: "left" | "center" | "right" | string;
11
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
12
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
2
13
  export default _default;
14
+ type __VLS_WithTemplateSlots<T, S> = T & {
15
+ new (): {
16
+ $slots: S;
17
+ };
18
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-robot",
3
- "version": "0.1.0-alpha.0",
3
+ "version": "0.1.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -8,6 +8,7 @@
8
8
  "main": "./dist/index.js",
9
9
  "module": "./dist/index.js",
10
10
  "scripts": {
11
+ "dev": "vue-tsc && vite build --watch",
11
12
  "build": "vue-tsc && vite build",
12
13
  "type-check": "vue-tsc --noEmit"
13
14
  },
@@ -15,17 +16,18 @@
15
16
  "vue": "^3.3.11"
16
17
  },
17
18
  "dependencies": {
19
+ "@opentiny/tiny-robot-svgs": "0.1.0",
18
20
  "@opentiny/vue": "^3.21.0",
19
21
  "@opentiny/vue-button": "^3.21.0",
20
22
  "@opentiny/vue-icon": "^3.22.0",
21
23
  "@opentiny/vue-input": "^3.21.0",
22
24
  "@opentiny/vue-tooltip": "^3.22.0",
23
- "lodash-es": "4.17.21",
24
25
  "markdown-it": "^14.1.0",
25
26
  "vue": "^3.3.11"
26
27
  },
27
28
  "devDependencies": {
28
29
  "@opentiny/vue-vite-import": "^1.3.0",
30
+ "@types/dom-speech-recognition": "^0.0.6",
29
31
  "@types/lodash-es": "^4.17.12",
30
32
  "@types/markdown-it": "^14.1.2",
31
33
  "@types/node": "^22.13.17",
@@ -38,5 +40,5 @@
38
40
  "vue": "^3.3.11",
39
41
  "vue-tsc": "^2.2.8"
40
42
  },
41
- "gitHead": "726b80c0db74ae929e450edb6a7af9fbb8f0fe45"
43
+ "gitHead": "ff5f5ae32d52a6298401cbd9c7f70f0b0c5253e3"
42
44
  }
@@ -0,0 +1,44 @@
1
+ <script setup lang="ts">
2
+ import { computed, ref, watch } from 'vue'
3
+ import Bubble from './bubble.vue'
4
+ import { BubbleListProps, BubbleProps } from './index.type'
5
+ import { useElementScroll } from './useScroll'
6
+
7
+ const props = withDefaults(defineProps<BubbleListProps>(), {})
8
+
9
+ const scrollContainer = ref<HTMLDivElement>()
10
+ const { scrollToBottom } = useElementScroll(scrollContainer)
11
+
12
+ const lastBubble = computed(() => props.items.at(-1))
13
+
14
+ watch([() => props.items.length, () => lastBubble.value?.content], () => {
15
+ if (!props.autoScroll) {
16
+ return
17
+ }
18
+
19
+ scrollToBottom()
20
+ })
21
+
22
+ const getItemProps = (item: BubbleProps): BubbleProps => {
23
+ const defaultConfig = item.role ? props.roles?.[item.role] || {} : {}
24
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
25
+ const { id, ...rest } = item
26
+ return { ...defaultConfig, ...rest }
27
+ }
28
+ </script>
29
+
30
+ <template>
31
+ <div class="tr-bubble-list" ref="scrollContainer">
32
+ <Bubble v-for="(item, index) in props.items" :key="item.id || index" v-bind="getItemProps(item)"></Bubble>
33
+ </div>
34
+ </template>
35
+
36
+ <style lang="less" scoped>
37
+ .tr-bubble-list {
38
+ display: flex;
39
+ flex-direction: column;
40
+ gap: 16px;
41
+ overflow-y: auto;
42
+ padding: 16px;
43
+ }
44
+ </style>
@@ -0,0 +1,247 @@
1
+ <script setup lang="ts">
2
+ import markdownit from 'markdown-it'
3
+ import { computed, defineComponent, useSlots } from 'vue'
4
+ import { BubbleActionOptions, BubbleEvents, BubbleProps, BubbleSlots } from './index.type'
5
+ import { CopyAction, RefreshAction } from './components/actions'
6
+
7
+ const props = withDefaults(defineProps<BubbleProps>(), {
8
+ content: '',
9
+ placement: 'start',
10
+ type: 'text',
11
+ maxWidth: '80%',
12
+ })
13
+
14
+ const emit = defineEmits<BubbleEvents>()
15
+
16
+ defineSlots<BubbleSlots>()
17
+
18
+ const slots = useSlots()
19
+
20
+ const bubbleContent = computed(() => {
21
+ if (props.type === 'markdown') {
22
+ return markdownit(props.mdConfig || {}).render(props.content)
23
+ }
24
+ return props.content
25
+ })
26
+
27
+ const placementStart = computed(() => props.placement === 'start')
28
+
29
+ const AvatarComp = computed(() => {
30
+ if (!props.avatar) {
31
+ return null
32
+ }
33
+
34
+ return defineComponent(() => {
35
+ return () => props.avatar
36
+ })
37
+ })
38
+
39
+ const defaultActionsMap = new Map<string, BubbleActionOptions>([
40
+ [
41
+ 'copy',
42
+ {
43
+ name: 'copy',
44
+ vnode: CopyAction,
45
+ show: true,
46
+ },
47
+ ],
48
+ [
49
+ 'refresh',
50
+ {
51
+ name: 'refresh',
52
+ vnode: RefreshAction,
53
+ show: true,
54
+ },
55
+ ],
56
+ ])
57
+
58
+ const computedActions = computed(() => {
59
+ const actions = (props.actions || []).map((action) => {
60
+ if (typeof action === 'string') {
61
+ return defaultActionsMap.get(action)
62
+ }
63
+
64
+ if (defaultActionsMap.has(action.name)) {
65
+ return {
66
+ ...defaultActionsMap.get(action.name),
67
+ ...action,
68
+ }
69
+ }
70
+
71
+ return action
72
+ })
73
+
74
+ return actions.filter((action): action is BubbleActionOptions => Boolean(action))
75
+ })
76
+
77
+ const handleActionClick = (name: string, ...args: unknown[]) => {
78
+ if (name === 'copy') {
79
+ emit('copy', args[0] as boolean)
80
+ return
81
+ }
82
+
83
+ if (name === 'refresh') {
84
+ emit('refresh')
85
+ return
86
+ }
87
+
88
+ emit('action', name, ...args)
89
+ }
90
+ </script>
91
+
92
+ <template>
93
+ <div
94
+ :class="[
95
+ 'tr-bubble',
96
+ {
97
+ 'placement-start': placementStart,
98
+ 'placement-end': !placementStart,
99
+ },
100
+ ]"
101
+ >
102
+ <div v-if="AvatarComp" class="tr-bubble__avatar">
103
+ <component :is="AvatarComp"></component>
104
+ </div>
105
+ <div class="tr-bubble__content-wrapper">
106
+ <slot v-if="props.loading" name="loading">
107
+ <div class="tr-bubble__loading">
108
+ <span></span>
109
+ <span></span>
110
+ <span></span>
111
+ </div>
112
+ </slot>
113
+ <div v-else :class="['tr-bubble__content']">
114
+ <div class="tr-bubbule__body">
115
+ <slot>
116
+ <span v-if="props.type === 'markdown'" v-html="bubbleContent"></span>
117
+ <span v-else>{{ bubbleContent }}</span>
118
+ <span v-if="props.aborted" class="tr-bubbule__aborted">(用户停止)</span>
119
+ </slot>
120
+ </div>
121
+ <div v-if="slots.footer || computedActions.length > 0" class="tr-bubbule__footer">
122
+ <div class="tr-bubbule__footer-left">
123
+ <slot name="footer"></slot>
124
+ </div>
125
+ <div class="tr-bubbule__footer-actions">
126
+ <template v-for="action in computedActions" :key="action?.name">
127
+ <component
128
+ :is="action.vnode"
129
+ v-show="typeof action.show === 'function' ? action.show(props) : action.show"
130
+ :bubbleItem="props"
131
+ @click="handleActionClick(action.name, $event)"
132
+ ></component>
133
+ </template>
134
+ </div>
135
+ </div>
136
+ </div>
137
+ </div>
138
+ </div>
139
+ </template>
140
+
141
+ <style lang="less" scoped>
142
+ .tr-bubble {
143
+ display: flex;
144
+ gap: 16px;
145
+ max-width: v-bind('props.maxWidth');
146
+
147
+ &.placement-start {
148
+ flex-direction: row;
149
+ }
150
+
151
+ &.placement-end {
152
+ flex-direction: row-reverse;
153
+ margin-left: auto;
154
+ }
155
+ }
156
+
157
+ .tr-bubble__avatar {
158
+ width: 40px;
159
+ height: 40px;
160
+ flex-shrink: 0;
161
+ display: flex;
162
+ align-items: center;
163
+ justify-content: center;
164
+ }
165
+
166
+ .tr-bubble__loading {
167
+ display: flex;
168
+ align-items: center;
169
+ justify-content: center;
170
+ padding: 8px 0;
171
+
172
+ span {
173
+ height: 8px;
174
+ width: 8px;
175
+ margin: 0 2px;
176
+ background-color: #bbb;
177
+ border-radius: 50%;
178
+ display: inline-block;
179
+ animation: typing 1.4s infinite ease-in-out both;
180
+
181
+ &:nth-child(1) {
182
+ animation-delay: 0s;
183
+ }
184
+
185
+ &:nth-child(2) {
186
+ animation-delay: 0.2s;
187
+ }
188
+
189
+ &:nth-child(3) {
190
+ animation-delay: 0.4s;
191
+ }
192
+ }
193
+
194
+ @keyframes typing {
195
+ 0%,
196
+ 80%,
197
+ 100% {
198
+ transform: scale(0);
199
+ }
200
+ 40% {
201
+ transform: scale(1);
202
+ }
203
+ }
204
+ }
205
+
206
+ .tr-bubble__content {
207
+ background-color: white;
208
+ padding: 16px 24px;
209
+ border-radius: 24px;
210
+ box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.02);
211
+
212
+ .tr-bubbule__body {
213
+ color: rgb(25, 25, 25);
214
+ font-size: 16px;
215
+ line-height: 26px;
216
+ }
217
+
218
+ .tr-bubbule__aborted {
219
+ color: rgb(128, 128, 128);
220
+ font-size: 14px;
221
+ }
222
+
223
+ .tr-bubbule__footer {
224
+ display: flex;
225
+ gap: 12px;
226
+
227
+ .tr-bubbule__footer-left {
228
+ flex: 1;
229
+ }
230
+
231
+ .tr-bubbule__footer-actions {
232
+ display: flex;
233
+ flex-shrink: 0;
234
+ gap: 4px;
235
+ margin-top: 12px;
236
+
237
+ & > * {
238
+ display: flex;
239
+ align-items: center;
240
+ justify-content: center;
241
+ width: 24px;
242
+ height: 24px;
243
+ }
244
+ }
245
+ }
246
+ }
247
+ </style>
@@ -0,0 +1,54 @@
1
+ <script setup lang="ts">
2
+ import { BubbleProps } from '../../index.type'
3
+ import { IconCopy } from '@opentiny/tiny-robot-svgs'
4
+
5
+ const { bubbleItem } = defineProps<{ bubbleItem: BubbleProps }>()
6
+
7
+ const emit = defineEmits(['click'])
8
+
9
+ async function copyToClipboard(text: string) {
10
+ try {
11
+ await navigator.clipboard.writeText(text)
12
+ return true
13
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
14
+ } catch (err: unknown) {
15
+ return false
16
+ }
17
+ }
18
+
19
+ const handleClick = async () => {
20
+ const result = bubbleItem.content ? await copyToClipboard(bubbleItem.content) : false
21
+
22
+ emit('click', result)
23
+ }
24
+ </script>
25
+
26
+ <template>
27
+ <button class="icon-btn" @click="handleClick">
28
+ <IconCopy width="16px" height="16px" />
29
+ </button>
30
+ </template>
31
+
32
+ <style lang="less" scoped>
33
+ button.icon-btn {
34
+ width: 28px;
35
+ height: 28px;
36
+ display: inline-flex;
37
+ align-items: center;
38
+ justify-content: center;
39
+ border: none;
40
+ border-radius: 8px;
41
+ cursor: pointer;
42
+ padding: 0;
43
+ transition: background-color 0.3s;
44
+ background-color: white;
45
+
46
+ &:hover {
47
+ background-color: rgba(0, 0, 0, 0.04);
48
+ }
49
+
50
+ &:active {
51
+ background-color: rgba(0, 0, 0, 0.15);
52
+ }
53
+ }
54
+ </style>
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <button class="icon-btn"><IconRefresh width="16px" height="16px" /></button>
3
+ </template>
4
+
5
+ <script setup lang="ts">
6
+ import { IconRefresh } from '@opentiny/tiny-robot-svgs'
7
+ </script>
8
+
9
+ <style lang="less" scoped>
10
+ button.icon-btn {
11
+ width: 28px;
12
+ height: 28px;
13
+ display: inline-flex;
14
+ align-items: center;
15
+ justify-content: center;
16
+ border: none;
17
+ border-radius: 8px;
18
+ cursor: pointer;
19
+ padding: 0;
20
+ transition: background-color 0.3s;
21
+ background-color: white;
22
+
23
+ &:hover {
24
+ background-color: rgba(0, 0, 0, 0.04);
25
+ }
26
+
27
+ &:active {
28
+ background-color: rgba(0, 0, 0, 0.15);
29
+ }
30
+ }
31
+ </style>
@@ -0,0 +1,23 @@
1
+ import { App } from 'vue'
2
+ import BubbleComp from './bubble.vue'
3
+ import BubbleListComp from './bubble-list.vue'
4
+
5
+ BubbleComp.name = 'TrBubble'
6
+
7
+ const bubbleInstall = function (app: App) {
8
+ app.component(BubbleComp.name!, BubbleComp)
9
+ }
10
+
11
+ BubbleComp.install = bubbleInstall
12
+
13
+ export const Bubble = BubbleComp as typeof BubbleComp & { install: typeof bubbleInstall }
14
+
15
+ BubbleListComp.name = 'TrBubbleList'
16
+
17
+ const bubbleListInstall = function (app: App) {
18
+ app.component(BubbleListComp.name!, BubbleListComp)
19
+ }
20
+
21
+ BubbleListComp.install = bubbleListInstall
22
+
23
+ export const BubbleList = BubbleListComp as typeof BubbleListComp & { install: typeof bubbleListInstall }
@@ -0,0 +1,63 @@
1
+ import { Options as MarkdownItOptions } from 'markdown-it'
2
+ import { Component, CSSProperties, VNode } from 'vue'
3
+
4
+ export interface BubbleActionOptions {
5
+ name: 'copy' | 'refresh' | string
6
+ vnode?: VNode | Component
7
+ show?: boolean | ((props: BubbleProps) => boolean)
8
+ }
9
+
10
+ export type BubbleAction = 'copy' | 'refresh' | BubbleActionOptions
11
+
12
+ export type BubblePalcement = 'start' | 'end'
13
+
14
+ export interface BubbleProps {
15
+ /**
16
+ * 气泡内容
17
+ */
18
+ content?: string
19
+ id?: string
20
+ /**
21
+ * 气泡位置
22
+ */
23
+ placement?: BubblePalcement
24
+ avatar?: VNode
25
+ role?: string
26
+ /**
27
+ * 内容类型
28
+ */
29
+ type?: 'text' | 'markdown'
30
+ loading?: boolean
31
+ aborted?: boolean
32
+ /**
33
+ * type 为 'markdown' 时,markdown 的配置项
34
+ */
35
+ mdConfig?: MarkdownItOptions
36
+
37
+ actions?: BubbleAction[]
38
+ // 样式相关
39
+ maxWidth?: CSSProperties['maxWidth']
40
+ }
41
+
42
+ export interface BubbleSlots {
43
+ default: () => unknown
44
+ footer: () => unknown
45
+ loading: () => unknown
46
+ }
47
+
48
+ export interface BubbleEvents {
49
+ (e: 'copy', result: boolean): void
50
+ (e: 'refresh'): void
51
+ (e: 'action', name: string, ...args: unknown[]): void
52
+ }
53
+
54
+ export type BubbleRoleConfig = Pick<BubbleProps, 'placement' | 'avatar' | 'type' | 'mdConfig' | 'actions' | 'maxWidth'>
55
+
56
+ export interface BubbleListProps {
57
+ items: BubbleProps[]
58
+ /**
59
+ * 每个角色的默认配置项
60
+ */
61
+ roles?: Record<string, BubbleRoleConfig>
62
+ autoScroll?: boolean
63
+ }
@@ -0,0 +1,14 @@
1
+ import { nextTick, Ref } from 'vue'
2
+
3
+ export const useElementScroll = (elemRef: Ref<HTMLElement | null | undefined>) => {
4
+ const scrollToBottom = () => {
5
+ nextTick(() => {
6
+ elemRef.value?.scrollTo({
7
+ top: elemRef.value.scrollHeight,
8
+ behavior: 'smooth',
9
+ })
10
+ })
11
+ }
12
+
13
+ return { scrollToBottom }
14
+ }
@@ -1,7 +1,7 @@
1
1
  import { App } from 'vue'
2
2
  import Conversations from './index.vue'
3
3
 
4
- Conversations.name = 'TrConversations'
4
+ Conversations.name = 'Conversations'
5
5
 
6
6
  const install = function <T>(app: App<T>) {
7
7
  app.component(Conversations.name!, Conversations)
package/src/index.ts CHANGED
@@ -1,30 +1,41 @@
1
1
  import { App } from 'vue'
2
- import Welcome from './welcome'
2
+ import { Bubble, BubbleList } from './bubble'
3
3
  import Conversations from './conversations'
4
- import BubbleItem from './bubble-item'
5
- import BubbleList from './bubble-list'
4
+ import { Prompt, Prompts } from './prompts'
6
5
  import Sender from './sender'
6
+ import Welcome from './welcome'
7
+ import Question from './question'
7
8
 
8
- export * from './bubble-list/index.type'
9
+ export * from './bubble/index.type'
10
+ export * from './prompts/index.type'
11
+ export * from './sender/index.type'
12
+ export * from './welcome/index.type'
9
13
 
10
- const components = [Welcome, Conversations, BubbleItem, BubbleList, Sender]
14
+ const components = [Bubble, BubbleList, Conversations, Prompt, Prompts, Sender, Welcome, Question]
11
15
 
12
16
  export default {
13
17
  install<T>(app: App<T>) {
14
18
  components.forEach((component) => {
15
- const name = component.name?.replace(/^Tiny/, '').replace(/^Tr/, '')
19
+ const name = component.name!.replace(/^Tiny/, '').replace(/^Tr/, '')
16
20
  app.component(`Tr${name}`, component)
17
- app.component(`Tiny${name}`, component)
18
21
  })
19
22
  },
20
23
  }
21
24
 
22
25
  export {
23
- Welcome as TrWelcome,
24
- Conversations as TrConversations,
25
- BubbleItem as TrBubbleItem,
26
- BubbleItem as TinyBubbleItem,
26
+ Bubble,
27
+ Bubble as TrBubble,
28
+ BubbleList,
27
29
  BubbleList as TrBubbleList,
28
- BubbleList as TinyBubbleList,
30
+ Conversations,
31
+ Conversations as TrConversations,
32
+ Prompt,
33
+ Prompt as TrPrompt,
34
+ Prompts,
35
+ Prompts as TrPrompts,
36
+ Sender,
29
37
  Sender as TrSender,
38
+ Welcome,
39
+ Welcome as TrWelcome,
40
+ Question,
30
41
  }
@@ -0,0 +1,25 @@
1
+ import { App } from 'vue'
2
+ import PromptComp from './prompt.vue'
3
+ import PromptsComp from './prompts.vue'
4
+
5
+ // TrPrompt
6
+ PromptComp.name = 'TrPrompt'
7
+
8
+ const installPrompt = function <T>(app: App<T>) {
9
+ app.component(PromptComp.name!, PromptComp)
10
+ }
11
+
12
+ PromptComp.install = installPrompt
13
+
14
+ export const Prompt = PromptComp as typeof PromptComp & { install: typeof installPrompt }
15
+
16
+ // TrPrompts
17
+ PromptsComp.name = 'TrPrompts'
18
+
19
+ const installPrompts = function <T>(app: App<T>) {
20
+ app.component(PromptsComp.name!, PromptsComp)
21
+ }
22
+
23
+ PromptsComp.install = installPrompts
24
+
25
+ export const Prompts = PromptsComp as typeof PromptsComp & { install: typeof installPrompts }
@@ -0,0 +1,59 @@
1
+ import { CSSProperties, VNode } from 'vue'
2
+
3
+ export interface PromptProps {
4
+ /**
5
+ * 提示标签,显示提示的主要内容
6
+ */
7
+ label: string
8
+ /**
9
+ * 唯一标识用于区分每个提示项,用于 Prompts 列表。如果不传此参数,则使用 index 作为 key
10
+ */
11
+ id?: string
12
+ /**
13
+ * 提示描述,提供额外的信息
14
+ */
15
+ description?: string
16
+ /**
17
+ * 提示图标,显示在提示项的左侧
18
+ */
19
+ icon?: VNode
20
+ /**
21
+ * 是否禁用。默认 false
22
+ */
23
+ disabled?: boolean
24
+ /**
25
+ * 提示徽章,显示在提示项的右上角
26
+ */
27
+ badge?: string | VNode
28
+ }
29
+
30
+ export interface PromptsProps {
31
+ /**
32
+ * 包含多个提示项的列表
33
+ */
34
+ items: PromptProps[]
35
+ /**
36
+ * 自定义样式,用于各个提示项的不同部分
37
+ */
38
+ itemStyle?: string | CSSProperties
39
+ /**
40
+ * 自定义类名,用于各个提示项的不同部分
41
+ */
42
+ itemClass?: string | string[]
43
+ /**
44
+ * 提示列表是否垂直排列。默认 false
45
+ */
46
+ vertical?: boolean
47
+ /**
48
+ * 提示列表是否折行。默认 false
49
+ */
50
+ wrap?: boolean
51
+ }
52
+
53
+ export interface PromptsEvents {
54
+ (e: 'item-click', ev: MouseEvent, item: PromptProps): void
55
+ }
56
+
57
+ export interface PromptsSlots {
58
+ footer?: () => unknown
59
+ }