@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
@@ -0,0 +1,1038 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var vue = require('vue');
6
+ var UserMessage = require('./UserMessage.vue.js');
7
+ var AiMessage = require('./AiMessage.vue.js');
8
+ var ChatInput = require('./ChatInput.vue.js');
9
+ var HelloChat = require('../../component/HelloChat.vue.js');
10
+ var index = require('../../../../../node_modules/.pnpm/throttle-debounce@5.0.2/node_modules/throttle-debounce/esm/index.js');
11
+ var tools = require('../../utils/tools.js');
12
+ var purify_es = require('../../../../../node_modules/.pnpm/dompurify@3.3.0/node_modules/dompurify/dist/purify.es.js');
13
+ var markdown = require('../../utils/markdown.js');
14
+ var types = require('./Chat/types.js');
15
+ var useMessageRender = require('./Chat/useMessageRender.js');
16
+ var useScroll = require('./Chat/useScroll.js');
17
+ var useCopy = require('./Chat/useCopy.js');
18
+ var a2aService = require('../../utils/a2aService.js');
19
+
20
+ const MULTI_AGENT_HOST = "/ar/v1/mas/host_agent";
21
+ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
22
+ __name: "TouchAgent",
23
+ props: {
24
+ value: {
25
+ type: Array,
26
+ default: () => []
27
+ }
28
+ },
29
+ emits: ["sendMessage", "toggleSidebar", "beforeSendMessage"],
30
+ setup(__props, { expose: __expose, emit: __emit }) {
31
+ const DEFAULT_AGENT = {
32
+ id: "agent-1",
33
+ name: "A2A Agent",
34
+ version: "1.0",
35
+ endpoint: "http://10.19.93.128:30015/engine/api/v1/a2a/7b8f4d0eeee643859a812a166c606b13/1.0",
36
+ authToken: "c09f1251-e979-4a1a-ac67-6a11a8ab49f7",
37
+ // endpoint: '/agent-api/Njd8NnwxfDUy',
38
+ // authToken: 'a7ef44a7-9e85-4989-a2eb-34ae4dc76b7a',
39
+ description: "Default A2A agent"
40
+ };
41
+ const selectedAgents = vue.ref(["agent-1"]);
42
+ const agentInfo = vue.inject("agentInfo", vue.ref({ list: [], url: "", headers: {} }));
43
+ const iMultiAgentInfo = vue.ref(agentInfo.value || { list: [], url: "", headers: {} });
44
+ vue.watch(
45
+ () => agentInfo.value,
46
+ (newVal) => {
47
+ iMultiAgentInfo.value = newVal || { url: "", token: "" };
48
+ },
49
+ { immediate: true, deep: true }
50
+ );
51
+ vue.watch(
52
+ iMultiAgentInfo.value.list,
53
+ (newVal) => {
54
+ iMultiAgentInfo.value.list = newVal || [DEFAULT_AGENT];
55
+ iMultiAgentInfo.value.list.forEach((agent) => {
56
+ a2aService.a2aService.registerAgent(agent);
57
+ });
58
+ if (iMultiAgentInfo.value.list.length > 0) {
59
+ selectedAgents.value = [iMultiAgentInfo.value.list[0].id];
60
+ }
61
+ },
62
+ { immediate: true, deep: true }
63
+ );
64
+ const emit = __emit;
65
+ const afterSend = vue.inject("afterSend", () => {
66
+ console.warn("\u672A\u63D0\u4F9BafterSend\u51FD\u6570");
67
+ });
68
+ const sendMessageInject = vue.inject("send", () => {
69
+ console.warn("\u672A\u63D0\u4F9BhandleSend\u51FD\u6570");
70
+ });
71
+ const beforeSend = vue.inject("beforeSend", () => ({
72
+ result: true,
73
+ componentName: ""
74
+ }));
75
+ const bottom = vue.inject("bottom", () => {
76
+ console.warn("\u672A\u63D0\u4F9Bbottom\u51FD\u6570");
77
+ });
78
+ const stop = vue.inject("stop", () => {
79
+ console.warn("\u672A\u63D0\u4F9Bstop\u51FD\u6570");
80
+ });
81
+ const props = __props;
82
+ const chatContainer = vue.ref(null);
83
+ const isMounted = vue.ref(false);
84
+ const isChating = vue.ref(false);
85
+ const inputValue = vue.ref("");
86
+ const chatList = vue.ref([]);
87
+ const currIndex = vue.ref(0);
88
+ const isUnmounting = vue.ref(false);
89
+ const currentComponentName = vue.ref("");
90
+ const fileData = vue.ref([]);
91
+ const ChatInputRef = vue.ref(null);
92
+ const isDragging = vue.ref(false);
93
+ const typeFlag = vue.ref("");
94
+ const scrollObserver = vue.ref(null);
95
+ const abortController = vue.ref(null);
96
+ const renderQueue = vue.ref([]);
97
+ const isRendering = vue.ref(false);
98
+ const currentMessageProcessor = vue.ref(null);
99
+ const { htmlContentRef, thinkingContentRef, reasoningContentRef } = useMessageRender.useMessageRender({
100
+ chatList,
101
+ currIndex,
102
+ isMounted,
103
+ isUnmounting
104
+ });
105
+ useScroll.useScroll({
106
+ chatContainer,
107
+ isMounted,
108
+ isUnmounting,
109
+ bottom: () => {
110
+ }
111
+ });
112
+ const { copyToClipboard, copyWithFeedback } = useCopy.useCopy();
113
+ const messageUtils = {
114
+ updateMessage: (index, updates) => {
115
+ if (index < 0 || index >= chatList.value.length)
116
+ return;
117
+ chatList.value.splice(index, 1, { ...chatList.value[index], ...updates });
118
+ vue.nextTick(() => {
119
+ const message = chatList.value[index];
120
+ if (message) {
121
+ renderContent(message.content, "main", index);
122
+ if (message.thinkContent) {
123
+ renderContent(message.thinkContent, "thinking", index);
124
+ }
125
+ if (message.reasoningContent) {
126
+ renderContent(message.reasoningContent, "reasoning", index);
127
+ }
128
+ }
129
+ });
130
+ },
131
+ deleteMessageChain: (index) => {
132
+ if (index < 0 || index >= chatList.value.length)
133
+ return;
134
+ if (chatList.value[index].user === "u") {
135
+ let deleteCount = 1;
136
+ for (let i = index + 1; i < chatList.value.length; i++) {
137
+ if (chatList.value[i].user === "ai") {
138
+ deleteCount++;
139
+ } else {
140
+ break;
141
+ }
142
+ }
143
+ chatList.value.splice(index, deleteCount);
144
+ } else {
145
+ chatList.value.splice(index, 1);
146
+ }
147
+ },
148
+ createStandardMessage: (data) => {
149
+ var _a, _b, _c, _d, _e;
150
+ return {
151
+ // chatId: data.chatId || 'ai_' + crypto.randomUUID().replace(/-/gi, ''),
152
+ chatId: data.chatId || "ai_" + Math.random().toString(36).slice(2).padEnd(10, "0").slice(0, 10),
153
+ user: data.user || "ai",
154
+ type: data.type || "text",
155
+ content: data.content || "",
156
+ isChating: (_a = data.isChating) != null ? _a : false,
157
+ thinkContent: data.thinkContent || "",
158
+ reasoningContent: data.reasoningContent || "",
159
+ isLiked: (_b = data.isLiked) != null ? _b : false,
160
+ isDisliked: (_c = data.isDisliked) != null ? _c : false,
161
+ isEditing: (_d = data.isEditing) != null ? _d : false,
162
+ editContent: (_e = data.editContent) != null ? _e : "",
163
+ msgList: []
164
+ };
165
+ }
166
+ };
167
+ const update = (index, message) => {
168
+ chatList.value[index] = { ...chatList.value[index], ...message };
169
+ console.log("update", chatList.value[index]);
170
+ };
171
+ const completeRendered = (chatId) => {
172
+ if (currentMessageProcessor.value) {
173
+ currentMessageProcessor.value.handleMessageComplete(chatId);
174
+ }
175
+ };
176
+ const toggleSidebarClick = (item, index) => {
177
+ emit("toggleSidebar", item, index);
178
+ };
179
+ const init = () => {
180
+ try {
181
+ if (Array.isArray(props.value) && props.value.length) {
182
+ chatList.value = props.value.map((item) => ({
183
+ ...item,
184
+ content: item.thinkContent ? item.content || "" : item.content || "",
185
+ thinkContent: item.thinkContent || ""
186
+ }));
187
+ vue.nextTick(() => {
188
+ requestAnimationFrame(() => {
189
+ chatList.value.forEach((item) => {
190
+ if (item.thinkContent) {
191
+ renderContent(item.thinkContent, "thinking");
192
+ }
193
+ if (item.reasoningContent) {
194
+ renderContent(item.reasoningContent, "reasoning");
195
+ }
196
+ if (item.content) {
197
+ renderContent(item.content, "main");
198
+ }
199
+ });
200
+ vue.nextTick(() => {
201
+ scrollToBottom();
202
+ });
203
+ });
204
+ });
205
+ }
206
+ } catch (error) {
207
+ console.error("\u521D\u59CB\u5316\u5931\u8D25:", error);
208
+ }
209
+ };
210
+ const onScrollToBottom = () => {
211
+ bottom();
212
+ };
213
+ const throttledScrollToBottom = index.throttle(300, onScrollToBottom);
214
+ const handleScroll = () => {
215
+ if (!chatContainer.value)
216
+ return;
217
+ const { scrollTop, scrollHeight, clientHeight } = chatContainer.value;
218
+ if (scrollTop + clientHeight >= scrollHeight) {
219
+ throttledScrollToBottom();
220
+ }
221
+ };
222
+ const enqueueRender = (data) => {
223
+ if (isUnmounting.value || !isMounted.value)
224
+ return;
225
+ if (currIndex.value < 0 || currIndex.value >= chatList.value.length)
226
+ return;
227
+ renderQueue.value.push(data);
228
+ if (!isRendering.value) {
229
+ isRendering.value = true;
230
+ processRenderQueue();
231
+ }
232
+ };
233
+ const processRenderQueue = () => {
234
+ if (isUnmounting.value || !isMounted.value) {
235
+ renderQueue.value = [];
236
+ isRendering.value = false;
237
+ return;
238
+ }
239
+ if (renderQueue.value.length === 0) {
240
+ isRendering.value = false;
241
+ return;
242
+ }
243
+ requestAnimationFrame(() => {
244
+ const data = renderQueue.value.shift();
245
+ if (data) {
246
+ formatMarkdown(data);
247
+ }
248
+ processRenderQueue();
249
+ });
250
+ };
251
+ const formatMarkdown = (data) => {
252
+ if (!isMounted.value)
253
+ return;
254
+ if (currIndex.value < 0 || currIndex.value >= chatList.value.length)
255
+ return;
256
+ const currentItem = chatList.value[currIndex.value];
257
+ currentItem.thinkContent = data.thinkContent;
258
+ currentItem.content = data.mainContent;
259
+ currentItem.reasoningContent = data.reasoningContent;
260
+ vue.nextTick(() => {
261
+ const thinkingContainer = thinkingContentRef.value[currIndex.value];
262
+ if (thinkingContainer) {
263
+ if (data.thinkContent) {
264
+ renderContent(data.thinkContent, "thinking");
265
+ thinkingContainer.style.display = "block";
266
+ thinkingContainer.style.visibility = "visible";
267
+ } else {
268
+ thinkingContainer.style.display = "none";
269
+ thinkingContainer.style.visibility = "hidden";
270
+ }
271
+ }
272
+ const reasoningContainer = reasoningContentRef.value[currIndex.value];
273
+ if (reasoningContainer) {
274
+ if (data.reasoningContent) {
275
+ renderContent(data.reasoningContent, "reasoning");
276
+ reasoningContainer.style.display = "block";
277
+ reasoningContainer.style.visibility = "visible";
278
+ } else {
279
+ reasoningContainer.style.display = "none";
280
+ reasoningContainer.style.visibility = "hidden";
281
+ }
282
+ }
283
+ renderContent(data.mainContent, "main");
284
+ });
285
+ };
286
+ const typewriterEffect = (message, newText, speed = 30, chatId, accumulatedText = "") => {
287
+ return new Promise((resolve) => {
288
+ const currentText = accumulatedText;
289
+ let currentIndex = 0;
290
+ const typingInterval = setInterval(() => {
291
+ var _a;
292
+ if ((_a = abortController.value) == null ? void 0 : _a.signal.aborted) {
293
+ clearInterval(typingInterval);
294
+ const textToAdd = newText.substring(0, currentIndex);
295
+ const combinedText = currentText + textToAdd;
296
+ resolve(combinedText);
297
+ return;
298
+ }
299
+ if (currentIndex < newText.length) {
300
+ const textToAdd = newText.substring(0, currentIndex + 1);
301
+ const combinedText = currentText + textToAdd;
302
+ message.parts = [{ type: "text", text: combinedText }];
303
+ currentIndex++;
304
+ randerAngentMessage(combinedText, chatId);
305
+ } else {
306
+ clearInterval(typingInterval);
307
+ resolve(currentText + newText);
308
+ }
309
+ }, speed);
310
+ });
311
+ };
312
+ const generateMessageId = () => {
313
+ return `msg-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
314
+ };
315
+ const createTextMessage = (text, role) => ({
316
+ messageId: generateMessageId(),
317
+ role,
318
+ parts: [{ type: "text", text }],
319
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
320
+ });
321
+ const randerAngentMessage = (text, chatId) => {
322
+ if (chatList.value.some((ele) => ele.chatId === chatId)) {
323
+ enqueueRender({
324
+ mainContent: text,
325
+ thinkContent: "",
326
+ reasoningContent: ""
327
+ });
328
+ }
329
+ };
330
+ const isA2A1_0Chunk = (chunk) => {
331
+ var _a, _b;
332
+ return chunk && typeof chunk === "object" && "taskId" in chunk && "status" in chunk && ((_b = (_a = chunk.status) == null ? void 0 : _a.message) == null ? void 0 : _b.parts);
333
+ };
334
+ const extractTextFromA2A1_0Chunk = (chunk) => {
335
+ var _a, _b;
336
+ if (((_b = (_a = chunk.status) == null ? void 0 : _a.message) == null ? void 0 : _b.parts) && chunk.status.message.parts.length > 0) {
337
+ return chunk.status.message.parts.map((part) => part.text || "").join("");
338
+ }
339
+ return "";
340
+ };
341
+ const sendSingleAgentMessage = async (userContent, chatId) => {
342
+ var _a, _b, _c;
343
+ abortController.value = new AbortController();
344
+ const { signal } = abortController.value;
345
+ const agentMessage = createTextMessage(userContent, "user");
346
+ const agentId = selectedAgents.value[0];
347
+ let stream;
348
+ try {
349
+ stream = await a2aService.a2aService.streamMessage(agentId, agentMessage, void 0, signal);
350
+ console.log("stream === TouchAgent.vue === 455", stream);
351
+ } catch (error) {
352
+ if (error.name === "AbortError") {
353
+ abortController.value = null;
354
+ isChating.value = false;
355
+ chatList.value[currIndex.value].isChating = false;
356
+ vue.nextTick(() => {
357
+ emit("sendMessage", [...chatList.value]);
358
+ });
359
+ return;
360
+ }
361
+ showErrorMessage(error instanceof Error ? error.message : "\u8BF7\u6C42\u5931\u8D25");
362
+ abortController.value = null;
363
+ return;
364
+ }
365
+ let fullResponseText = "";
366
+ let accumulatedText = "";
367
+ const reader = stream.getReader();
368
+ try {
369
+ let isDone = false;
370
+ while (!isDone) {
371
+ const { done, value: chunk } = await reader.read();
372
+ console.log("done === TouchAgent.vue === 483", done);
373
+ if (done) {
374
+ isDone = true;
375
+ break;
376
+ }
377
+ if (isA2A1_0Chunk(chunk)) {
378
+ const newText = extractTextFromA2A1_0Chunk(chunk);
379
+ if (newText) {
380
+ fullResponseText += newText;
381
+ const lastMessage = createTextMessage("", "agent");
382
+ if (newText.length > 10) {
383
+ accumulatedText = await typewriterEffect(lastMessage, newText, 30, chatId, accumulatedText);
384
+ } else {
385
+ accumulatedText += newText;
386
+ randerAngentMessage(accumulatedText, chatId);
387
+ }
388
+ }
389
+ continue;
390
+ }
391
+ if (chunk.result) {
392
+ if ("status" in chunk.result) {
393
+ const status = chunk.result.status;
394
+ if ((_a = status == null ? void 0 : status.message) == null ? void 0 : _a.parts) {
395
+ const textParts = status.message.parts.filter((p) => p.kind === "text");
396
+ const newText = textParts.map((p) => p.text).join("");
397
+ fullResponseText += newText;
398
+ const lastMessage = createTextMessage("", "agent");
399
+ if (newText.length > 10) {
400
+ accumulatedText = await typewriterEffect(lastMessage, newText, 30, chatId, accumulatedText);
401
+ } else {
402
+ accumulatedText += newText;
403
+ randerAngentMessage(accumulatedText, chatId);
404
+ }
405
+ }
406
+ }
407
+ }
408
+ if ((_b = chunk.params) == null ? void 0 : _b.status) {
409
+ console.log("Task status:", chunk.params.status);
410
+ }
411
+ if ((_c = chunk.params) == null ? void 0 : _c.artifact) {
412
+ console.log("Artifact received:", chunk.params.artifact);
413
+ }
414
+ }
415
+ } catch (error) {
416
+ if (error.name !== "AbortError") {
417
+ showErrorMessage(error instanceof Error ? error.message : "\u8BF7\u6C42\u5931\u8D25");
418
+ }
419
+ } finally {
420
+ reader.releaseLock();
421
+ abortController.value = null;
422
+ }
423
+ vue.nextTick(() => {
424
+ emit("sendMessage", [...chatList.value]);
425
+ });
426
+ isChating.value = false;
427
+ chatList.value[currIndex.value].isChating = false;
428
+ if (fullResponseText) {
429
+ afterSend({ allAiContent: fullResponseText });
430
+ }
431
+ };
432
+ const getSubAgents = () => {
433
+ return iMultiAgentInfo.value.list.map((agent) => ({
434
+ agent_name: agent.agent_name,
435
+ agent_url: agent.agent_url,
436
+ headers: agent.headers
437
+ }));
438
+ };
439
+ const sendMultiAgentMessage = async (text, chatId) => {
440
+ var _a, _b;
441
+ abortController.value = new AbortController();
442
+ const { signal } = abortController.value;
443
+ let fullResponseText = "";
444
+ let accumulatedText = "";
445
+ try {
446
+ const userMessage = createTextMessage(text, "user");
447
+ const subAgents = getSubAgents();
448
+ const stream = a2aService.a2aService.streamMultiAgentMessage(iMultiAgentInfo.value.url || MULTI_AGENT_HOST, subAgents, userMessage, iMultiAgentInfo.value.headers || {}, void 0, signal);
449
+ for await (const chunk of stream) {
450
+ if (isA2A1_0Chunk(chunk)) {
451
+ const newText = extractTextFromA2A1_0Chunk(chunk);
452
+ if (newText) {
453
+ fullResponseText += newText;
454
+ const lastMessage = createTextMessage("", "agent");
455
+ if (newText.length > 10) {
456
+ accumulatedText = await typewriterEffect(lastMessage, newText, 30, chatId, accumulatedText);
457
+ } else {
458
+ accumulatedText += newText;
459
+ randerAngentMessage(accumulatedText, chatId);
460
+ }
461
+ }
462
+ continue;
463
+ }
464
+ if (chunk.result) {
465
+ if ("status" in chunk.result) {
466
+ const status = chunk.result.status;
467
+ if ((_a = status == null ? void 0 : status.message) == null ? void 0 : _a.parts) {
468
+ const textParts = status.message.parts.filter((p) => p.kind === "text");
469
+ const newText = textParts.map((p) => p.text).join("");
470
+ fullResponseText += newText;
471
+ const lastMessage = createTextMessage("", "agent");
472
+ if (newText.length > 10) {
473
+ accumulatedText = await typewriterEffect(lastMessage, newText, 30, chatId, accumulatedText);
474
+ } else {
475
+ accumulatedText += newText;
476
+ randerAngentMessage(accumulatedText, chatId);
477
+ }
478
+ }
479
+ }
480
+ }
481
+ if (chunk.error) {
482
+ console.error("Multi-agent error chunk:", chunk.error);
483
+ showErrorMessage((_b = chunk.error.message) != null ? _b : "\u591A\u667A\u80FD\u4F53\u8BF7\u6C42\u5931\u8D25");
484
+ break;
485
+ }
486
+ }
487
+ } catch (err) {
488
+ console.error("Error in multi-agent mode:", err);
489
+ if (err.name !== "AbortError") {
490
+ showErrorMessage(err instanceof Error ? err.message : "\u591A\u667A\u80FD\u4F53\u8BF7\u6C42\u5931\u8D25");
491
+ }
492
+ } finally {
493
+ abortController.value = null;
494
+ }
495
+ vue.nextTick(() => {
496
+ emit("sendMessage", [...chatList.value]);
497
+ });
498
+ isChating.value = false;
499
+ chatList.value[currIndex.value].isChating = false;
500
+ if (fullResponseText) {
501
+ afterSend({ allAiContent: fullResponseText });
502
+ }
503
+ };
504
+ const openSSE = async (userContent, insertIndex) => {
505
+ try {
506
+ if (isUnmounting.value)
507
+ return;
508
+ isChating.value = true;
509
+ const currentAiMessage = chatList.value.find((item) => item.isChating);
510
+ if (currentAiMessage) {
511
+ currentAiMessage.isShowLike = true;
512
+ currentAiMessage.isShowCopy = true;
513
+ currentAiMessage.componentName = currentComponentName.value;
514
+ }
515
+ const chatId = (currentAiMessage == null ? void 0 : currentAiMessage.chatId) || "ai_" + Math.random().toString(36).slice(2).padEnd(10, "0").slice(0, 10);
516
+ if (!currentAiMessage) {
517
+ const chatItem = {
518
+ chatId,
519
+ user: "ai",
520
+ type: "text",
521
+ isChating: true,
522
+ content: "",
523
+ thinkContent: "",
524
+ reasoningContent: "",
525
+ thinkStatus: types.ThinkStatus.THINKING,
526
+ thinkStartTime: Date.now(),
527
+ isShowLike: true,
528
+ isShowCopy: true,
529
+ componentName: currentComponentName.value,
530
+ typeFlag: typeFlag.value,
531
+ msgList: []
532
+ };
533
+ if (insertIndex !== void 0 && insertIndex <= chatList.value.length) {
534
+ chatList.value.splice(insertIndex, 0, chatItem);
535
+ } else {
536
+ chatList.value.push(chatItem);
537
+ }
538
+ }
539
+ currIndex.value = insertIndex != null ? insertIndex : chatList.value.length - 1;
540
+ if (iMultiAgentInfo.value.list.length === 1) {
541
+ sendSingleAgentMessage(userContent, chatId);
542
+ } else {
543
+ sendMultiAgentMessage(userContent, chatId);
544
+ }
545
+ } catch (error) {
546
+ console.error("OpenSSE\u9519\u8BEF:", error);
547
+ showErrorMessage("\u8BF7\u6C42\u5931\u8D25");
548
+ }
549
+ };
550
+ const showErrorMessage = (message) => {
551
+ isChating.value = false;
552
+ chatList.value[currIndex.value].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">
553
+ <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"/>
554
+ </svg>${message}</div>`;
555
+ chatList.value[currIndex.value].isChating = false;
556
+ chatList.value[currIndex.value].isShowCopy = false;
557
+ chatList.value[currIndex.value].isShowLike = false;
558
+ tools.showToast("\u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5", "error", 3e3);
559
+ };
560
+ const attachCopyButtons = (container) => {
561
+ const codeBlocks = container.querySelectorAll("pre code");
562
+ codeBlocks.forEach((codeBlock) => {
563
+ const pre = codeBlock.parentElement;
564
+ if (pre) {
565
+ const copyBtn = document.createElement("button");
566
+ copyBtn.className = "touchchat-code-copy";
567
+ copyBtn.addEventListener("click", () => {
568
+ const code = codeBlock.textContent || "";
569
+ copyWithFeedback(code, copyBtn, "", "\u5DF2\u590D\u5236", 2e3);
570
+ });
571
+ pre.style.position = "relative";
572
+ pre.appendChild(copyBtn);
573
+ }
574
+ });
575
+ };
576
+ const renderContent = (content, type, index) => {
577
+ const renderIndex = index != null ? index : currIndex.value;
578
+ if (renderIndex < 0 || renderIndex >= chatList.value.length)
579
+ return;
580
+ const refArrays = {
581
+ main: htmlContentRef,
582
+ thinking: thinkingContentRef,
583
+ reasoning: reasoningContentRef
584
+ };
585
+ const processors = {
586
+ main: (content2) => {
587
+ var _a;
588
+ return ((_a = markdown.default) == null ? void 0 : _a.render(content2, { isReasoning: false })) || "";
589
+ },
590
+ thinking: (content2) => {
591
+ var _a;
592
+ return ((_a = markdown.default) == null ? void 0 : _a.render(content2, { isReasoning: false })) || "";
593
+ },
594
+ reasoning: (content2) => {
595
+ var _a;
596
+ return ((_a = markdown.default) == null ? void 0 : _a.render(content2, { isReasoning: true })) || "";
597
+ }
598
+ };
599
+ const container = refArrays[type].value[renderIndex];
600
+ if (!container)
601
+ return;
602
+ container.innerHTML = processors[type](content || "");
603
+ const sanitizedContent = purify_es.default.sanitize(processors[type](content || ""));
604
+ container.innerHTML = sanitizedContent;
605
+ attachCopyButtons(container);
606
+ };
607
+ const sendMessage = (content, fileList, auto, type) => {
608
+ inputValue.value = content || "";
609
+ handleBeforeSend(content, fileList, auto, type);
610
+ };
611
+ const handleBeforeSend = (content, fileList, auto, type) => {
612
+ fileData.value = fileList || [];
613
+ if (beforeSend) {
614
+ const fn = beforeSend();
615
+ if (fn && typeof fn.then === "function") {
616
+ Promise.resolve(fn).then((res) => {
617
+ if (res.result) {
618
+ currentComponentName.value = res.componentName || "";
619
+ handleSend(content, fileList, auto, type);
620
+ }
621
+ }).catch((error) => {
622
+ console.log(error);
623
+ });
624
+ } else {
625
+ if (fn.result) {
626
+ currentComponentName.value = fn.componentName || "";
627
+ handleSend(content, fileList, auto, type);
628
+ }
629
+ }
630
+ }
631
+ };
632
+ const handleSend = (content, fileList, auto, type) => {
633
+ emit("beforeSendMessage");
634
+ sendMessageInject(inputValue.value, fileData.value);
635
+ typeFlag.value = type || "";
636
+ if (content) {
637
+ inputValue.value = content;
638
+ }
639
+ if ((isChating.value || !inputValue.value.trim() && !(fileList == null ? void 0 : fileList.length)) && !auto)
640
+ return;
641
+ const userChatId = "user_" + Math.random().toString(36).slice(2).padEnd(10, "0").slice(0, 10);
642
+ const userMessage = {
643
+ chatId: userChatId,
644
+ user: "u",
645
+ type: "text",
646
+ content: inputValue.value,
647
+ files: fileList || [],
648
+ msgList: []
649
+ };
650
+ chatList.value.push(userMessage);
651
+ const index = chatList.value.length - 1;
652
+ vue.nextTick(() => {
653
+ renderContent(userMessage.content, "main", index);
654
+ scrollToBottom();
655
+ });
656
+ openSSE(inputValue.value, index + 1);
657
+ inputValue.value = "";
658
+ };
659
+ const handleStop = () => {
660
+ var _a;
661
+ if (isChating.value) {
662
+ (_a = abortController.value) == null ? void 0 : _a.abort();
663
+ isChating.value = false;
664
+ chatList.value[currIndex.value].isChating = false;
665
+ stop(chatList.value[currIndex.value], currIndex.value);
666
+ }
667
+ };
668
+ const scrollToBottom = () => {
669
+ if (!isMounted.value || isUnmounting.value || !chatContainer.value)
670
+ return;
671
+ vue.nextTick(() => {
672
+ requestAnimationFrame(() => {
673
+ const chatContainerEl = chatContainer.value;
674
+ const lastMessage = chatContainerEl.querySelector(".touchchat-dialog-content > *:last-child");
675
+ if (lastMessage) {
676
+ const { height: messageHeight } = lastMessage.getBoundingClientRect();
677
+ const containerHeight = chatContainerEl.clientHeight;
678
+ const messageBottom = lastMessage.offsetTop + lastMessage.offsetHeight;
679
+ if (messageHeight > containerHeight) {
680
+ chatContainerEl.scrollTop = lastMessage.offsetTop;
681
+ } else {
682
+ chatContainerEl.scrollTop = messageBottom - containerHeight;
683
+ }
684
+ if (scrollObserver.value) {
685
+ scrollObserver.value.disconnect();
686
+ }
687
+ scrollObserver.value = new MutationObserver(() => {
688
+ const updatedMessageBottom = lastMessage.offsetTop + lastMessage.offsetHeight;
689
+ chatContainerEl.scrollTop = Math.max(updatedMessageBottom - containerHeight, chatContainerEl.scrollTop);
690
+ });
691
+ scrollObserver.value.observe(lastMessage, {
692
+ childList: true,
693
+ subtree: true,
694
+ characterData: true,
695
+ attributes: true,
696
+ // 新增监听属性变化(如高度)
697
+ attributeFilter: ["style", "class"]
698
+ // 只监听样式相关属性
699
+ });
700
+ } else {
701
+ chatContainerEl.scrollTo({
702
+ top: chatContainerEl.scrollHeight,
703
+ behavior: "smooth"
704
+ });
705
+ }
706
+ });
707
+ });
708
+ };
709
+ const handleMessageAction = (action, index) => {
710
+ const message = chatList.value[index];
711
+ if (!message)
712
+ return;
713
+ switch (action) {
714
+ case types.MessageAction.COPY: {
715
+ copyToClipboard(message.content, "\u590D\u5236\u6210\u529F", "\u590D\u5236\u5931\u8D25");
716
+ break;
717
+ }
718
+ case types.MessageAction.EDIT:
719
+ message.isEditing = true;
720
+ message.editContent = message.content;
721
+ break;
722
+ case types.MessageAction.DELETE:
723
+ messageUtils.deleteMessageChain(index);
724
+ emit("sendMessage", chatList.value);
725
+ break;
726
+ case types.MessageAction.RETRY: {
727
+ const aiMessage = chatList.value[index];
728
+ const userMessageIndex = index - 1;
729
+ const userMessage = chatList.value[userMessageIndex];
730
+ if (userMessage && userMessage.user === "u") {
731
+ const updatedAiMessage = {
732
+ ...aiMessage,
733
+ content: "",
734
+ thinkContent: "",
735
+ reasoningContent: "",
736
+ isLiked: false,
737
+ isDisliked: false,
738
+ isChating: true,
739
+ chatId: aiMessage.chatId,
740
+ user: aiMessage.user,
741
+ type: aiMessage.type,
742
+ thinkStatus: types.ThinkStatus.COMPLETED,
743
+ thinkStartTime: 0,
744
+ thinkEndTime: 0
745
+ };
746
+ chatList.value.splice(index, 1, updatedAiMessage);
747
+ vue.nextTick(() => {
748
+ if (htmlContentRef.value[index])
749
+ htmlContentRef.value[index].innerHTML = "";
750
+ if (thinkingContentRef.value[index])
751
+ thinkingContentRef.value[index].innerHTML = "";
752
+ if (reasoningContentRef.value[index])
753
+ reasoningContentRef.value[index].innerHTML = "";
754
+ setTimeout(() => {
755
+ openSSE(userMessage.content || "", index);
756
+ }, 50);
757
+ });
758
+ }
759
+ break;
760
+ }
761
+ case types.MessageAction.LIKE:
762
+ messageUtils.updateMessage(index, {
763
+ isLiked: true,
764
+ isDisliked: false
765
+ });
766
+ break;
767
+ case types.MessageAction.DISLIKE:
768
+ messageUtils.updateMessage(index, {
769
+ isLiked: false,
770
+ isDisliked: true
771
+ });
772
+ break;
773
+ }
774
+ };
775
+ const saveEdit = (index, newContent) => {
776
+ const message = chatList.value[index];
777
+ if (!message || !message.editContent)
778
+ return;
779
+ chatList.value[index] = {
780
+ ...message,
781
+ content: newContent,
782
+ isEditing: false,
783
+ editContent: void 0
784
+ };
785
+ vue.nextTick(() => {
786
+ renderContent(message.content, "main", index);
787
+ });
788
+ if (index + 1 < chatList.value.length && chatList.value[index + 1].user === "ai") {
789
+ chatList.value.splice(index + 1, 1);
790
+ }
791
+ vue.nextTick(() => {
792
+ openSSE(newContent, index + 1);
793
+ });
794
+ emit("sendMessage", chatList.value);
795
+ };
796
+ const cancelEdit = (index) => {
797
+ const message = chatList.value[index];
798
+ if (!message)
799
+ return;
800
+ message.isEditing = false;
801
+ message.editContent = "";
802
+ vue.nextTick(() => {
803
+ renderContent(message.content, "main", index);
804
+ });
805
+ };
806
+ vue.onMounted(async () => {
807
+ init();
808
+ isMounted.value = true;
809
+ iMultiAgentInfo.value.list.forEach((agent) => {
810
+ a2aService.a2aService.registerAgent(agent);
811
+ });
812
+ if (iMultiAgentInfo.value.list.length > 0) {
813
+ selectedAgents.value = [iMultiAgentInfo.value.list[0].id];
814
+ }
815
+ });
816
+ vue.onBeforeUnmount(() => {
817
+ if (!isUnmounting.value) {
818
+ isUnmounting.value = true;
819
+ isMounted.value = false;
820
+ htmlContentRef.value = [];
821
+ thinkingContentRef.value = [];
822
+ reasoningContentRef.value = [];
823
+ }
824
+ if (scrollObserver.value) {
825
+ scrollObserver.value.disconnect();
826
+ scrollObserver.value = null;
827
+ }
828
+ });
829
+ const handleDragEnter = () => {
830
+ if (ChatInputRef.value) {
831
+ ChatInputRef.value.openMarkLayer();
832
+ }
833
+ isDragging.value = true;
834
+ };
835
+ const handleDragLeave = (e) => {
836
+ const rect = e.target.getBoundingClientRect();
837
+ if (e.clientX < rect.left || e.clientX > rect.right || e.clientY < rect.top || e.clientY > rect.bottom) {
838
+ isDragging.value = false;
839
+ }
840
+ };
841
+ const handleDrop = async (e) => {
842
+ var _a;
843
+ isDragging.value = false;
844
+ const files = (_a = e.dataTransfer) == null ? void 0 : _a.files;
845
+ if (files && files.length > 0) {
846
+ const fileList = await Promise.all(
847
+ Array.from(files).map(async (file) => {
848
+ let base64 = "";
849
+ if (file.type.startsWith("image/")) {
850
+ base64 = await new Promise((resolve) => {
851
+ const reader = new FileReader();
852
+ reader.onload = (e2) => {
853
+ var _a2;
854
+ resolve((_a2 = e2.target) == null ? void 0 : _a2.result);
855
+ };
856
+ reader.readAsDataURL(file);
857
+ });
858
+ }
859
+ return {
860
+ // id: crypto.randomUUID().replace(/-/gi, ''),
861
+ id: Math.random().toString(36).slice(2).padEnd(10, "0").slice(0, 10),
862
+ file,
863
+ name: file.name,
864
+ fileType: file.type,
865
+ fileSize: file.size,
866
+ lastModified: file.lastModified,
867
+ preview: URL.createObjectURL(file),
868
+ base64
869
+ };
870
+ })
871
+ );
872
+ if (ChatInputRef.value) {
873
+ ChatInputRef.value.handlePaste(fileList, "drop");
874
+ }
875
+ }
876
+ if (ChatInputRef.value) {
877
+ ChatInputRef.value.colseMarkLayer();
878
+ }
879
+ };
880
+ const itemUploadFile = (item, index) => {
881
+ console.log("itemUploadFile", item, index);
882
+ if (ChatInputRef.value) {
883
+ ChatInputRef.value.itemUploadFile(index, "drop");
884
+ }
885
+ };
886
+ vue.provide("touchchat", {
887
+ send: sendMessage,
888
+ retry: handleMessageAction
889
+ });
890
+ __expose({
891
+ send: (value, fileList, auto, type) => {
892
+ handleSend(value, fileList, auto, type);
893
+ },
894
+ retry: (index) => {
895
+ handleMessageAction(types.MessageAction.RETRY, index);
896
+ },
897
+ update
898
+ });
899
+ return (_ctx, _cache) => {
900
+ return vue.openBlock(), vue.createElementBlock("div", {
901
+ class: "touchchat-main",
902
+ onDragover: vue.withModifiers(() => {
903
+ }, ["prevent"]),
904
+ onDragenter: vue.withModifiers(handleDragEnter, ["prevent"]),
905
+ onDragleave: handleDragLeave,
906
+ onDrop: vue.withModifiers(handleDrop, ["prevent"])
907
+ }, [
908
+ vue.createElementVNode(
909
+ "div",
910
+ {
911
+ ref_key: "chatContainer",
912
+ ref: chatContainer,
913
+ class: "touchchat-dialog",
914
+ onScroll: handleScroll
915
+ },
916
+ [
917
+ vue.renderSlot(_ctx.$slots, "top"),
918
+ chatList.value.length === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
919
+ key: 0,
920
+ class: "touchchat-welcome"
921
+ }, [
922
+ vue.renderSlot(_ctx.$slots, "welcome", {}, () => [
923
+ vue.createVNode(HelloChat.default, { onSendMessage: sendMessage })
924
+ ])
925
+ ])) : vue.createCommentVNode("v-if", true),
926
+ vue.createElementVNode("div", { class: "touchchat-dialog-content" }, [
927
+ (vue.openBlock(true), vue.createElementBlock(
928
+ vue.Fragment,
929
+ null,
930
+ vue.renderList(chatList.value, (item, index) => {
931
+ return vue.openBlock(), vue.createElementBlock(
932
+ vue.Fragment,
933
+ {
934
+ key: item.chatId
935
+ },
936
+ [
937
+ item.user === "u" ? (vue.openBlock(), vue.createBlock(UserMessage.default, {
938
+ key: 0,
939
+ item,
940
+ index,
941
+ onUserMessageFileList: itemUploadFile,
942
+ onCopy: ($event) => handleMessageAction(vue.unref(types.MessageAction).COPY, index),
943
+ onEdit: ($event) => handleMessageAction(vue.unref(types.MessageAction).EDIT, index),
944
+ onDelete: ($event) => handleMessageAction(vue.unref(types.MessageAction).DELETE, index),
945
+ onSaveEdit: saveEdit,
946
+ onCancelEdit: ($event) => cancelEdit(index)
947
+ }, {
948
+ userAvatar: vue.withCtx(() => [
949
+ vue.renderSlot(_ctx.$slots, "userAvatar")
950
+ ]),
951
+ fn: vue.withCtx(() => [
952
+ vue.renderSlot(_ctx.$slots, "fn", {
953
+ item,
954
+ index
955
+ })
956
+ ]),
957
+ _: 2
958
+ /* DYNAMIC */
959
+ }, 1032, ["item", "index", "onCopy", "onEdit", "onDelete", "onCancelEdit"])) : (vue.openBlock(), vue.createBlock(AiMessage.default, {
960
+ key: 1,
961
+ item,
962
+ index,
963
+ "has-retry": true,
964
+ onCopy: ($event) => handleMessageAction(vue.unref(types.MessageAction).COPY, index),
965
+ onRetry: ($event) => handleMessageAction(vue.unref(types.MessageAction).RETRY, index),
966
+ onLike: ($event) => handleMessageAction(vue.unref(types.MessageAction).LIKE, index),
967
+ onDislike: ($event) => handleMessageAction(vue.unref(types.MessageAction).DISLIKE, index),
968
+ onContentRendered: attachCopyButtons,
969
+ onCompleteRendered: (chatId) => completeRendered(chatId),
970
+ onToggleSidebar: toggleSidebarClick
971
+ }, {
972
+ aimsg: vue.withCtx(() => [
973
+ vue.renderSlot(_ctx.$slots, "aimsg", {
974
+ item,
975
+ index
976
+ })
977
+ ]),
978
+ msg: vue.withCtx(() => [
979
+ vue.renderSlot(_ctx.$slots, "msg", {
980
+ item,
981
+ index
982
+ })
983
+ ]),
984
+ aiAvatar: vue.withCtx(() => [
985
+ vue.renderSlot(_ctx.$slots, "aiAvatar")
986
+ ]),
987
+ fn: vue.withCtx(() => [
988
+ vue.renderSlot(_ctx.$slots, "fn", {
989
+ item,
990
+ index
991
+ })
992
+ ]),
993
+ extendsFn: vue.withCtx(() => [
994
+ vue.renderSlot(_ctx.$slots, "extendsFn", {
995
+ item,
996
+ index
997
+ })
998
+ ]),
999
+ _: 2
1000
+ /* DYNAMIC */
1001
+ }, 1032, ["item", "index", "onCopy", "onRetry", "onLike", "onDislike", "onCompleteRendered"]))
1002
+ ],
1003
+ 64
1004
+ /* STABLE_FRAGMENT */
1005
+ );
1006
+ }),
1007
+ 128
1008
+ /* KEYED_FRAGMENT */
1009
+ ))
1010
+ ])
1011
+ ],
1012
+ 544
1013
+ /* NEED_HYDRATION, NEED_PATCH */
1014
+ ),
1015
+ _ctx.$slots.shortcut ? (vue.openBlock(), vue.createElementBlock("div", {
1016
+ key: 0,
1017
+ class: "touchchat-edit-shortcut"
1018
+ }, [
1019
+ vue.renderSlot(_ctx.$slots, "shortcut")
1020
+ ])) : vue.createCommentVNode("v-if", true),
1021
+ vue.renderSlot(_ctx.$slots, "edit", {}, () => [
1022
+ vue.createVNode(ChatInput.default, {
1023
+ ref_key: "ChatInputRef",
1024
+ ref: ChatInputRef,
1025
+ "input-value": inputValue.value,
1026
+ "onUpdate:inputValue": ($event) => inputValue.value = $event,
1027
+ "is-chating": isChating.value,
1028
+ onSend: handleBeforeSend,
1029
+ onStop: handleStop
1030
+ }, null, 8, ["input-value", "onUpdate:inputValue", "is-chating"])
1031
+ ])
1032
+ ], 40, ["onDragover"]);
1033
+ };
1034
+ }
1035
+ });
1036
+
1037
+ exports.default = _sfc_main;
1038
+ //# sourceMappingURL=TouchAgent.vue2.js.map