@touchvue/chat 1.0.0-beta.5 → 1.0.0-beta.50

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 (443) hide show
  1. package/README.md +25 -25
  2. package/es/_virtual/_plugin-vue_export-helper.mjs +10 -0
  3. package/es/_virtual/_plugin-vue_export-helper.mjs.map +1 -0
  4. package/es/index.mjs.map +1 -1
  5. package/es/node_modules/.pnpm/@touchvue_a2ui@1.0.0-beta.46/node_modules/@touchvue/a2ui/dist/index.mjs +4816 -0
  6. package/es/node_modules/.pnpm/@touchvue_a2ui@1.0.0-beta.46/node_modules/@touchvue/a2ui/dist/index.mjs.map +1 -0
  7. package/es/node_modules/.pnpm/dompurify@3.3.0/node_modules/dompurify/dist/purify.es.mjs +1380 -0
  8. package/es/node_modules/.pnpm/dompurify@3.3.0/node_modules/dompurify/dist/purify.es.mjs.map +1 -0
  9. package/es/node_modules/.pnpm/html2canvas@1.4.1/node_modules/html2canvas/dist/html2canvas.esm.mjs +7824 -0
  10. package/es/node_modules/.pnpm/html2canvas@1.4.1/node_modules/html2canvas/dist/html2canvas.esm.mjs.map +1 -0
  11. package/es/package.json.css +1 -1
  12. package/es/package.json.mjs +2 -2
  13. package/es/packages/components/index.mjs +1 -1
  14. package/es/packages/components/resolver.mjs.map +1 -1
  15. package/es/packages/components/touchchat/component/AiRobot/HelloChat.vue.mjs +3 -2
  16. package/es/packages/components/touchchat/component/AiRobot/HelloChat.vue.mjs.map +1 -1
  17. package/es/packages/components/touchchat/component/AiRobot/HelloChat.vue2.mjs +219 -159
  18. package/es/packages/components/touchchat/component/AiRobot/HelloChat.vue2.mjs.map +1 -1
  19. package/es/packages/components/touchchat/component/AiRobot/face.vue.mjs +3 -2
  20. package/es/packages/components/touchchat/component/AiRobot/face.vue.mjs.map +1 -1
  21. package/es/packages/components/touchchat/component/AiRobot/face.vue2.mjs +27 -13
  22. package/es/packages/components/touchchat/component/AiRobot/face.vue2.mjs.map +1 -1
  23. package/es/packages/components/touchchat/component/AiRobot/letter.vue.mjs +3 -2
  24. package/es/packages/components/touchchat/component/AiRobot/letter.vue.mjs.map +1 -1
  25. package/es/packages/components/touchchat/component/AiRobot/letter.vue2.mjs +182 -41
  26. package/es/packages/components/touchchat/component/AiRobot/letter.vue2.mjs.map +1 -1
  27. package/es/packages/components/touchchat/component/AiRobot/meterialPrepare.vue.mjs +3 -2
  28. package/es/packages/components/touchchat/component/AiRobot/meterialPrepare.vue.mjs.map +1 -1
  29. package/es/packages/components/touchchat/component/AiRobot/meterialPrepare.vue2.mjs +15 -10
  30. package/es/packages/components/touchchat/component/AiRobot/meterialPrepare.vue2.mjs.map +1 -1
  31. package/es/packages/components/touchchat/component/AiRobot/start.vue.mjs +3 -2
  32. package/es/packages/components/touchchat/component/AiRobot/start.vue.mjs.map +1 -1
  33. package/es/packages/components/touchchat/component/AiRobot/start.vue2.mjs +18 -11
  34. package/es/packages/components/touchchat/component/AiRobot/start.vue2.mjs.map +1 -1
  35. package/es/packages/components/touchchat/component/CardView.vue.mjs +3 -2
  36. package/es/packages/components/touchchat/component/CardView.vue.mjs.map +1 -1
  37. package/es/packages/components/touchchat/component/CardView.vue2.mjs +66 -42
  38. package/es/packages/components/touchchat/component/CardView.vue2.mjs.map +1 -1
  39. package/es/packages/components/touchchat/component/FileContent.vue.mjs +7 -0
  40. package/es/packages/components/touchchat/component/FileContent.vue.mjs.map +1 -0
  41. package/es/packages/components/touchchat/component/FileContent.vue2.mjs +206 -0
  42. package/es/packages/components/touchchat/component/FileContent.vue2.mjs.map +1 -0
  43. package/es/packages/components/touchchat/component/FileView.vue.mjs +3 -2
  44. package/es/packages/components/touchchat/component/FileView.vue.mjs.map +1 -1
  45. package/es/packages/components/touchchat/component/FileView.vue2.mjs +17 -4
  46. package/es/packages/components/touchchat/component/FileView.vue2.mjs.map +1 -1
  47. package/es/packages/components/touchchat/component/HelloChat.vue.mjs +3 -2
  48. package/es/packages/components/touchchat/component/HelloChat.vue.mjs.map +1 -1
  49. package/es/packages/components/touchchat/component/HelloChat.vue2.mjs +26 -14
  50. package/es/packages/components/touchchat/component/HelloChat.vue2.mjs.map +1 -1
  51. package/es/packages/components/touchchat/component/ImageFile.vue.mjs +7 -0
  52. package/es/packages/components/touchchat/component/ImageFile.vue.mjs.map +1 -0
  53. package/es/packages/components/touchchat/component/ImageFile.vue2.mjs +162 -0
  54. package/es/packages/components/touchchat/component/ImageFile.vue2.mjs.map +1 -0
  55. package/es/packages/components/touchchat/component/ImageView.vue.mjs +3 -2
  56. package/es/packages/components/touchchat/component/ImageView.vue.mjs.map +1 -1
  57. package/es/packages/components/touchchat/component/ImageView.vue2.mjs +1 -1
  58. package/es/packages/components/touchchat/component/ImageView.vue2.mjs.map +1 -1
  59. package/es/packages/components/touchchat/component/LinkView.vue.mjs +3 -2
  60. package/es/packages/components/touchchat/component/LinkView.vue.mjs.map +1 -1
  61. package/es/packages/components/touchchat/component/LinkView.vue2.mjs +19 -5
  62. package/es/packages/components/touchchat/component/LinkView.vue2.mjs.map +1 -1
  63. package/es/packages/components/touchchat/component/MarkLayer.vue.mjs +7 -0
  64. package/es/packages/components/touchchat/component/MarkLayer.vue.mjs.map +1 -0
  65. package/es/packages/components/touchchat/component/MarkLayer.vue2.mjs +56 -0
  66. package/es/packages/components/touchchat/component/MarkLayer.vue2.mjs.map +1 -0
  67. package/es/packages/components/touchchat/component/ModuleSelect.vue.mjs +7 -0
  68. package/es/packages/components/touchchat/component/ModuleSelect.vue.mjs.map +1 -0
  69. package/es/packages/components/touchchat/component/ModuleSelect.vue2.mjs +121 -0
  70. package/es/packages/components/touchchat/component/ModuleSelect.vue2.mjs.map +1 -0
  71. package/es/packages/components/touchchat/component/PDFFile.vue.mjs +7 -0
  72. package/es/packages/components/touchchat/component/PDFFile.vue.mjs.map +1 -0
  73. package/es/packages/components/touchchat/component/PDFFile.vue2.mjs +211 -0
  74. package/es/packages/components/touchchat/component/PDFFile.vue2.mjs.map +1 -0
  75. package/es/packages/components/touchchat/component/QuoteContent.vue.mjs +7 -0
  76. package/es/packages/components/touchchat/component/QuoteContent.vue.mjs.map +1 -0
  77. package/es/packages/components/touchchat/component/QuoteContent.vue2.mjs +40 -0
  78. package/es/packages/components/touchchat/component/QuoteContent.vue2.mjs.map +1 -0
  79. package/es/packages/components/touchchat/component/RealtimeVoice.vue.mjs +7 -0
  80. package/es/packages/components/touchchat/component/RealtimeVoice.vue.mjs.map +1 -0
  81. package/es/packages/components/touchchat/component/RealtimeVoice.vue2.mjs +160 -0
  82. package/es/packages/components/touchchat/component/RealtimeVoice.vue2.mjs.map +1 -0
  83. package/es/packages/components/touchchat/component/Screenshot.vue.mjs +7 -0
  84. package/es/packages/components/touchchat/component/Screenshot.vue.mjs.map +1 -0
  85. package/es/packages/components/touchchat/component/Screenshot.vue2.mjs +208 -0
  86. package/es/packages/components/touchchat/component/Screenshot.vue2.mjs.map +1 -0
  87. package/es/packages/components/touchchat/component/ThoughtChain.vue.mjs +7 -0
  88. package/es/packages/components/touchchat/component/ThoughtChain.vue.mjs.map +1 -0
  89. package/es/packages/components/touchchat/component/ThoughtChain.vue2.mjs +69 -0
  90. package/es/packages/components/touchchat/component/ThoughtChain.vue2.mjs.map +1 -0
  91. package/es/packages/components/touchchat/component/UploadView.vue.mjs +7 -0
  92. package/es/packages/components/touchchat/component/UploadView.vue.mjs.map +1 -0
  93. package/es/packages/components/touchchat/component/UploadView.vue2.mjs +186 -0
  94. package/es/packages/components/touchchat/component/UploadView.vue2.mjs.map +1 -0
  95. package/es/packages/components/touchchat/component/UploadView_api.vue.mjs +7 -0
  96. package/es/packages/components/touchchat/component/UploadView_api.vue.mjs.map +1 -0
  97. package/es/packages/components/touchchat/component/UploadView_api.vue2.mjs +166 -0
  98. package/es/packages/components/touchchat/component/UploadView_api.vue2.mjs.map +1 -0
  99. package/es/packages/components/touchchat/component/VideoFile.vue.mjs +7 -0
  100. package/es/packages/components/touchchat/component/VideoFile.vue.mjs.map +1 -0
  101. package/es/packages/components/touchchat/component/VideoFile.vue2.mjs +33 -0
  102. package/es/packages/components/touchchat/component/VideoFile.vue2.mjs.map +1 -0
  103. package/es/packages/components/touchchat/component/VoiceView.vue.mjs +7 -0
  104. package/es/packages/components/touchchat/component/VoiceView.vue.mjs.map +1 -0
  105. package/es/packages/components/touchchat/component/VoiceView.vue2.mjs +165 -0
  106. package/es/packages/components/touchchat/component/VoiceView.vue2.mjs.map +1 -0
  107. package/es/packages/components/touchchat/img/file/doc.png.mjs +4 -0
  108. package/es/packages/components/touchchat/img/file/doc.png.mjs.map +1 -0
  109. package/es/packages/components/touchchat/img/file/docx.png.mjs +4 -0
  110. package/es/packages/components/touchchat/img/file/docx.png.mjs.map +1 -0
  111. package/es/packages/components/touchchat/img/file/gif.png.mjs +4 -0
  112. package/es/packages/components/touchchat/img/file/gif.png.mjs.map +1 -0
  113. package/es/packages/components/touchchat/img/file/html.png.mjs +4 -0
  114. package/es/packages/components/touchchat/img/file/html.png.mjs.map +1 -0
  115. package/es/packages/components/touchchat/img/file/jpg.png.mjs +4 -0
  116. package/es/packages/components/touchchat/img/file/jpg.png.mjs.map +1 -0
  117. package/es/packages/components/touchchat/img/file/mp3.png.mjs +4 -0
  118. package/es/packages/components/touchchat/img/file/mp3.png.mjs.map +1 -0
  119. package/es/packages/components/touchchat/img/file/mp4.png.mjs +4 -0
  120. package/es/packages/components/touchchat/img/file/mp4.png.mjs.map +1 -0
  121. package/es/packages/components/touchchat/img/file/music.png.mjs +4 -0
  122. package/es/packages/components/touchchat/img/file/music.png.mjs.map +1 -0
  123. package/es/packages/components/touchchat/img/file/pdf.png.mjs +4 -0
  124. package/es/packages/components/touchchat/img/file/pdf.png.mjs.map +1 -0
  125. package/es/packages/components/touchchat/img/file/png.png.mjs +4 -0
  126. package/es/packages/components/touchchat/img/file/png.png.mjs.map +1 -0
  127. package/es/packages/components/touchchat/img/file/ppt.png.mjs +4 -0
  128. package/es/packages/components/touchchat/img/file/ppt.png.mjs.map +1 -0
  129. package/es/packages/components/touchchat/img/file/pptx.png.mjs +4 -0
  130. package/es/packages/components/touchchat/img/file/pptx.png.mjs.map +1 -0
  131. package/es/packages/components/touchchat/img/file/txt.png.mjs +4 -0
  132. package/es/packages/components/touchchat/img/file/txt.png.mjs.map +1 -0
  133. package/es/packages/components/touchchat/img/file/xls.png.mjs +4 -0
  134. package/es/packages/components/touchchat/img/file/xls.png.mjs.map +1 -0
  135. package/es/packages/components/touchchat/img/file/xlsx.png.mjs +4 -0
  136. package/es/packages/components/touchchat/img/file/xlsx.png.mjs.map +1 -0
  137. package/es/packages/components/touchchat/img/svg/reset.svg.mjs +4 -0
  138. package/es/packages/components/touchchat/img/svg/reset.svg.mjs.map +1 -0
  139. package/es/packages/components/touchchat/index.mjs +5 -5
  140. package/es/packages/components/touchchat/index.mjs.map +1 -1
  141. package/es/packages/components/touchchat/src/AiChat/AgentsView.vue.mjs +7 -0
  142. package/es/packages/components/touchchat/src/AiChat/AgentsView.vue.mjs.map +1 -0
  143. package/es/packages/components/touchchat/src/AiChat/AgentsView.vue2.mjs +59 -0
  144. package/es/packages/components/touchchat/src/AiChat/AgentsView.vue2.mjs.map +1 -0
  145. package/es/packages/components/touchchat/src/AiChat/AiMessage.vue.mjs +3 -2
  146. package/es/packages/components/touchchat/src/AiChat/AiMessage.vue.mjs.map +1 -1
  147. package/es/packages/components/touchchat/src/AiChat/AiMessage.vue2.mjs +322 -139
  148. package/es/packages/components/touchchat/src/AiChat/AiMessage.vue2.mjs.map +1 -1
  149. package/es/packages/components/touchchat/src/AiChat/Chat/TouchChat.mjs +18 -0
  150. package/es/packages/components/touchchat/src/AiChat/Chat/TouchChat.mjs.map +1 -0
  151. package/es/packages/components/touchchat/src/AiChat/Chat/scriptMatcher.mjs +145 -0
  152. package/es/packages/components/touchchat/src/AiChat/Chat/scriptMatcher.mjs.map +1 -0
  153. package/es/packages/components/touchchat/src/AiChat/Chat/types.mjs +19 -0
  154. package/es/packages/components/touchchat/src/AiChat/Chat/types.mjs.map +1 -0
  155. package/es/packages/components/touchchat/src/AiChat/Chat/useChat.mjs +693 -0
  156. package/es/packages/components/touchchat/src/AiChat/Chat/useChat.mjs.map +1 -0
  157. package/es/packages/components/touchchat/src/AiChat/Chat/useCopy.mjs +55 -0
  158. package/es/packages/components/touchchat/src/AiChat/Chat/useCopy.mjs.map +1 -0
  159. package/es/packages/components/touchchat/src/AiChat/Chat/useMessageRender.mjs +155 -0
  160. package/es/packages/components/touchchat/src/AiChat/Chat/useMessageRender.mjs.map +1 -0
  161. package/es/packages/components/touchchat/src/AiChat/Chat/useSSE.mjs +345 -0
  162. package/es/packages/components/touchchat/src/AiChat/Chat/useSSE.mjs.map +1 -0
  163. package/es/packages/components/touchchat/src/AiChat/Chat/useScroll.mjs +74 -0
  164. package/es/packages/components/touchchat/src/AiChat/Chat/useScroll.mjs.map +1 -0
  165. package/es/packages/components/touchchat/src/AiChat/ChatInput.vue.mjs +3 -2
  166. package/es/packages/components/touchchat/src/AiChat/ChatInput.vue.mjs.map +1 -1
  167. package/es/packages/components/touchchat/src/AiChat/ChatInput.vue2.mjs +472 -44
  168. package/es/packages/components/touchchat/src/AiChat/ChatInput.vue2.mjs.map +1 -1
  169. package/es/packages/components/touchchat/src/AiChat/HistoryList.vue.mjs +3 -2
  170. package/es/packages/components/touchchat/src/AiChat/HistoryList.vue.mjs.map +1 -1
  171. package/es/packages/components/touchchat/src/AiChat/HistoryList.vue2.mjs +180 -98
  172. package/es/packages/components/touchchat/src/AiChat/HistoryList.vue2.mjs.map +1 -1
  173. package/es/packages/components/touchchat/src/AiChat/HistorySidebar.vue.mjs +3 -2
  174. package/es/packages/components/touchchat/src/AiChat/HistorySidebar.vue.mjs.map +1 -1
  175. package/es/packages/components/touchchat/src/AiChat/HistorySidebar.vue2.mjs +29 -12
  176. package/es/packages/components/touchchat/src/AiChat/HistorySidebar.vue2.mjs.map +1 -1
  177. package/es/packages/components/touchchat/src/AiChat/MessageActions.vue.mjs +3 -2
  178. package/es/packages/components/touchchat/src/AiChat/MessageActions.vue.mjs.map +1 -1
  179. package/es/packages/components/touchchat/src/AiChat/MessageActions.vue2.mjs +175 -62
  180. package/es/packages/components/touchchat/src/AiChat/MessageActions.vue2.mjs.map +1 -1
  181. package/es/packages/components/touchchat/src/AiChat/SiderBarView.vue.mjs +3 -2
  182. package/es/packages/components/touchchat/src/AiChat/SiderBarView.vue.mjs.map +1 -1
  183. package/es/packages/components/touchchat/src/AiChat/SiderBarView.vue2.mjs +14 -8
  184. package/es/packages/components/touchchat/src/AiChat/SiderBarView.vue2.mjs.map +1 -1
  185. package/es/packages/components/touchchat/src/AiChat/TouchAgent.vue.mjs +7 -0
  186. package/es/packages/components/touchchat/src/AiChat/TouchAgent.vue.mjs.map +1 -0
  187. package/es/packages/components/touchchat/src/AiChat/TouchAgent.vue2.mjs +1034 -0
  188. package/es/packages/components/touchchat/src/AiChat/TouchAgent.vue2.mjs.map +1 -0
  189. package/es/packages/components/touchchat/src/AiChat/TouchChat.vue.mjs +3 -2
  190. package/es/packages/components/touchchat/src/AiChat/TouchChat.vue.mjs.map +1 -1
  191. package/es/packages/components/touchchat/src/AiChat/TouchChat.vue2.mjs +276 -1004
  192. package/es/packages/components/touchchat/src/AiChat/TouchChat.vue2.mjs.map +1 -1
  193. package/es/packages/components/touchchat/src/AiChat/TouchHistory.vue.mjs +3 -2
  194. package/es/packages/components/touchchat/src/AiChat/TouchHistory.vue.mjs.map +1 -1
  195. package/es/packages/components/touchchat/src/AiChat/TouchHistory.vue2.mjs +346 -122
  196. package/es/packages/components/touchchat/src/AiChat/TouchHistory.vue2.mjs.map +1 -1
  197. package/es/packages/components/touchchat/src/AiChat/UserMessage.vue.mjs +3 -2
  198. package/es/packages/components/touchchat/src/AiChat/UserMessage.vue.mjs.map +1 -1
  199. package/es/packages/components/touchchat/src/AiChat/UserMessage.vue2.mjs +143 -64
  200. package/es/packages/components/touchchat/src/AiChat/UserMessage.vue2.mjs.map +1 -1
  201. package/es/packages/components/touchchat/src/index.vue.mjs +3 -2
  202. package/es/packages/components/touchchat/src/index.vue.mjs.map +1 -1
  203. package/es/packages/components/touchchat/src/index.vue2.mjs +252 -143
  204. package/es/packages/components/touchchat/src/index.vue2.mjs.map +1 -1
  205. package/es/packages/components/touchchat/src/types/a2a.mjs +11 -0
  206. package/es/packages/components/touchchat/src/types/a2a.mjs.map +1 -0
  207. package/es/packages/components/touchchat/utils/a2aService.mjs +316 -0
  208. package/es/packages/components/touchchat/utils/a2aService.mjs.map +1 -0
  209. package/es/packages/components/touchchat/utils/fetchStream.mjs +8 -2
  210. package/es/packages/components/touchchat/utils/fetchStream.mjs.map +1 -1
  211. package/es/packages/components/touchchat/utils/markdown.mjs +31 -13
  212. package/es/packages/components/touchchat/utils/markdown.mjs.map +1 -1
  213. package/es/packages/utils/config.mjs.map +1 -1
  214. package/es/packages/utils/types.mjs.map +1 -1
  215. package/global.d.ts +2 -2
  216. package/lib/_virtual/_plugin-vue_export-helper.js +14 -0
  217. package/lib/_virtual/_plugin-vue_export-helper.js.map +1 -0
  218. package/lib/index.js.map +1 -1
  219. package/lib/node_modules/.pnpm/@touchvue_a2ui@1.0.0-beta.46/node_modules/@touchvue/a2ui/dist/index.js +4819 -0
  220. package/lib/node_modules/.pnpm/@touchvue_a2ui@1.0.0-beta.46/node_modules/@touchvue/a2ui/dist/index.js.map +1 -0
  221. package/lib/node_modules/.pnpm/dompurify@3.3.0/node_modules/dompurify/dist/purify.es.js +1384 -0
  222. package/lib/node_modules/.pnpm/dompurify@3.3.0/node_modules/dompurify/dist/purify.es.js.map +1 -0
  223. package/lib/node_modules/.pnpm/html2canvas@1.4.1/node_modules/html2canvas/dist/html2canvas.esm.js +7828 -0
  224. package/lib/node_modules/.pnpm/html2canvas@1.4.1/node_modules/html2canvas/dist/html2canvas.esm.js.map +1 -0
  225. package/lib/package.json.css +1 -1
  226. package/lib/package.json.js +2 -2
  227. package/lib/packages/components/index.js +2 -2
  228. package/lib/packages/components/resolver.js.map +1 -1
  229. package/lib/packages/components/touchchat/component/AiRobot/HelloChat.vue.js +3 -2
  230. package/lib/packages/components/touchchat/component/AiRobot/HelloChat.vue.js.map +1 -1
  231. package/lib/packages/components/touchchat/component/AiRobot/HelloChat.vue2.js +219 -159
  232. package/lib/packages/components/touchchat/component/AiRobot/HelloChat.vue2.js.map +1 -1
  233. package/lib/packages/components/touchchat/component/AiRobot/face.vue.js +3 -2
  234. package/lib/packages/components/touchchat/component/AiRobot/face.vue.js.map +1 -1
  235. package/lib/packages/components/touchchat/component/AiRobot/face.vue2.js +26 -12
  236. package/lib/packages/components/touchchat/component/AiRobot/face.vue2.js.map +1 -1
  237. package/lib/packages/components/touchchat/component/AiRobot/letter.vue.js +3 -2
  238. package/lib/packages/components/touchchat/component/AiRobot/letter.vue.js.map +1 -1
  239. package/lib/packages/components/touchchat/component/AiRobot/letter.vue2.js +181 -40
  240. package/lib/packages/components/touchchat/component/AiRobot/letter.vue2.js.map +1 -1
  241. package/lib/packages/components/touchchat/component/AiRobot/meterialPrepare.vue.js +3 -2
  242. package/lib/packages/components/touchchat/component/AiRobot/meterialPrepare.vue.js.map +1 -1
  243. package/lib/packages/components/touchchat/component/AiRobot/meterialPrepare.vue2.js +15 -10
  244. package/lib/packages/components/touchchat/component/AiRobot/meterialPrepare.vue2.js.map +1 -1
  245. package/lib/packages/components/touchchat/component/AiRobot/start.vue.js +3 -2
  246. package/lib/packages/components/touchchat/component/AiRobot/start.vue.js.map +1 -1
  247. package/lib/packages/components/touchchat/component/AiRobot/start.vue2.js +17 -10
  248. package/lib/packages/components/touchchat/component/AiRobot/start.vue2.js.map +1 -1
  249. package/lib/packages/components/touchchat/component/CardView.vue.js +3 -2
  250. package/lib/packages/components/touchchat/component/CardView.vue.js.map +1 -1
  251. package/lib/packages/components/touchchat/component/CardView.vue2.js +66 -42
  252. package/lib/packages/components/touchchat/component/CardView.vue2.js.map +1 -1
  253. package/lib/packages/components/touchchat/component/FileContent.vue.js +11 -0
  254. package/lib/packages/components/touchchat/component/FileContent.vue.js.map +1 -0
  255. package/lib/packages/components/touchchat/component/FileContent.vue2.js +210 -0
  256. package/lib/packages/components/touchchat/component/FileContent.vue2.js.map +1 -0
  257. package/lib/packages/components/touchchat/component/FileView.vue.js +3 -2
  258. package/lib/packages/components/touchchat/component/FileView.vue.js.map +1 -1
  259. package/lib/packages/components/touchchat/component/FileView.vue2.js +16 -3
  260. package/lib/packages/components/touchchat/component/FileView.vue2.js.map +1 -1
  261. package/lib/packages/components/touchchat/component/HelloChat.vue.js +3 -2
  262. package/lib/packages/components/touchchat/component/HelloChat.vue.js.map +1 -1
  263. package/lib/packages/components/touchchat/component/HelloChat.vue2.js +26 -14
  264. package/lib/packages/components/touchchat/component/HelloChat.vue2.js.map +1 -1
  265. package/lib/packages/components/touchchat/component/ImageFile.vue.js +11 -0
  266. package/lib/packages/components/touchchat/component/ImageFile.vue.js.map +1 -0
  267. package/lib/packages/components/touchchat/component/ImageFile.vue2.js +166 -0
  268. package/lib/packages/components/touchchat/component/ImageFile.vue2.js.map +1 -0
  269. package/lib/packages/components/touchchat/component/ImageView.vue.js +3 -2
  270. package/lib/packages/components/touchchat/component/ImageView.vue.js.map +1 -1
  271. package/lib/packages/components/touchchat/component/ImageView.vue2.js +1 -1
  272. package/lib/packages/components/touchchat/component/ImageView.vue2.js.map +1 -1
  273. package/lib/packages/components/touchchat/component/LinkView.vue.js +3 -2
  274. package/lib/packages/components/touchchat/component/LinkView.vue.js.map +1 -1
  275. package/lib/packages/components/touchchat/component/LinkView.vue2.js +18 -4
  276. package/lib/packages/components/touchchat/component/LinkView.vue2.js.map +1 -1
  277. package/lib/packages/components/touchchat/component/MarkLayer.vue.js +11 -0
  278. package/lib/packages/components/touchchat/component/MarkLayer.vue.js.map +1 -0
  279. package/lib/packages/components/touchchat/component/MarkLayer.vue2.js +60 -0
  280. package/lib/packages/components/touchchat/component/MarkLayer.vue2.js.map +1 -0
  281. package/lib/packages/components/touchchat/component/ModuleSelect.vue.js +11 -0
  282. package/lib/packages/components/touchchat/component/ModuleSelect.vue.js.map +1 -0
  283. package/lib/packages/components/touchchat/component/ModuleSelect.vue2.js +125 -0
  284. package/lib/packages/components/touchchat/component/ModuleSelect.vue2.js.map +1 -0
  285. package/lib/packages/components/touchchat/component/PDFFile.vue.js +11 -0
  286. package/lib/packages/components/touchchat/component/PDFFile.vue.js.map +1 -0
  287. package/lib/packages/components/touchchat/component/PDFFile.vue2.js +215 -0
  288. package/lib/packages/components/touchchat/component/PDFFile.vue2.js.map +1 -0
  289. package/lib/packages/components/touchchat/component/QuoteContent.vue.js +11 -0
  290. package/lib/packages/components/touchchat/component/QuoteContent.vue.js.map +1 -0
  291. package/lib/packages/components/touchchat/component/QuoteContent.vue2.js +44 -0
  292. package/lib/packages/components/touchchat/component/QuoteContent.vue2.js.map +1 -0
  293. package/lib/packages/components/touchchat/component/RealtimeVoice.vue.js +11 -0
  294. package/lib/packages/components/touchchat/component/RealtimeVoice.vue.js.map +1 -0
  295. package/lib/packages/components/touchchat/component/RealtimeVoice.vue2.js +164 -0
  296. package/lib/packages/components/touchchat/component/RealtimeVoice.vue2.js.map +1 -0
  297. package/lib/packages/components/touchchat/component/Screenshot.vue.js +11 -0
  298. package/lib/packages/components/touchchat/component/Screenshot.vue.js.map +1 -0
  299. package/lib/packages/components/touchchat/component/Screenshot.vue2.js +212 -0
  300. package/lib/packages/components/touchchat/component/Screenshot.vue2.js.map +1 -0
  301. package/lib/packages/components/touchchat/component/ThoughtChain.vue.js +11 -0
  302. package/lib/packages/components/touchchat/component/ThoughtChain.vue.js.map +1 -0
  303. package/lib/packages/components/touchchat/component/ThoughtChain.vue2.js +73 -0
  304. package/lib/packages/components/touchchat/component/ThoughtChain.vue2.js.map +1 -0
  305. package/lib/packages/components/touchchat/component/UploadView.vue.js +11 -0
  306. package/lib/packages/components/touchchat/component/UploadView.vue.js.map +1 -0
  307. package/lib/packages/components/touchchat/component/UploadView.vue2.js +190 -0
  308. package/lib/packages/components/touchchat/component/UploadView.vue2.js.map +1 -0
  309. package/lib/packages/components/touchchat/component/UploadView_api.vue.js +11 -0
  310. package/lib/packages/components/touchchat/component/UploadView_api.vue.js.map +1 -0
  311. package/lib/packages/components/touchchat/component/UploadView_api.vue2.js +170 -0
  312. package/lib/packages/components/touchchat/component/UploadView_api.vue2.js.map +1 -0
  313. package/lib/packages/components/touchchat/component/VideoFile.vue.js +11 -0
  314. package/lib/packages/components/touchchat/component/VideoFile.vue.js.map +1 -0
  315. package/lib/packages/components/touchchat/component/VideoFile.vue2.js +37 -0
  316. package/lib/packages/components/touchchat/component/VideoFile.vue2.js.map +1 -0
  317. package/lib/packages/components/touchchat/component/VoiceView.vue.js +11 -0
  318. package/lib/packages/components/touchchat/component/VoiceView.vue.js.map +1 -0
  319. package/lib/packages/components/touchchat/component/VoiceView.vue2.js +169 -0
  320. package/lib/packages/components/touchchat/component/VoiceView.vue2.js.map +1 -0
  321. package/lib/packages/components/touchchat/img/file/doc.png.js +8 -0
  322. package/lib/packages/components/touchchat/img/file/doc.png.js.map +1 -0
  323. package/lib/packages/components/touchchat/img/file/docx.png.js +8 -0
  324. package/lib/packages/components/touchchat/img/file/docx.png.js.map +1 -0
  325. package/lib/packages/components/touchchat/img/file/gif.png.js +8 -0
  326. package/lib/packages/components/touchchat/img/file/gif.png.js.map +1 -0
  327. package/lib/packages/components/touchchat/img/file/html.png.js +8 -0
  328. package/lib/packages/components/touchchat/img/file/html.png.js.map +1 -0
  329. package/lib/packages/components/touchchat/img/file/jpg.png.js +8 -0
  330. package/lib/packages/components/touchchat/img/file/jpg.png.js.map +1 -0
  331. package/lib/packages/components/touchchat/img/file/mp3.png.js +8 -0
  332. package/lib/packages/components/touchchat/img/file/mp3.png.js.map +1 -0
  333. package/lib/packages/components/touchchat/img/file/mp4.png.js +8 -0
  334. package/lib/packages/components/touchchat/img/file/mp4.png.js.map +1 -0
  335. package/lib/packages/components/touchchat/img/file/music.png.js +8 -0
  336. package/lib/packages/components/touchchat/img/file/music.png.js.map +1 -0
  337. package/lib/packages/components/touchchat/img/file/pdf.png.js +8 -0
  338. package/lib/packages/components/touchchat/img/file/pdf.png.js.map +1 -0
  339. package/lib/packages/components/touchchat/img/file/png.png.js +8 -0
  340. package/lib/packages/components/touchchat/img/file/png.png.js.map +1 -0
  341. package/lib/packages/components/touchchat/img/file/ppt.png.js +8 -0
  342. package/lib/packages/components/touchchat/img/file/ppt.png.js.map +1 -0
  343. package/lib/packages/components/touchchat/img/file/pptx.png.js +8 -0
  344. package/lib/packages/components/touchchat/img/file/pptx.png.js.map +1 -0
  345. package/lib/packages/components/touchchat/img/file/txt.png.js +8 -0
  346. package/lib/packages/components/touchchat/img/file/txt.png.js.map +1 -0
  347. package/lib/packages/components/touchchat/img/file/xls.png.js +8 -0
  348. package/lib/packages/components/touchchat/img/file/xls.png.js.map +1 -0
  349. package/lib/packages/components/touchchat/img/file/xlsx.png.js +8 -0
  350. package/lib/packages/components/touchchat/img/file/xlsx.png.js.map +1 -0
  351. package/lib/packages/components/touchchat/img/svg/reset.svg.js +8 -0
  352. package/lib/packages/components/touchchat/img/svg/reset.svg.js.map +1 -0
  353. package/lib/packages/components/touchchat/index.js +6 -6
  354. package/lib/packages/components/touchchat/index.js.map +1 -1
  355. package/lib/packages/components/touchchat/src/AiChat/AgentsView.vue.js +11 -0
  356. package/lib/packages/components/touchchat/src/AiChat/AgentsView.vue.js.map +1 -0
  357. package/lib/packages/components/touchchat/src/AiChat/AgentsView.vue2.js +63 -0
  358. package/lib/packages/components/touchchat/src/AiChat/AgentsView.vue2.js.map +1 -0
  359. package/lib/packages/components/touchchat/src/AiChat/AiMessage.vue.js +3 -2
  360. package/lib/packages/components/touchchat/src/AiChat/AiMessage.vue.js.map +1 -1
  361. package/lib/packages/components/touchchat/src/AiChat/AiMessage.vue2.js +321 -138
  362. package/lib/packages/components/touchchat/src/AiChat/AiMessage.vue2.js.map +1 -1
  363. package/lib/packages/components/touchchat/src/AiChat/Chat/TouchChat.js +21 -0
  364. package/lib/packages/components/touchchat/src/AiChat/Chat/TouchChat.js.map +1 -0
  365. package/lib/packages/components/touchchat/src/AiChat/Chat/scriptMatcher.js +147 -0
  366. package/lib/packages/components/touchchat/src/AiChat/Chat/scriptMatcher.js.map +1 -0
  367. package/lib/packages/components/touchchat/src/AiChat/Chat/types.js +22 -0
  368. package/lib/packages/components/touchchat/src/AiChat/Chat/types.js.map +1 -0
  369. package/lib/packages/components/touchchat/src/AiChat/Chat/useChat.js +695 -0
  370. package/lib/packages/components/touchchat/src/AiChat/Chat/useChat.js.map +1 -0
  371. package/lib/packages/components/touchchat/src/AiChat/Chat/useCopy.js +57 -0
  372. package/lib/packages/components/touchchat/src/AiChat/Chat/useCopy.js.map +1 -0
  373. package/lib/packages/components/touchchat/src/AiChat/Chat/useMessageRender.js +157 -0
  374. package/lib/packages/components/touchchat/src/AiChat/Chat/useMessageRender.js.map +1 -0
  375. package/lib/packages/components/touchchat/src/AiChat/Chat/useSSE.js +347 -0
  376. package/lib/packages/components/touchchat/src/AiChat/Chat/useSSE.js.map +1 -0
  377. package/lib/packages/components/touchchat/src/AiChat/Chat/useScroll.js +76 -0
  378. package/lib/packages/components/touchchat/src/AiChat/Chat/useScroll.js.map +1 -0
  379. package/lib/packages/components/touchchat/src/AiChat/ChatInput.vue.js +3 -2
  380. package/lib/packages/components/touchchat/src/AiChat/ChatInput.vue.js.map +1 -1
  381. package/lib/packages/components/touchchat/src/AiChat/ChatInput.vue2.js +471 -43
  382. package/lib/packages/components/touchchat/src/AiChat/ChatInput.vue2.js.map +1 -1
  383. package/lib/packages/components/touchchat/src/AiChat/HistoryList.vue.js +3 -2
  384. package/lib/packages/components/touchchat/src/AiChat/HistoryList.vue.js.map +1 -1
  385. package/lib/packages/components/touchchat/src/AiChat/HistoryList.vue2.js +179 -97
  386. package/lib/packages/components/touchchat/src/AiChat/HistoryList.vue2.js.map +1 -1
  387. package/lib/packages/components/touchchat/src/AiChat/HistorySidebar.vue.js +3 -2
  388. package/lib/packages/components/touchchat/src/AiChat/HistorySidebar.vue.js.map +1 -1
  389. package/lib/packages/components/touchchat/src/AiChat/HistorySidebar.vue2.js +28 -11
  390. package/lib/packages/components/touchchat/src/AiChat/HistorySidebar.vue2.js.map +1 -1
  391. package/lib/packages/components/touchchat/src/AiChat/MessageActions.vue.js +3 -2
  392. package/lib/packages/components/touchchat/src/AiChat/MessageActions.vue.js.map +1 -1
  393. package/lib/packages/components/touchchat/src/AiChat/MessageActions.vue2.js +174 -61
  394. package/lib/packages/components/touchchat/src/AiChat/MessageActions.vue2.js.map +1 -1
  395. package/lib/packages/components/touchchat/src/AiChat/SiderBarView.vue.js +3 -2
  396. package/lib/packages/components/touchchat/src/AiChat/SiderBarView.vue.js.map +1 -1
  397. package/lib/packages/components/touchchat/src/AiChat/SiderBarView.vue2.js +14 -8
  398. package/lib/packages/components/touchchat/src/AiChat/SiderBarView.vue2.js.map +1 -1
  399. package/lib/packages/components/touchchat/src/AiChat/TouchAgent.vue.js +11 -0
  400. package/lib/packages/components/touchchat/src/AiChat/TouchAgent.vue.js.map +1 -0
  401. package/lib/packages/components/touchchat/src/AiChat/TouchAgent.vue2.js +1038 -0
  402. package/lib/packages/components/touchchat/src/AiChat/TouchAgent.vue2.js.map +1 -0
  403. package/lib/packages/components/touchchat/src/AiChat/TouchChat.vue.js +3 -2
  404. package/lib/packages/components/touchchat/src/AiChat/TouchChat.vue.js.map +1 -1
  405. package/lib/packages/components/touchchat/src/AiChat/TouchChat.vue2.js +275 -1003
  406. package/lib/packages/components/touchchat/src/AiChat/TouchChat.vue2.js.map +1 -1
  407. package/lib/packages/components/touchchat/src/AiChat/TouchHistory.vue.js +3 -2
  408. package/lib/packages/components/touchchat/src/AiChat/TouchHistory.vue.js.map +1 -1
  409. package/lib/packages/components/touchchat/src/AiChat/TouchHistory.vue2.js +345 -121
  410. package/lib/packages/components/touchchat/src/AiChat/TouchHistory.vue2.js.map +1 -1
  411. package/lib/packages/components/touchchat/src/AiChat/UserMessage.vue.js +3 -2
  412. package/lib/packages/components/touchchat/src/AiChat/UserMessage.vue.js.map +1 -1
  413. package/lib/packages/components/touchchat/src/AiChat/UserMessage.vue2.js +142 -63
  414. package/lib/packages/components/touchchat/src/AiChat/UserMessage.vue2.js.map +1 -1
  415. package/lib/packages/components/touchchat/src/index.vue.js +3 -2
  416. package/lib/packages/components/touchchat/src/index.vue.js.map +1 -1
  417. package/lib/packages/components/touchchat/src/index.vue2.js +251 -142
  418. package/lib/packages/components/touchchat/src/index.vue2.js.map +1 -1
  419. package/lib/packages/components/touchchat/src/types/a2a.js +13 -0
  420. package/lib/packages/components/touchchat/src/types/a2a.js.map +1 -0
  421. package/lib/packages/components/touchchat/utils/a2aService.js +319 -0
  422. package/lib/packages/components/touchchat/utils/a2aService.js.map +1 -0
  423. package/lib/packages/components/touchchat/utils/fetchStream.js +8 -2
  424. package/lib/packages/components/touchchat/utils/fetchStream.js.map +1 -1
  425. package/lib/packages/components/touchchat/utils/markdown.js +31 -13
  426. package/lib/packages/components/touchchat/utils/markdown.js.map +1 -1
  427. package/lib/packages/utils/config.js.map +1 -1
  428. package/lib/packages/utils/types.js.map +1 -1
  429. package/package.json +83 -83
  430. package/theme/components/index.css +969 -43
  431. package/theme/font/iconfont.woff +0 -0
  432. package/theme/font/iconfont.woff2 +0 -0
  433. package/theme/index.css +969 -43
  434. package/theme/skin/default.css +969 -43
  435. package/types/global.d.ts +2 -2
  436. package/es/packages/components/touchchat/src/AiChat/Scene.vue.mjs +0 -6
  437. package/es/packages/components/touchchat/src/AiChat/Scene.vue.mjs.map +0 -1
  438. package/es/packages/components/touchchat/src/AiChat/Scene.vue2.mjs +0 -42
  439. package/es/packages/components/touchchat/src/AiChat/Scene.vue2.mjs.map +0 -1
  440. package/lib/packages/components/touchchat/src/AiChat/Scene.vue.js +0 -10
  441. package/lib/packages/components/touchchat/src/AiChat/Scene.vue.js.map +0 -1
  442. package/lib/packages/components/touchchat/src/AiChat/Scene.vue2.js +0 -46
  443. package/lib/packages/components/touchchat/src/AiChat/Scene.vue2.js.map +0 -1
