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