@@ -1,611 +1,98 @@
1
- import { defineComponent, inject, computed, ref, watch, nextTick, onMounted, onBeforeUnmount, provide, openBlock, createElementBlock, createElementVNode, renderSlot, createVNode, createCommentVNode, Fragment, renderList, createBlock, withCtx } from 'vue';
2
- import _sfc_main$2 from './UserMessage.vue2.mjs';
3
- import _sfc_main$3 from './AiMessage.vue2.mjs';
4
- import _sfc_main$4 from './ChatInput.vue2.mjs';
5
- import _sfc_main$1 from '../../component/HelloChat.vue2.mjs';
6
- import { throttle } from '../../../../../node_modules/.pnpm/throttle-debounce@5.0.2/node_modules/throttle-debounce/esm/index.mjs';
7
- import { FetchStream } from '../../utils/fetchStream.mjs';
8
- import { ChatRobot } from '../../utils/chatRobot.mjs';
9
- import markdown from '../../utils/markdown.mjs';
10
- import { showToast } from '../../utils/tools.mjs';
1
+ import { defineComponent, inject, ref, computed, provide, onMounted, watch, onBeforeUnmount, openBlock, createElementBlock, withModifiers, unref, createElementVNode, renderSlot, createVNode, createCommentVNode, Fragment, renderList, withDirectives, vModelCheckbox, normalizeClass, createBlock, withCtx, isRef, nextTick } from 'vue';
2
+ import UserMessage from './UserMessage.vue.mjs';
3
+ import AiMessage from './AiMessage.vue.mjs';
4
+ import ChatInput from './ChatInput.vue.mjs';
5
+ import HelloChat from '../../component/HelloChat.vue.mjs';
6
+ import { MessageAction } from './Chat/types.mjs';
7
+ import { useChat } from './Chat/useChat.mjs';
8
+ import { useCopy } from './Chat/useCopy.mjs';
11
9
 
12
10
  var _sfc_main = /* @__PURE__ */ defineComponent({
13
11
  __name: "TouchChat",
14
12
  props: {
15
- model: {
16
- type: String,
17
- default: "deepseek-v3"
18
- },
19
13
  value: {
20
14
  type: Array,
21
15
  default: () => []
22
- },
23
- placeholder: {
24
- type: String,
25
- default: "\u5FEB\u6765\u548C\u6211\u804A\u5929\u5427~"
26
- },
27
- components: {
28
- type: Object,
29
- default: () => ({})
30
- },
31
- openSSECallback: {
32
- type: Function,
33
- default: null
34
16
  }
35
17
  },
36
- emits: ["sendMessage", "toggleSidebar", "beforeSendMessage"],
18
+ emits: ["sendMessage", "toggleSidebar", "beforeSendMessage", "openSideBar"],
37
19
  setup(__props, { expose: __expose, emit: __emit }) {
38
20
  const emit = __emit;
39
- const action = inject("action", "");
40
- const headers = inject("headers", void 0);
41
- const body = inject("body", void 0);
42
- const token = inject("token", "");
43
- const wsUrl = inject("wsUrl", "");
44
- const connectionType = inject("connectionType");
45
- const isDeepSeek = inject(
46
- "isDeepSeek",
47
- computed(() => true)
48
- );
49
- const aiChatType = inject("aiChatType", "Flow");
50
- const scripts = inject("scripts", []);
51
- const robotUnmatched = inject("robotUnmatched", "\u60A8\u7684\u6D88\u606F\u672A\u5339\u914D\u5230\u4EFB\u4F55\u5185\u5BB9");
52
- const currentScriptIndex = ref(0);
53
- const selectedScriptName = ref("");
54
- const afterSendMessage = inject("afterSendMessage", () => {
55
- console.warn("\u672A\u63D0\u4F9BafterSendMessage\u51FD\u6570");
21
+ const scripts = inject("scripts", ref([]));
22
+ const unmatchText = inject("unmatchText", "\u60A8\u7684\u6D88\u606F\u672A\u5339\u914D\u5230\u4EFB\u4F55\u5185\u5BB9");
23
+ const modules = inject("modules", ref([]));
24
+ const afterSend = inject("afterSend", () => {
25
+ console.warn("\u672A\u63D0\u4F9BafterSend\u51FD\u6570");
56
26
  });
57
- const sendMessageInject = inject("handleSend", () => {
27
+ const sendMessageInject = inject("send", () => {
58
28
  console.warn("\u672A\u63D0\u4F9BhandleSend\u51FD\u6570");
59
29
  });
60
30
  const beforeSend = inject("beforeSend", () => ({
61
- result: true
31
+ result: true,
32
+ componentName: ""
62
33
  }));
34
+ const bottom = inject("bottom", () => {
35
+ console.warn("\u672A\u63D0\u4F9Bbottom\u51FD\u6570");
36
+ });
37
+ const stop = inject("stop", () => {
38
+ console.warn("\u672A\u63D0\u4F9Bstop\u51FD\u6570");
39
+ });
40
+ const isSelectMode = inject(
41
+ "isSelectMode",
42
+ computed(() => false)
43
+ );
44
+ const scriptsLength = computed(() => {
45
+ var _a;
46
+ return ((_a = scripts.value) == null ? void 0 : _a.length) || 0;
47
+ });
63
48
  const props = __props;
64
49
  const chatContainer = ref(null);
65
- const htmlContentRef = ref([]);
66
- const thinkingContentRef = ref([]);
67
- const reasoningContentRef = ref([]);
68
- const isMounted = ref(false);
69
- const isChating = ref(false);
70
- const inputValue = ref("");
71
- const enableDeepThinking = ref(false);
72
- const chatList = ref([]);
73
- const renderQueue = ref([]);
74
- const isRendering = ref(false);
75
- const currIndex = ref(0);
76
- const fetchStream = ref(null);
77
- const TouchChatRobot = ref();
78
- const isUnmounting = ref(false);
79
- const currentComponentName = ref("");
80
- const messageUtils = {
81
- updateMessage: (index, updates) => {
82
- if (index < 0 || index >= chatList.value.length)
83
- return;
84
- chatList.value.splice(index, 1, { ...chatList.value[index], ...updates });
85
- nextTick(() => {
86
- const message = chatList.value[index];
87
- if (message) {
88
- renderContent(message.content, "main", index);
89
- if (message.thinkContent) {
90
- renderContent(message.thinkContent, "thinking", index);
91
- }
92
- if (message.reasoningContent) {
93
- renderContent(message.reasoningContent, "reasoning", index);
94
- }
95
- }
96
- });
97
- },
98
- deleteMessageChain: (index) => {
99
- if (index < 0 || index >= chatList.value.length)
100
- return;
101
- const nextIndex = index + 1;
102
- const deleteCount = nextIndex < chatList.value.length && chatList.value[nextIndex].user === "ai" ? 2 : 1;
103
- chatList.value.splice(index, deleteCount);
104
- },
105
- createStandardMessage: (data) => {
106
- var _a, _b, _c, _d, _e;
107
- return {
108
- chatId: data.chatId || "ai_" + crypto.randomUUID().replace(/-/gi, ""),
109
- user: data.user || "ai",
110
- type: data.type || "text",
111
- content: data.content || "",
112
- isChating: (_a = data.isChating) != null ? _a : false,
113
- thinkContent: data.thinkContent || "",
114
- reasoningContent: data.reasoningContent || "",
115
- isLiked: (_b = data.isLiked) != null ? _b : false,
116
- isDisliked: (_c = data.isDisliked) != null ? _c : false,
117
- isEditing: (_d = data.isEditing) != null ? _d : false,
118
- editContent: (_e = data.editContent) != null ? _e : ""
119
- };
120
- }
121
- };
122
- const sceneClick = (script) => {
123
- selectedScriptName.value = script.name;
124
- const findAndSendFirstUserMessage = (dataSource) => {
125
- var _a;
126
- const targetScript = dataSource.find((item) => item.name === script.name);
127
- if (targetScript && targetScript.content.length) {
128
- const firstUserMessage = (_a = targetScript.content.find((citem) => citem.user === "i")) == null ? void 0 : _a.data;
129
- if (firstUserMessage) {
130
- sendMessage({
131
- name: firstUserMessage
132
- });
133
- }
134
- }
135
- };
136
- if (scripts.length) {
137
- findAndSendFirstUserMessage(scripts);
138
- }
139
- };
140
- console.log("sceneClick", sceneClick);
141
- const completeRendered = () => {
142
- console.log("completeRendered", "\u6E32\u67D3\u5B8C\u6210");
143
- };
144
- const toggleSidebarClick = (item, index) => {
145
- emit("toggleSidebar", item, index);
146
- };
147
- const init = () => {
148
- try {
149
- if (Array.isArray(props.value) && props.value.length && isDeepSeek.value) {
150
- chatList.value = props.value.map((item) => ({
151
- ...item,
152
- content: item.thinkContent ? item.content || "" : item.content || "",
153
- thinkContent: item.thinkContent || ""
154
- }));
155
- nextTick(() => {
156
- requestAnimationFrame(() => {
157
- chatList.value.forEach((item, index) => {
158
- currIndex.value = index;
159
- if (item.thinkContent) {
160
- renderContent(item.thinkContent, "thinking");
161
- }
162
- if (item.reasoningContent) {
163
- renderContent(item.reasoningContent, "reasoning");
164
- }
165
- if (item.content) {
166
- renderContent(item.content, "main");
167
- }
168
- });
169
- });
170
- });
171
- }
172
- if (connectionType === "Websocket" && isDeepSeek.value) {
173
- openWebsocket();
174
- }
175
- } catch (error) {
176
- console.error("\u521D\u59CB\u5316\u5931\u8D25:", error);
177
- }
178
- };
179
- const findMatchingScriptContent = (userInput) => {
180
- if (!scripts || scripts.length === 0)
181
- return null;
182
- let currentScript = scripts.find((item) => item.name === selectedScriptName.value);
183
- if (!currentScript && scripts.length > 0) {
184
- currentScript = scripts[0];
185
- selectedScriptName.value = currentScript.name;
186
- }
187
- if (!currentScript)
188
- return null;
189
- const firstItem = currentScript.content[0];
190
- if (firstItem.user === "i") {
191
- const isDataMatch2 = firstItem.data && userInput.includes(firstItem.data);
192
- let isSubDataMatch2 = false;
193
- if (firstItem.subData) {
194
- if (Array.isArray(firstItem.subData)) {
195
- isSubDataMatch2 = firstItem.subData.some((item) => userInput.includes(item));
196
- }
197
- }
198
- if (isDataMatch2 || isSubDataMatch2) {
199
- currentScriptIndex.value = 0;
200
- const responses = [];
201
- let nextIndex = currentScript.content.length;
202
- for (let i = 1; i < currentScript.content.length; i++) {
203
- const item = currentScript.content[i];
204
- if (item.user === "i") {
205
- nextIndex = i;
206
- break;
207
- }
208
- if (item.user === "ai") {
209
- responses.push(item);
210
- }
211
- }
212
- return { responses, nextIndex };
213
- }
214
- }
215
- const currentItem = currentScript.content[currentScriptIndex.value];
216
- if (!currentItem || currentItem.user !== "i") {
217
- return null;
218
- }
219
- const isDataMatch = currentItem.data && userInput.includes(currentItem.data);
220
- let isSubDataMatch = false;
221
- if (currentItem.subData) {
222
- if (Array.isArray(currentItem.subData)) {
223
- isSubDataMatch = currentItem.subData.some((item) => userInput.includes(item));
224
- }
225
- }
226
- if (isDataMatch || isSubDataMatch) {
227
- const responses = [];
228
- let nextIndex = currentScript.content.length;
229
- for (let i = currentScriptIndex.value + 1; i < currentScript.content.length; i++) {
230
- const item = currentScript.content[i];
231
- if (item.user === "i") {
232
- nextIndex = i;
233
- break;
234
- }
235
- if (item.user === "ai") {
236
- responses.push(item);
237
- }
238
- }
239
- return { responses, nextIndex };
240
- }
241
- return null;
242
- };
243
- watch(
244
- () => props.value,
245
- (newVal, oldVal) => {
246
- if (!Array.isArray(newVal))
247
- return;
248
- if (newVal.length && JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
249
- chatList.value = newVal.map((item) => ({
250
- ...item,
251
- content: item.thinkContent ? item.content || "" : item.content || "",
252
- thinkContent: item.thinkContent || ""
253
- }));
254
- nextTick(() => {
255
- requestAnimationFrame(() => {
256
- chatList.value.forEach((item, index) => {
257
- currIndex.value = index;
258
- if (item.thinkContent) {
259
- renderContent(item.thinkContent, "thinking");
260
- }
261
- if (item.reasoningContent) {
262
- renderContent(item.reasoningContent, "reasoning");
263
- }
264
- if (item.content) {
265
- renderContent(item.content, "main");
266
- }
267
- });
268
- });
269
- });
270
- }
271
- },
272
- { deep: true, immediate: true }
273
- );
274
- const openWebsocket = () => {
275
- if (!wsUrl) {
276
- throw new Error("wsUrl is required");
277
- }
278
- if (!token) {
279
- throw new Error("token is required");
280
- }
281
- let config = {
282
- token,
283
- wsUrl
284
- };
285
- TouchChatRobot.value = new ChatRobot(config);
286
- TouchChatRobot.value && TouchChatRobot.value.addListener("chatCrmSuccess", {
287
- msgCallback: chatCrmSuccess,
288
- statusCallback: () => {
289
- }
290
- });
291
- TouchChatRobot.value && TouchChatRobot.value.addListener("onMessageError", {
292
- msgCallback: () => {
293
- }
294
- });
295
- TouchChatRobot.value && TouchChatRobot.value.addListener("chatCrmError", {
296
- msgCallback: (data) => {
297
- console.log("AI \u5BF9\u8BDD\u8FDE\u63A5\u9519\u8BEF\u56DE\u8C03", data);
298
- }
299
- });
300
- TouchChatRobot.value.connect();
301
- };
302
- const chatCrmSuccess = (data) => {
303
- if (data && data.chatType === "response") {
304
- if (Array.isArray(data.chatInfo)) {
305
- let msgContentList = data.chatInfo.map((item) => item.msgContent);
306
- let msgContent = msgContentList.length ? msgContentList[0] : "";
307
- chatList.value.push({
308
- user: "u",
309
- type: "text",
310
- content: msgContent
311
- });
312
- }
313
- }
314
- };
315
- const openSSE = (userContent, insertIndex, type) => {
316
- try {
317
- if (isUnmounting.value)
318
- return;
319
- isChating.value = true;
320
- if (props.openSSECallback) {
321
- props.openSSECallback(FetchStream);
322
- return;
323
- }
324
- const currentAiMessage = chatList.value.find((item) => item.isChating);
325
- if (currentAiMessage) {
326
- currentAiMessage.isShowLike = true;
327
- currentAiMessage.isShowCopy = true;
328
- currentAiMessage.componentName = currentComponentName.value;
329
- }
330
- const chatId = (currentAiMessage == null ? void 0 : currentAiMessage.chatId) || "ai_" + crypto.randomUUID().replace(/-/gi, "");
331
- let aiContent = (currentAiMessage == null ? void 0 : currentAiMessage.content) || "";
332
- let reasoningContent = (currentAiMessage == null ? void 0 : currentAiMessage.reasoningContent) || "";
333
- let allAiContent = "";
334
- if (!currentAiMessage) {
335
- const chatItem = {
336
- chatId,
337
- user: "ai",
338
- type: "text",
339
- isChating: true,
340
- content: "",
341
- thinkContent: "",
342
- reasoningContent: "",
343
- thinkStatus: "thinking" /* THINKING */,
344
- thinkStartTime: Date.now(),
345
- isShowLike: true,
346
- isShowCopy: true,
347
- componentName: currentComponentName.value
348
- };
349
- if (insertIndex !== void 0 && insertIndex <= chatList.value.length) {
350
- chatList.value.splice(insertIndex, 0, chatItem);
351
- } else {
352
- chatList.value.push(chatItem);
353
- }
354
- }
355
- currIndex.value = chatList.value.findIndex((ele) => ele.chatId === chatId);
356
- fetchStream.value = new FetchStream({
357
- url: action != null ? action : "https://api.apiyi.com/v1/chat/completions",
358
- requestInit: {
359
- headers: headers != null ? headers : {
360
- "Content-Type": "application/json",
361
- Authorization: "Bearer sk-fe9MtODvds8wpzz05f3417Fe3e9641C1926e6fC588425dEd"
362
- },
363
- body: !isDeepSeek ? JSON.stringify(body) : JSON.stringify({
364
- model: enableDeepThinking.value ? "deepseek-reasoner" : "deepseek-v3",
365
- messages: [
366
- {
367
- role: "user",
368
- content: userContent
369
- }
370
- ],
371
- stream: true
372
- })
373
- },
374
- onmessage: (line) => {
375
- var _a, _b, _c, _d, _e, _f;
376
- if (isUnmounting.value)
377
- return;
378
- let dataString = "";
379
- if (line.length) {
380
- if (line.includes("data:")) {
381
- dataString = line.split("data:")[1];
382
- } else if (line.startsWith("{") && line.endsWith("}")) {
383
- dataString = line;
384
- }
385
- }
386
- dataString = dataString.trim();
387
- if (dataString && dataString.startsWith("{") && dataString.endsWith("}")) {
388
- try {
389
- const result = JSON.parse(dataString);
390
- const newAiMessage = chatList.value[currIndex.value];
391
- if (isDeepSeek) {
392
- if ((_c = (_b = (_a = result == null ? void 0 : result.choices) == null ? void 0 : _a[0]) == null ? void 0 : _b.delta) == null ? void 0 : _c.content) {
393
- aiContent += result.choices[0].delta.content;
394
- if ((newAiMessage == null ? void 0 : newAiMessage.thinkStatus) === "thinking" /* THINKING */) {
395
- newAiMessage.thinkStatus = "completed" /* COMPLETED */;
396
- newAiMessage.thinkTime = Date.now() - (newAiMessage.thinkStartTime || Date.now());
397
- }
398
- }
399
- if ((_f = (_e = (_d = result == null ? void 0 : result.choices) == null ? void 0 : _d[0]) == null ? void 0 : _e.delta) == null ? void 0 : _f.reasoning_content) {
400
- reasoningContent += result.choices[0].delta.reasoning_content;
401
- if (!(newAiMessage == null ? void 0 : newAiMessage.thinkStatus)) {
402
- newAiMessage.thinkStatus = "thinking" /* THINKING */;
403
- newAiMessage.thinkStartTime = Date.now();
404
- }
405
- }
406
- } else {
407
- if (aiChatType === "Flow") {
408
- if ((result == null ? void 0 : result.message) && (result == null ? void 0 : result.category) === "answer") {
409
- aiContent += result.message;
410
- }
411
- } else if (aiChatType === "Intelligent") {
412
- if ((result == null ? void 0 : result.content) && (result == null ? void 0 : result.category) === "task_stream_content") {
413
- aiContent += result.content;
414
- }
415
- if ((result == null ? void 0 : result.message) && (result == null ? void 0 : result.category) === "answer") {
416
- allAiContent = result.message;
417
- }
418
- }
419
- }
420
- if (chatList.value.some((ele) => ele.chatId === chatId)) {
421
- enqueueRender({
422
- mainContent: aiContent,
423
- thinkContent: "",
424
- reasoningContent
425
- });
426
- }
427
- if (type === 1) {
428
- scrollToBottom();
429
- }
430
- } catch (error) {
431
- console.error("\u89E3\u6790SSE\u6D88\u606F\u5931\u8D25:", error);
432
- }
433
- }
434
- },
435
- ondone: () => {
436
- nextTick(() => {
437
- isChating.value = false;
438
- if (isUnmounting.value || !isMounted.value)
439
- return;
440
- const index = chatList.value.findIndex((ele) => ele.chatId === chatId);
441
- if (index !== -1 && chatList.value[index]) {
442
- chatList.value[index].isChating = false;
443
- chatList.value[index].componentName = currentComponentName.value;
444
- if (aiChatType === "Intelligent" && allAiContent) {
445
- afterSendMessage(allAiContent);
446
- }
447
- const waitForRenderComplete = () => {
448
- if (renderQueue.value.length === 0 && !isRendering.value) {
449
- if (chatList.value.length > 0 && isDeepSeek) {
450
- emit("sendMessage", JSON.parse(JSON.stringify(chatList.value)));
451
- }
452
- } else {
453
- requestAnimationFrame(waitForRenderComplete);
454
- }
455
- };
456
- waitForRenderComplete();
457
- }
458
- });
459
- },
460
- onabort: () => {
461
- handleAbort();
462
- },
463
- onerror: (response) => {
464
- handleError(response);
465
- }
466
- });
467
- } catch (error) {
468
- console.error("OpenSSE\u9519\u8BEF:", error);
469
- isChating.value = false;
470
- showToast("\u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5", "error", 3e3);
471
- }
472
- };
473
- const handleAbort = () => {
474
- isChating.value = false;
475
- if (isUnmounting.value)
476
- return;
477
- const currentAiMessage = chatList.value[currIndex.value];
478
- const hasContent = currentAiMessage && (currentAiMessage.content || currentAiMessage.thinkContent || currentAiMessage.reasoningContent);
479
- if (currentAiMessage) {
480
- if (currentAiMessage.thinkStatus === "thinking" /* THINKING */) {
481
- currentAiMessage.thinkStatus = "stopped" /* STOPPED */;
482
- currentAiMessage.thinkTime = Date.now() - (currentAiMessage.thinkStartTime || Date.now());
483
- }
484
- if (!hasContent) {
485
- const userMessageIndex = currIndex.value - 1;
486
- if (userMessageIndex >= 0 && chatList.value[userMessageIndex].user === "u") {
487
- chatList.value.splice(currIndex.value, 1);
488
- chatList.value.splice(userMessageIndex, 1);
489
- } else {
490
- chatList.value.splice(currIndex.value, 1);
491
- }
492
- } else {
493
- const updatedAiMessage = {
494
- ...currentAiMessage,
495
- isChating: false,
496
- content: currentAiMessage.content ? currentAiMessage.content + "\u3002\u3002\u3002" : "",
497
- thinkContent: currentAiMessage.thinkContent ? currentAiMessage.thinkContent + "\u3002\u3002\u3002" : void 0,
498
- reasoningContent: currentAiMessage.reasoningContent ? currentAiMessage.reasoningContent + "\u3002\u3002\u3002" : void 0,
499
- thinkStatus: currentAiMessage.thinkStatus
500
- };
501
- chatList.value.splice(currIndex.value, 1, updatedAiMessage);
502
- nextTick(() => {
503
- renderContent(updatedAiMessage.thinkContent || "", "thinking");
504
- renderContent(updatedAiMessage.reasoningContent || "", "reasoning");
505
- renderContent(updatedAiMessage.content || "", "main");
506
- emit("sendMessage", [...chatList.value]);
507
- });
508
- return;
509
- }
510
- }
511
- if (chatList.value.length > 0) {
512
- emit("sendMessage", [...chatList.value]);
513
- }
514
- };
515
- const handleError = (response) => {
516
- if (isUnmounting.value)
517
- return;
518
- isChating.value = false;
519
- let errorMessage = "\u672A\u77E5\u9519\u8BEF";
520
- if (response instanceof Error) {
521
- console.error("API\u8BF7\u6C42\u9519\u8BEF:", response);
522
- errorMessage = response.message;
523
- } else if (response instanceof Response) {
524
- console.error("API\u8BF7\u6C42\u9519\u8BEF, \u54CD\u5E94\u72B6\u6001:", response.status, response.statusText);
525
- errorMessage = `\u8BF7\u6C42\u5931\u8D25: ${response.status} ${response.statusText}`;
526
- }
527
- const currentAiMessage = chatList.value[currIndex.value];
528
- if (currentAiMessage) {
529
- currentAiMessage.content = `<div style="color: red; display: flex; align-items: center;"><svg xmlns="http://www.w3.org/2000/svg" width="15" height="16" viewBox="0 0 15 16" fill="none">
530
- <path fill-rule="evenodd" clip-rule="evenodd" d="M7.5 15.5C11.6421 15.5 15 12.1421 15 8C15 3.85786 11.6421 0.5 7.5 0.5C3.35786 0.5 0 3.85786 0 8C0 12.1421 3.35786 15.5 7.5 15.5ZM9.7539 4.9506L10.5494 5.7461L8.2951 8.0001L10.5494 10.2539L9.7539 11.0494L7.5001 8.7951L5.2461 11.0494L4.4506 10.2539L6.7051 8.0001L4.4506 5.7461L5.2461 4.9506L7.5001 7.2051L9.7539 4.9506Z" fill="#F93920"/>
531
- </svg>${errorMessage}</div>`;
532
- currentAiMessage.isChating = false;
533
- currentAiMessage.componentName = "";
534
- currentAiMessage.isShowLike = false;
535
- currentAiMessage.isShowCopy = false;
536
- nextTick(() => {
537
- renderContent(currentAiMessage.content || "", "main");
538
- emit("sendMessage", [...chatList.value]);
539
- });
540
- } else {
541
- showToast(errorMessage, "error", 3e3);
542
- emit("sendMessage", [...chatList.value]);
543
- }
544
- };
545
- const enqueueRender = (data) => {
546
- if (isUnmounting.value || !isMounted.value)
547
- return;
548
- if (currIndex.value < 0 || currIndex.value >= chatList.value.length)
549
- return;
550
- renderQueue.value.push(data);
551
- if (!isRendering.value) {
552
- isRendering.value = true;
553
- processRenderQueue();
554
- }
555
- };
556
- const processRenderQueue = () => {
557
- if (isUnmounting.value || !isMounted.value) {
558
- renderQueue.value = [];
559
- isRendering.value = false;
560
- return;
561
- }
562
- if (renderQueue.value.length === 0) {
563
- isRendering.value = false;
564
- return;
565
- }
566
- requestAnimationFrame(() => {
567
- const data = renderQueue.value.shift();
568
- if (data) {
569
- formatMarkdown(data);
570
- }
571
- processRenderQueue();
572
- });
573
- };
574
- const formatMarkdown = (data) => {
575
- if (!isMounted.value)
576
- return;
577
- if (currIndex.value < 0 || currIndex.value >= chatList.value.length)
578
- return;
579
- const currentItem = chatList.value[currIndex.value];
580
- currentItem.thinkContent = data.thinkContent;
581
- currentItem.content = data.mainContent;
582
- currentItem.reasoningContent = data.reasoningContent;
583
- nextTick(() => {
584
- const thinkingContainer = thinkingContentRef.value[currIndex.value];
585
- if (thinkingContainer) {
586
- if (data.thinkContent) {
587
- renderContent(data.thinkContent, "thinking");
588
- thinkingContainer.style.display = "block";
589
- thinkingContainer.style.visibility = "visible";
590
- } else {
591
- thinkingContainer.style.display = "none";
592
- thinkingContainer.style.visibility = "hidden";
593
- }
594
- }
595
- const reasoningContainer = reasoningContentRef.value[currIndex.value];
596
- if (reasoningContainer) {
597
- if (data.reasoningContent) {
598
- renderContent(data.reasoningContent, "reasoning");
599
- reasoningContainer.style.display = "block";
600
- reasoningContainer.style.visibility = "visible";
601
- } else {
602
- reasoningContainer.style.display = "none";
603
- reasoningContainer.style.visibility = "hidden";
604
- }
605
- }
606
- renderContent(data.mainContent, "main");
607
- });
608
- };
50
+ const ChatInputRef = ref(null);
51
+ const {
52
+ chatList,
53
+ isChating,
54
+ inputValue,
55
+ enableDeepThinking,
56
+ activeAgentsName,
57
+ init,
58
+ sendMessage,
59
+ handleBeforeSend,
60
+ handleSend,
61
+ handleStop,
62
+ handleMessageAction,
63
+ saveEdit,
64
+ cancelEdit,
65
+ completeRendered,
66
+ handleAgentSelect,
67
+ update,
68
+ updateModule,
69
+ handleDragEnter,
70
+ handleDragLeave,
71
+ handleDrop,
72
+ handleScroll,
73
+ onMounted: chatOnMounted,
74
+ onBeforeUnmount: chatOnBeforeUnmount
75
+ } = useChat({
76
+ props,
77
+ emit,
78
+ scripts: scripts.value,
79
+ unmatchText,
80
+ modules: modules.value,
81
+ afterSend,
82
+ sendMessageInject,
83
+ beforeSend,
84
+ bottom,
85
+ stop,
86
+ chatContainer,
87
+ chatInputRef: ChatInputRef
88
+ });
89
+ const { copyWithFeedback } = useCopy();
90
+ const modelChangeExternal = inject("modelChange", () => {
91
+ });
92
+ provide("modelChange", (item, index) => {
93
+ modelChangeExternal(item, index);
94
+ updateModule(item);
95
+ });
609
96
  const attachCopyButtons = (container) => {
610
97
  const codeBlocks = container.querySelectorAll("pre code");
611
98
  codeBlocks.forEach((codeBlock) => {
@@ -615,462 +102,247 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
615
102
  copyBtn.className = "touchchat-code-copy";
616
103
  copyBtn.addEventListener("click", () => {
617
104
  const code = codeBlock.textContent || "";
618
- navigator.clipboard.writeText(code).then(() => {
619
- showToast("\u590D\u5236\u6210\u529F", "info", 2e3);
620
- copyBtn.textContent = "\u5DF2\u590D\u5236";
621
- setTimeout(() => {
622
- copyBtn.textContent = "";
623
- }, 2e3);
624
- }).catch((err) => {
625
- console.error("\u590D\u5236\u5931\u8D25:", err);
626
- showToast("\u590D\u5236\u5931\u8D25", "error", 2e3);
627
- });
105
+ copyWithFeedback(code, copyBtn, "", "\u5DF2\u590D\u5236", 2e3);
628
106
  });
629
107
  pre.style.position = "relative";
630
108
  pre.appendChild(copyBtn);
631
109
  }
632
110
  });
633
111
  };
634
- const renderContent = (content, type, index) => {
635
- const renderIndex = index != null ? index : currIndex.value;
636
- if (renderIndex < 0 || renderIndex >= chatList.value.length)
637
- return;
638
- const refArrays = {
639
- main: htmlContentRef,
640
- thinking: thinkingContentRef,
641
- reasoning: reasoningContentRef
642
- };
643
- const processors = {
644
- main: (content2) => {
645
- var _a;
646
- return ((_a = markdown) == null ? void 0 : _a.render(content2, { isReasoning: false })) || "";
647
- },
648
- thinking: (content2) => {
649
- var _a;
650
- return ((_a = markdown) == null ? void 0 : _a.render(content2, { isReasoning: false })) || "";
651
- },
652
- reasoning: (content2) => {
653
- var _a;
654
- return ((_a = markdown) == null ? void 0 : _a.render(content2, { isReasoning: false })) || "";
655
- }
656
- };
657
- const container = refArrays[type].value[renderIndex];
658
- if (!container)
659
- return;
660
- container.innerHTML = processors[type](content || "");
661
- attachCopyButtons(container);
662
- };
663
- const sendMessage = (item) => {
664
- inputValue.value = item.name || "";
665
- handleBeforeSend();
112
+ const handleLikeSend = (value, idx) => {
113
+ handleSend(value);
114
+ nextTick(() => {
115
+ chatList.value[idx].likeList = [];
116
+ });
666
117
  };
667
- const handleBeforeSend = () => {
668
- if (beforeSend) {
669
- const fn = beforeSend();
670
- if (fn && typeof fn.then === "function") {
671
- Promise.resolve(fn).then((res) => {
672
- if (res.result) {
673
- currentComponentName.value = res.componentName || "";
674
- handleSend();
675
- }
676
- }).catch((error) => {
677
- console.log(error);
678
- });
679
- } else {
680
- if (fn.result) {
681
- currentComponentName.value = fn.componentName || "";
682
- handleSend();
683
- }
684
- }
118
+ const handleSelectChange = (idx) => {
119
+ if (isSelectMode.value) {
120
+ chatList.value[idx].selecting = !chatList.value[idx].selecting;
685
121
  }
686
122
  };
687
- const handleSend = (content) => {
688
- var _a;
689
- emit("beforeSendMessage");
690
- if (!isDeepSeek.value && scripts && Array.isArray(scripts) && scripts.length > 0) {
691
- const userInput = content != null ? content : inputValue.value.trim();
692
- if (!userInput)
693
- return;
694
- const userChatId = `user_${Date.now()}`;
695
- const userMessage = {
696
- chatId: userChatId,
697
- user: "u",
698
- type: "text",
699
- content: userInput,
700
- isShowLike: false,
701
- isShowCopy: true
702
- };
703
- chatList.value.push(userMessage);
704
- emit("sendMessage", [...chatList.value]);
705
- nextTick(() => {
706
- scrollToBottom();
707
- renderContent(userMessage.content, "main", chatList.value.length - 1);
708
- });
709
- const result = findMatchingScriptContent(userInput);
710
- if (result && result.responses.length > 0) {
711
- currentScriptIndex.value = result.nextIndex;
712
- const newAiMessages = [];
713
- result.responses.forEach((response, idx) => {
714
- const pauseMarker = Array.isArray(response.data) ? "\u200B".repeat(20) : "";
715
- const content2 = Array.isArray(response.data) ? response.data.join(pauseMarker) : response.data;
716
- const aiChatId = `ai_${Date.now()}_${idx}`;
717
- const aiMessage = {
718
- chatId: aiChatId,
719
- user: "ai",
720
- type: "text",
721
- content: content2 || "",
722
- componentName: response.type || "",
723
- isShowLike: true,
724
- isShowCopy: true
725
- };
726
- newAiMessages.push(aiMessage);
727
- });
728
- chatList.value.push(...newAiMessages);
729
- emit("sendMessage", [...chatList.value]);
730
- nextTick(() => {
731
- scrollToBottom();
732
- newAiMessages.forEach((msg) => {
733
- const msgIndex = chatList.value.findIndex((item) => item.chatId === msg.chatId);
734
- if (msgIndex !== -1) {
735
- renderContent(msg.content, "main", msgIndex);
736
- }
737
- });
738
- });
739
- } else {
740
- const defaultAiChatId = `ai_${Date.now()}`;
741
- const defaultAiMessage = {
742
- chatId: defaultAiChatId,
743
- user: "ai",
744
- type: "text",
745
- content: robotUnmatched,
746
- isShowLike: true,
747
- isShowCopy: true
748
- };
749
- chatList.value.push(defaultAiMessage);
750
- emit("sendMessage", [...chatList.value]);
751
- nextTick(() => {
752
- scrollToBottom();
753
- const msgIndex = chatList.value.findIndex((item) => item.chatId === defaultAiChatId);
754
- if (msgIndex !== -1) {
755
- renderContent(defaultAiMessage.content, "main", msgIndex);
756
- }
757
- });
758
- }
759
- inputValue.value = "";
760
- } else {
761
- if (content) {
762
- inputValue.value = content;
763
- }
764
- if (isChating.value || !inputValue.value.trim())
765
- return;
766
- const userChatId = "user_" + crypto.randomUUID().replace(/-/gi, "");
767
- const userMessage = {
768
- chatId: userChatId,
769
- user: "u",
770
- type: "text",
771
- content: inputValue.value
772
- };
773
- sendMessageInject(inputValue.value);
774
- chatList.value.push(userMessage);
775
- const index = chatList.value.length - 1;
776
- nextTick(() => {
777
- renderContent(userMessage.content, "main", index);
778
- scrollToBottom();
779
- });
780
- if (connectionType === "SSE") {
781
- openSSE(inputValue.value, index + 1, 1);
782
- } else if (connectionType === "Websocket") {
783
- let chatInfo = [
784
- {
785
- type: "text",
786
- msgContent: inputValue.value
787
- }
788
- ];
789
- (_a = TouchChatRobot.value) == null ? void 0 : _a.send(chatInfo);
790
- }
791
- inputValue.value = "";
792
- }
123
+ const toggleSidebarClick = (item, index) => {
124
+ emit("toggleSidebar", item, index);
793
125
  };
794
- const handleStop = () => {
795
- var _a, _b;
796
- (_a = fetchStream.value) == null ? void 0 : _a.abort();
797
- const aiIndex = chatList.value.findIndex((item) => item.isChating);
798
- if (aiIndex !== -1) {
799
- const currentAiMessage = chatList.value[aiIndex];
800
- if ((_b = currentAiMessage.content) == null ? void 0 : _b.trim()) {
801
- nextTick(() => {
802
- chatList.value[aiIndex] = {
803
- ...currentAiMessage,
804
- content: currentAiMessage.content + "...",
805
- isChating: false
806
- };
807
- renderContent(chatList.value[aiIndex].content, "main", aiIndex);
808
- emit("sendMessage", chatList.value);
809
- });
810
- } else {
811
- if (aiIndex > 0) {
812
- const userMessageIndex = aiIndex - 1;
813
- if (chatList.value[userMessageIndex].user === "u") {
814
- chatList.value.splice(userMessageIndex, 2);
815
- } else {
816
- chatList.value.splice(aiIndex, 1);
817
- }
818
- } else {
819
- chatList.value.splice(aiIndex, 1);
820
- }
821
- }
822
- } else {
823
- const lastIndex = chatList.value.length - 1;
824
- if (lastIndex >= 0 && chatList.value[lastIndex].user === "u") {
825
- chatList.value.pop();
826
- }
827
- }
828
- isChating.value = false;
126
+ const openSideBar = (item, index) => {
127
+ emit("openSideBar", item, index);
829
128
  };
830
- const scrollToBottom = throttle(300, () => {
831
- if (!isMounted.value || isUnmounting.value)
832
- return;
833
- const endEl = document.querySelector(".to-chat-item:last-child");
834
- if (endEl == null ? void 0 : endEl.scrollIntoView) {
835
- endEl.scrollIntoView({ behavior: "smooth", block: "end", inline: "nearest" });
836
- }
837
- });
838
- const handleMessageAction = (action2, index) => {
839
- const message = chatList.value[index];
840
- if (!message)
841
- return;
842
- switch (action2) {
843
- case "copy" /* COPY */:
844
- navigator.clipboard.writeText(message.content).then(() => {
845
- showToast("\u590D\u5236\u6210\u529F", "info");
846
- }).catch((err) => {
847
- console.error("\u590D\u5236\u5931\u8D25:", err);
848
- showToast("\u590D\u5236\u5931\u8D25", "error");
849
- });
850
- break;
851
- case "edit" /* EDIT */:
852
- message.isEditing = true;
853
- message.editContent = message.content;
854
- break;
855
- case "delete" /* DELETE */:
856
- messageUtils.deleteMessageChain(index);
857
- emit("sendMessage", chatList.value);
858
- break;
859
- case "retry" /* RETRY */: {
860
- const aiMessage = chatList.value[index];
861
- const userMessageIndex = index - 1;
862
- const userMessage = chatList.value[userMessageIndex];
863
- if (userMessage && userMessage.user === "u") {
864
- const updatedAiMessage = {
865
- ...aiMessage,
866
- content: "",
867
- thinkContent: "",
868
- reasoningContent: "",
869
- isLiked: false,
870
- isDisliked: false,
871
- isChating: true,
872
- chatId: aiMessage.chatId,
873
- user: aiMessage.user,
874
- type: aiMessage.type,
875
- thinkStatus: "completed" /* COMPLETED */,
876
- thinkStartTime: 0,
877
- thinkEndTime: 0
878
- };
879
- chatList.value.splice(index, 1, updatedAiMessage);
880
- nextTick(() => {
881
- if (htmlContentRef.value[index])
882
- htmlContentRef.value[index].innerHTML = "";
883
- if (thinkingContentRef.value[index])
884
- thinkingContentRef.value[index].innerHTML = "";
885
- if (reasoningContentRef.value[index])
886
- reasoningContentRef.value[index].innerHTML = "";
887
- setTimeout(() => {
888
- openSSE(userMessage.content || "", index, 2);
889
- }, 50);
890
- });
891
- }
892
- break;
893
- }
894
- case "like" /* LIKE */:
895
- messageUtils.updateMessage(index, {
896
- isLiked: true,
897
- isDisliked: false
898
- });
899
- break;
900
- case "dislike" /* DISLIKE */:
901
- messageUtils.updateMessage(index, {
902
- isLiked: false,
903
- isDisliked: true
904
- });
905
- break;
129
+ const handleMessageQuote = (item, index) => {
130
+ if (ChatInputRef.value) {
131
+ ChatInputRef.value.updateQuoteData(item, index);
906
132
  }
907
133
  };
908
- const saveEdit = (index, newContent) => {
909
- const message = chatList.value[index];
910
- if (!message || !message.editContent)
911
- return;
912
- chatList.value[index] = {
913
- ...message,
914
- content: newContent,
915
- isEditing: false,
916
- editContent: void 0
917
- };
918
- nextTick(() => {
919
- renderContent(message.content, "main", index);
920
- });
921
- if (index + 1 < chatList.value.length && chatList.value[index + 1].user === "ai") {
922
- chatList.value.splice(index + 1, 1);
134
+ const itemUploadFile = (_item, index) => {
135
+ if (ChatInputRef.value) {
136
+ ChatInputRef.value.itemUploadFile(index, "drop");
923
137
  }
924
- openSSE(newContent, index + 1);
925
- emit("sendMessage", chatList.value);
926
- };
927
- const cancelEdit = (index) => {
928
- const message = chatList.value[index];
929
- if (!message)
930
- return;
931
- message.isEditing = false;
932
- message.editContent = "";
933
- nextTick(() => {
934
- renderContent(message.content, "main", index);
935
- });
936
138
  };
937
- onMounted(async () => {
938
- init();
939
- isMounted.value = true;
940
- watch(
941
- isDeepSeek,
942
- () => {
943
- init();
944
- },
945
- { immediate: false }
946
- );
139
+ const setInputValue = inject("setInput");
140
+ onMounted(() => {
141
+ setInputValue.value = (value) => {
142
+ inputValue.value = value;
143
+ };
144
+ chatOnMounted();
947
145
  watch(
948
146
  () => scripts,
949
147
  () => {
950
- if (!isDeepSeek.value) {
951
- init();
952
- }
148
+ init();
953
149
  },
954
150
  { deep: true, immediate: false }
955
151
  );
956
152
  });
957
153
  onBeforeUnmount(() => {
958
- if (!isUnmounting.value) {
959
- isUnmounting.value = true;
960
- if (fetchStream.value) {
961
- fetchStream.value.abort();
962
- fetchStream.value = null;
963
- }
964
- if (TouchChatRobot.value) {
965
- TouchChatRobot.value.close();
966
- TouchChatRobot.value = void 0;
967
- }
968
- isMounted.value = false;
969
- renderQueue.value = [];
970
- htmlContentRef.value = [];
971
- thinkingContentRef.value = [];
972
- reasoningContentRef.value = [];
973
- }
154
+ chatOnBeforeUnmount();
974
155
  });
975
- provide("parentContext", {
976
- methods: {
977
- sendMessage,
978
- handleMessageAction
979
- }
156
+ provide("touchchat", {
157
+ send: sendMessage,
158
+ retry: handleMessageAction
980
159
  });
981
160
  __expose({
982
- handleSendOut: (value) => {
983
- handleSend(value);
984
- }
161
+ send: (value, fileList, auto, type) => {
162
+ handleSend(value, fileList, auto, type);
163
+ },
164
+ handleAgentSelect,
165
+ retry: (index) => {
166
+ handleMessageAction(MessageAction.RETRY, index);
167
+ },
168
+ update
985
169
  });
986
170
  return (_ctx, _cache) => {
987
- return openBlock(), createElementBlock("div", { class: "touchchat-main" }, [
171
+ return openBlock(), createElementBlock("div", {
172
+ class: "touchchat-main",
173
+ onDragover: withModifiers(() => {
174
+ }, ["prevent"]),
175
+ onDragenter: withModifiers(unref(handleDragEnter), ["prevent"]),
176
+ onDragleave: unref(handleDragLeave),
177
+ onDrop: withModifiers(unref(handleDrop), ["prevent"])
178
+ }, [
988
179
  createElementVNode("div", {
989
180
  ref_key: "chatContainer",
990
181
  ref: chatContainer,
991
- class: "touchchat-dialog"
182
+ class: "touchchat-dialog",
183
+ onScroll: unref(handleScroll)
992
184
  }, [
993
- renderSlot(_ctx.$slots, "tabView"),
994
- chatList.value.length === 0 ? (openBlock(), createElementBlock("div", {
185
+ renderSlot(_ctx.$slots, "top"),
186
+ unref(chatList).length === 0 ? (openBlock(), createElementBlock("div", {
995
187
  key: 0,
996
188
  class: "touchchat-welcome"
997
189
  }, [
998
190
  renderSlot(_ctx.$slots, "welcome", {}, () => [
999
- createVNode(_sfc_main$1, { onSendMessage: sendMessage })
191
+ createVNode(HelloChat, { onSendMessage: unref(sendMessage) }, null, 8, ["onSendMessage"])
1000
192
  ])
1001
- ])) : createCommentVNode("", true),
193
+ ])) : createCommentVNode("v-if", true),
1002
194
  createElementVNode("div", { class: "touchchat-dialog-content" }, [
1003
- (openBlock(true), createElementBlock(Fragment, null, renderList(chatList.value, (item, index) => {
1004
- return openBlock(), createElementBlock(Fragment, {
1005
- key: item.chatId
1006
- }, [
1007
- item.user === "u" ? (openBlock(), createBlock(_sfc_main$2, {
1008
- key: 0,
1009
- item,
1010
- index,
1011
- onCopy: ($event) => handleMessageAction("copy" /* COPY */, index),
1012
- onEdit: ($event) => handleMessageAction("edit" /* EDIT */, index),
1013
- onDelete: ($event) => handleMessageAction("delete" /* DELETE */, index),
1014
- onSaveEdit: saveEdit,
1015
- onCancelEdit: ($event) => cancelEdit(index)
1016
- }, {
1017
- userAvatar: withCtx(() => [
1018
- renderSlot(_ctx.$slots, "userAvatar")
1019
- ]),
1020
- messageActions: withCtx(() => [
1021
- renderSlot(_ctx.$slots, "messageActions", {
1022
- item,
1023
- index
1024
- })
1025
- ]),
1026
- _: 2
1027
- }, 1032, ["item", "index", "onCopy", "onEdit", "onDelete", "onCancelEdit"])) : (openBlock(), createBlock(_sfc_main$3, {
1028
- key: 1,
1029
- item,
1030
- index,
1031
- "enable-deep-thinking": enableDeepThinking.value,
1032
- onCopy: ($event) => handleMessageAction("copy" /* COPY */, index),
1033
- onRetry: ($event) => handleMessageAction("retry" /* RETRY */, index),
1034
- onLike: ($event) => handleMessageAction("like" /* LIKE */, index),
1035
- onDislike: ($event) => handleMessageAction("dislike" /* DISLIKE */, index),
1036
- onContentRendered: attachCopyButtons,
1037
- onCompleteRendered: completeRendered,
1038
- onToggleSidebar: toggleSidebarClick
1039
- }, {
1040
- aiMessageContent: withCtx(() => [
1041
- renderSlot(_ctx.$slots, "aiMessageContent", {
195
+ (openBlock(true), createElementBlock(
196
+ Fragment,
197
+ null,
198
+ renderList(unref(chatList), (item, index) => {
199
+ return openBlock(), createElementBlock("div", {
200
+ key: item.chatId,
201
+ class: "touchchat-list-box"
202
+ }, [
203
+ unref(isSelectMode) ? (openBlock(), createElementBlock("div", {
204
+ key: 0,
205
+ class: "touchchat-list-check"
206
+ }, [
207
+ withDirectives(createElementVNode("input", {
208
+ "onUpdate:modelValue": ($event) => item.selecting = $event,
209
+ class: "input-check",
210
+ type: "checkbox"
211
+ }, null, 8, ["onUpdate:modelValue"]), [
212
+ [vModelCheckbox, item.selecting]
213
+ ])
214
+ ])) : createCommentVNode("v-if", true),
215
+ createElementVNode("div", {
216
+ class: normalizeClass(["touchchat-list-content", [item.selecting ? "status-select" : "", unref(isSelectMode) ? "select-mode" : ""]]),
217
+ onClick: ($event) => handleSelectChange(index)
218
+ }, [
219
+ item.user === "u" ? (openBlock(), createBlock(UserMessage, {
220
+ key: 0,
1042
221
  item,
1043
- index
1044
- })
1045
- ]),
1046
- aiAvatar: withCtx(() => [
1047
- renderSlot(_ctx.$slots, "aiAvatar")
1048
- ]),
1049
- messageActions: withCtx(() => [
1050
- renderSlot(_ctx.$slots, "messageActions", {
222
+ index,
223
+ onUserMessageFileList: itemUploadFile,
224
+ onCopy: ($event) => unref(handleMessageAction)(unref(MessageAction).COPY, index),
225
+ onEdit: ($event) => unref(handleMessageAction)(unref(MessageAction).EDIT, index),
226
+ onDelete: ($event) => unref(handleMessageAction)(unref(MessageAction).DELETE, index),
227
+ onSaveEdit: unref(saveEdit),
228
+ onCancelEdit: ($event) => unref(cancelEdit)(index),
229
+ onWithDraw: ($event) => unref(handleMessageAction)(unref(MessageAction).WITHDRAW, index)
230
+ }, {
231
+ userAvatar: withCtx(() => [
232
+ renderSlot(_ctx.$slots, "userAvatar")
233
+ ]),
234
+ fn: withCtx(() => [
235
+ renderSlot(_ctx.$slots, "fn", {
236
+ item,
237
+ index
238
+ })
239
+ ]),
240
+ _: 2
241
+ /* DYNAMIC */
242
+ }, 1032, ["item", "index", "onCopy", "onEdit", "onDelete", "onSaveEdit", "onCancelEdit", "onWithDraw"])) : createCommentVNode("v-if", true),
243
+ item.user === "withDraw" ? (openBlock(), createElementBlock("div", {
244
+ key: 1,
245
+ class: "touchchat-dialog-withDraw"
246
+ }, "\u4F60\u64A4\u56DE\u4E86\u4E00\u6761\u6D88\u606F")) : createCommentVNode("v-if", true),
247
+ item.user === "ai" ? (openBlock(), createBlock(AiMessage, {
248
+ key: 2,
1051
249
  item,
1052
- index
1053
- })
1054
- ]),
1055
- _: 2
1056
- }, 1032, ["item", "index", "enable-deep-thinking", "onCopy", "onRetry", "onLike", "onDislike"]))
1057
- ], 64);
1058
- }), 128))
250
+ index,
251
+ "enable-deep-thinking": unref(enableDeepThinking),
252
+ "has-retry": unref(activeAgentsName) || scriptsLength.value > 0 ? false : true,
253
+ onCopy: ($event) => unref(handleMessageAction)(unref(MessageAction).COPY, index),
254
+ onRetry: ($event) => unref(handleMessageAction)(unref(MessageAction).RETRY, index),
255
+ onLike: ($event) => unref(handleMessageAction)(unref(MessageAction).LIKE, index),
256
+ onQuote: handleMessageQuote,
257
+ onDislike: ($event) => unref(handleMessageAction)(unref(MessageAction).DISLIKE, index),
258
+ onContentRendered: attachCopyButtons,
259
+ onCompleteRendered: unref(completeRendered),
260
+ onToggleSidebar: toggleSidebarClick,
261
+ onOpenSideBar: openSideBar,
262
+ onSend: (value) => handleLikeSend(value, index)
263
+ }, {
264
+ aimsg: withCtx(() => [
265
+ renderSlot(_ctx.$slots, "aimsg", {
266
+ item,
267
+ index
268
+ })
269
+ ]),
270
+ msg: withCtx(() => [
271
+ renderSlot(_ctx.$slots, "msg", {
272
+ item,
273
+ index
274
+ })
275
+ ]),
276
+ aiAvatar: withCtx(() => [
277
+ renderSlot(_ctx.$slots, "aiAvatar")
278
+ ]),
279
+ fn: withCtx(() => [
280
+ renderSlot(_ctx.$slots, "fn", {
281
+ item,
282
+ index
283
+ })
284
+ ]),
285
+ extendsFn: withCtx(() => [
286
+ renderSlot(_ctx.$slots, "extendsFn", {
287
+ item,
288
+ index
289
+ })
290
+ ]),
291
+ mayLike: withCtx(() => [
292
+ renderSlot(_ctx.$slots, "mayLike", {
293
+ item,
294
+ index
295
+ })
296
+ ]),
297
+ _: 2
298
+ /* DYNAMIC */
299
+ }, 1032, ["item", "index", "enable-deep-thinking", "has-retry", "onCopy", "onRetry", "onLike", "onDislike", "onCompleteRendered", "onSend"])) : createCommentVNode("v-if", true)
300
+ ], 10, ["onClick"])
301
+ ]);
302
+ }),
303
+ 128
304
+ /* KEYED_FRAGMENT */
305
+ ))
1059
306
  ])
1060
- ], 512),
1061
- renderSlot(_ctx.$slots, "chatInput", {}, () => [
1062
- createVNode(_sfc_main$4, {
1063
- "input-value": inputValue.value,
1064
- "onUpdate:inputValue": ($event) => inputValue.value = $event,
1065
- "enable-deep-thinking": enableDeepThinking.value,
1066
- "onUpdate:enableDeepThinking": ($event) => enableDeepThinking.value = $event,
1067
- "is-chating": isChating.value,
1068
- onSend: handleBeforeSend,
1069
- onStop: handleStop,
1070
- onToggleDeepThinking: (val) => enableDeepThinking.value = val
1071
- }, null, 8, ["input-value", "onUpdate:inputValue", "enable-deep-thinking", "onUpdate:enableDeepThinking", "is-chating", "onToggleDeepThinking"])
307
+ ], 40, ["onScroll"]),
308
+ _ctx.$slots.shortcut ? (openBlock(), createElementBlock("div", {
309
+ key: 0,
310
+ class: "touchchat-edit-shortcut"
311
+ }, [
312
+ renderSlot(_ctx.$slots, "shortcut")
313
+ ])) : createCommentVNode("v-if", true),
314
+ renderSlot(_ctx.$slots, "edit", {}, () => [
315
+ createVNode(ChatInput, {
316
+ ref_key: "ChatInputRef",
317
+ ref: ChatInputRef,
318
+ "input-value": unref(inputValue),
319
+ "onUpdate:inputValue": ($event) => isRef(inputValue) ? inputValue.value = $event : null,
320
+ "enable-deep-thinking": unref(enableDeepThinking),
321
+ "onUpdate:enableDeepThinking": ($event) => isRef(enableDeepThinking) ? enableDeepThinking.value = $event : null,
322
+ "is-chating": unref(isChating),
323
+ onSend: unref(handleBeforeSend),
324
+ onStop: unref(handleStop),
325
+ onToggleDeepThinking: (val) => enableDeepThinking.value = val,
326
+ onModuleInfo: (_info) => {
327
+ }
328
+ }, {
329
+ editTop: withCtx(() => [
330
+ renderSlot(_ctx.$slots, "editTop")
331
+ ]),
332
+ editFn: withCtx(() => [
333
+ renderSlot(_ctx.$slots, "editFn")
334
+ ]),
335
+ editSubmitRight: withCtx(() => [
336
+ renderSlot(_ctx.$slots, "editSubmitRight")
337
+ ]),
338
+ editSubmitLeft: withCtx(() => [
339
+ renderSlot(_ctx.$slots, "editSubmitLeft")
340
+ ]),
341
+ _: 3
342
+ /* FORWARDED */
343
+ }, 8, ["input-value", "onUpdate:inputValue", "enable-deep-thinking", "onUpdate:enableDeepThinking", "is-chating", "onSend", "onStop", "onToggleDeepThinking"])
1072
344
  ])
1073
- ]);
345
+ ], 40, ["onDragover", "onDragenter", "onDragleave", "onDrop"]);
1074
346
  };
1075
347
  }
1076
348
  });