@datawhale/prosemirror-render 0.0.1

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 (287) hide show
  1. package/dist/AttachmentBlock-ChMNTUOo.mjs +351 -0
  2. package/dist/AttachmentBlock-DsmJP3Kw.js +1 -0
  3. package/dist/AttachmentInline-Dc3dp0g-.js +1 -0
  4. package/dist/AttachmentInline-tbC8BJBy.mjs +52 -0
  5. package/dist/AttachmentMenu-B5x8P9_n.mjs +541 -0
  6. package/dist/AttachmentMenu-ExoCOe4B.js +1 -0
  7. package/dist/Blockquote-BamWUQND.mjs +15 -0
  8. package/dist/Blockquote-CQSBFnsu.js +1 -0
  9. package/dist/BulletList-BQTUD69X.mjs +15 -0
  10. package/dist/BulletList-CFjF3U-l.js +1 -0
  11. package/dist/Callout-Cu6HI-xq.mjs +28 -0
  12. package/dist/Callout-DPdOqTb4.js +1 -0
  13. package/dist/CellOutput-C33VK0df.mjs +981 -0
  14. package/dist/CellOutput-DiKZlIFa.js +6 -0
  15. package/dist/CodeBlock-Cjuxuq7B.mjs +8359 -0
  16. package/dist/CodeBlock-DWniNUQB.js +148 -0
  17. package/dist/Doc-6s4VMDsx.mjs +15 -0
  18. package/dist/Doc-D2yvlSII.js +1 -0
  19. package/dist/FoldBlock-DRdlU-DX.mjs +75 -0
  20. package/dist/FoldBlock-ZPMf0QsR.js +1 -0
  21. package/dist/Grid-GfmJxM93.mjs +31 -0
  22. package/dist/Grid-QToZdaRT.js +1 -0
  23. package/dist/HardBreak-B2tFO31P.mjs +13 -0
  24. package/dist/HardBreak-Dbf5Zg5o.js +1 -0
  25. package/dist/Heading-BElRvhGn.mjs +21 -0
  26. package/dist/Heading-BUnffIAz.js +1 -0
  27. package/dist/HorizontalRule-BRG45oT0.mjs +13 -0
  28. package/dist/HorizontalRule-CE09LZGf.js +1 -0
  29. package/dist/IFrame-CaAOVLGN.mjs +17 -0
  30. package/dist/IFrame-DcCpSoDC.js +1 -0
  31. package/dist/Image-C8v5dCij.mjs +105 -0
  32. package/dist/Image-cHL85CXs.js +1 -0
  33. package/dist/ListItem-BrjxeGxz.js +1 -0
  34. package/dist/ListItem-X0T7a_z8.mjs +15 -0
  35. package/dist/MathDisplay-CESKZV46.js +1 -0
  36. package/dist/MathDisplay-CoGsFzXW.mjs +30 -0
  37. package/dist/MathInline-0xTZoIIq.mjs +30 -0
  38. package/dist/MathInline-C_1SJUVz.js +1 -0
  39. package/dist/McChoices-Aj394G5E.mjs +52 -0
  40. package/dist/McChoices-B4euzY7M.js +1 -0
  41. package/dist/McQuestion-Dq0aM5tC.js +1 -0
  42. package/dist/McQuestion-DvD-J47M.mjs +38 -0
  43. package/dist/McSolution-C5sTXz3y.mjs +24 -0
  44. package/dist/McSolution-N79CllH9.js +1 -0
  45. package/dist/MultipleChoice-DTCF3Q8m.js +1 -0
  46. package/dist/MultipleChoice-Dv-k1zUU.mjs +47 -0
  47. package/dist/OrderedList-B8v1gchv.mjs +17 -0
  48. package/dist/OrderedList-DMl3tvwP.js +1 -0
  49. package/dist/Paragraph-CzRSCJNr.js +1 -0
  50. package/dist/Paragraph-DGcZy8t_.mjs +16 -0
  51. package/dist/SlotNode-6OpoUcOa.mjs +10 -0
  52. package/dist/SlotNode-DMG0R6Vf.js +1 -0
  53. package/dist/TableCell-BY9gdldc.js +1 -0
  54. package/dist/TableCell-Bp52L368.mjs +20 -0
  55. package/dist/TableContainer-C5KXY6f7.js +1 -0
  56. package/dist/TableContainer-C9PhNGlz.mjs +29 -0
  57. package/dist/TableHeader-BTuqvorM.js +1 -0
  58. package/dist/TableHeader-C7KKz3e1.mjs +17 -0
  59. package/dist/TableRow-D4F6AKFt.js +1 -0
  60. package/dist/TableRow-OzpVq1qW.mjs +15 -0
  61. package/dist/Text-Br_pcGz4.mjs +78 -0
  62. package/dist/Text-DlUfrsNI.js +1 -0
  63. package/dist/emoji-Bk6FG72F.js +1 -0
  64. package/dist/emoji-CmOToDEU.mjs +3711 -0
  65. package/dist/index-D2CtpNvR.js +1 -0
  66. package/dist/index-DVmWCrQE.mjs +159 -0
  67. package/dist/index.cjs.js +1 -0
  68. package/dist/index.es.js +4 -0
  69. package/dist/katex-CS0ZfoxP.js +261 -0
  70. package/dist/katex-r9TeExgs.mjs +11690 -0
  71. package/dist/prosemirror-render.css +1 -0
  72. package/dist/types/apis/monitor.d.ts +9 -0
  73. package/dist/types/apis/tingwu.d.ts +14 -0
  74. package/dist/types/apis/types.d.ts +23 -0
  75. package/dist/types/components/TreeRecursive.vue.d.ts +7 -0
  76. package/dist/types/components/TreeRender.vue.d.ts +9 -0
  77. package/dist/types/components/collections/async/AsyncError.vue.d.ts +3 -0
  78. package/dist/types/components/collections/async/AsyncLoading.vue.d.ts +3 -0
  79. package/dist/types/components/collections/attachment/AttachmentBlock.vue.d.ts +7 -0
  80. package/dist/types/components/collections/attachment/AttachmentInline.vue.d.ts +7 -0
  81. package/dist/types/components/collections/attachment/AttachmentMenu.vue.d.ts +16 -0
  82. package/dist/types/components/collections/attachment/VideoDetail.vue.d.ts +7 -0
  83. package/dist/types/components/collections/attachment/index.d.ts +1 -0
  84. package/dist/types/components/collections/basic/Blockquote.vue.d.ts +17 -0
  85. package/dist/types/components/collections/basic/BulletList.vue.d.ts +17 -0
  86. package/dist/types/components/collections/basic/HardBreak.vue.d.ts +7 -0
  87. package/dist/types/components/collections/basic/Heading.vue.d.ts +17 -0
  88. package/dist/types/components/collections/basic/HorizontalRule.vue.d.ts +7 -0
  89. package/dist/types/components/collections/basic/ListItem.vue.d.ts +17 -0
  90. package/dist/types/components/collections/basic/OrderedList.vue.d.ts +17 -0
  91. package/dist/types/components/collections/basic/Paragraph.vue.d.ts +17 -0
  92. package/dist/types/components/collections/basic/Text.vue.d.ts +7 -0
  93. package/dist/types/components/collections/basic/index.d.ts +1 -0
  94. package/dist/types/components/collections/callout/Callout.vue.d.ts +7 -0
  95. package/dist/types/components/collections/callout/index.d.ts +1 -0
  96. package/dist/types/components/collections/code/CellOutput.vue.d.ts +7 -0
  97. package/dist/types/components/collections/code/CodeBlock.vue.d.ts +7 -0
  98. package/dist/types/components/collections/code/index.d.ts +1 -0
  99. package/dist/types/components/collections/fold/FoldBlock.vue.d.ts +7 -0
  100. package/dist/types/components/collections/fold/index.d.ts +1 -0
  101. package/dist/types/components/collections/grid/Grid.vue.d.ts +7 -0
  102. package/dist/types/components/collections/grid/index.d.ts +1 -0
  103. package/dist/types/components/collections/iframe/IFrame.vue.d.ts +7 -0
  104. package/dist/types/components/collections/iframe/index.d.ts +1 -0
  105. package/dist/types/components/collections/img/Image.vue.d.ts +7 -0
  106. package/dist/types/components/collections/img/index.d.ts +1 -0
  107. package/dist/types/components/collections/index.d.ts +1 -0
  108. package/dist/types/components/collections/math/MathDisplay.vue.d.ts +7 -0
  109. package/dist/types/components/collections/math/MathInline.vue.d.ts +7 -0
  110. package/dist/types/components/collections/math/index.d.ts +1 -0
  111. package/dist/types/components/collections/multipleChoice/McChoices.vue.d.ts +16 -0
  112. package/dist/types/components/collections/multipleChoice/McQuestion.vue.d.ts +7 -0
  113. package/dist/types/components/collections/multipleChoice/McSolution.vue.d.ts +8 -0
  114. package/dist/types/components/collections/multipleChoice/MultipleChoice.vue.d.ts +7 -0
  115. package/dist/types/components/collections/multipleChoice/index.d.ts +1 -0
  116. package/dist/types/components/collections/table/TableCell.vue.d.ts +17 -0
  117. package/dist/types/components/collections/table/TableContainer.vue.d.ts +17 -0
  118. package/dist/types/components/collections/table/TableHeader.vue.d.ts +17 -0
  119. package/dist/types/components/collections/table/TableRow.vue.d.ts +17 -0
  120. package/dist/types/components/collections/table/index.d.ts +1 -0
  121. package/dist/types/components/collections/utils.d.ts +2 -0
  122. package/dist/types/components/collections/wrapper/Doc.vue.d.ts +17 -0
  123. package/dist/types/components/collections/wrapper/SlotNode.vue.d.ts +13 -0
  124. package/dist/types/components/collections/wrapper/index.d.ts +1 -0
  125. package/dist/types/components/index.d.ts +1 -0
  126. package/dist/types/icons/Attachment/CardView.vue.d.ts +9 -0
  127. package/dist/types/icons/Attachment/Code/Bat.vue.d.ts +3 -0
  128. package/dist/types/icons/Attachment/Code/C.vue.d.ts +3 -0
  129. package/dist/types/icons/Attachment/Code/Cpp.vue.d.ts +3 -0
  130. package/dist/types/icons/Attachment/Code/Css.vue.d.ts +3 -0
  131. package/dist/types/icons/Attachment/Code/Go.vue.d.ts +3 -0
  132. package/dist/types/icons/Attachment/Code/Html.vue.d.ts +3 -0
  133. package/dist/types/icons/Attachment/Code/Java.vue.d.ts +3 -0
  134. package/dist/types/icons/Attachment/Code/Js.vue.d.ts +3 -0
  135. package/dist/types/icons/Attachment/Code/Json.vue.d.ts +3 -0
  136. package/dist/types/icons/Attachment/Code/Jsx.vue.d.ts +3 -0
  137. package/dist/types/icons/Attachment/Code/Md.vue.d.ts +3 -0
  138. package/dist/types/icons/Attachment/Code/Php.vue.d.ts +3 -0
  139. package/dist/types/icons/Attachment/Code/Python.vue.d.ts +3 -0
  140. package/dist/types/icons/Attachment/Code/Rb.vue.d.ts +3 -0
  141. package/dist/types/icons/Attachment/Code/Sh.vue.d.ts +3 -0
  142. package/dist/types/icons/Attachment/Code/Sql.vue.d.ts +3 -0
  143. package/dist/types/icons/Attachment/Code/Swift.vue.d.ts +3 -0
  144. package/dist/types/icons/Attachment/Code/Ts.vue.d.ts +3 -0
  145. package/dist/types/icons/Attachment/Code/Tsx.vue.d.ts +3 -0
  146. package/dist/types/icons/Attachment/Code/Vue.vue.d.ts +3 -0
  147. package/dist/types/icons/Attachment/Excel.vue.d.ts +3 -0
  148. package/dist/types/icons/Attachment/Eye.vue.d.ts +3 -0
  149. package/dist/types/icons/Attachment/FullScreen.vue.d.ts +3 -0
  150. package/dist/types/icons/Attachment/InlineView.vue.d.ts +9 -0
  151. package/dist/types/icons/Attachment/Pdf.vue.d.ts +3 -0
  152. package/dist/types/icons/Attachment/Ppt.vue.d.ts +3 -0
  153. package/dist/types/icons/Attachment/PreviewView.vue.d.ts +9 -0
  154. package/dist/types/icons/Attachment/UnknownFile.vue.d.ts +3 -0
  155. package/dist/types/icons/Attachment/VideoIcon.vue.d.ts +3 -0
  156. package/dist/types/icons/Attachment/VideoPlay.vue.d.ts +3 -0
  157. package/dist/types/icons/Attachment/Word.vue.d.ts +3 -0
  158. package/dist/types/icons/Code/Confirm.vue.d.ts +3 -0
  159. package/dist/types/icons/Code/Paste.vue.d.ts +3 -0
  160. package/dist/types/icons/Common/Choice.vue.d.ts +3 -0
  161. package/dist/types/icons/Common/Close.vue.d.ts +3 -0
  162. package/dist/types/icons/Common/Comment.vue.d.ts +3 -0
  163. package/dist/types/icons/Common/CopyAnchorLink.vue.d.ts +3 -0
  164. package/dist/types/icons/Common/Delete.vue.d.ts +3 -0
  165. package/dist/types/icons/Common/Download.vue.d.ts +3 -0
  166. package/dist/types/icons/Common/FoldClose.vue.d.ts +3 -0
  167. package/dist/types/icons/Common/FoldOpen.vue.d.ts +3 -0
  168. package/dist/types/icons/Common/Plate.vue.d.ts +3 -0
  169. package/dist/types/icons/Common/Question.vue.d.ts +3 -0
  170. package/dist/types/icons/Common/ShareTextLink.vue.d.ts +3 -0
  171. package/dist/types/index.d.ts +2 -0
  172. package/dist/types/types.d.ts +269 -0
  173. package/dist/types/utils/common.d.ts +1 -0
  174. package/dist/types/utils/emoji.d.ts +10 -0
  175. package/dist/types/utils/globalStatus.d.ts +16 -0
  176. package/dist/types/utils/shiki.d.ts +3 -0
  177. package/dist/types/utils/useAttachment.d.ts +8 -0
  178. package/package.json +29 -0
  179. package/src/apis/monitor.ts +8 -0
  180. package/src/apis/tingwu.ts +22 -0
  181. package/src/apis/types.ts +45 -0
  182. package/src/components/TreeRecursive.vue +47 -0
  183. package/src/components/TreeRender.vue +404 -0
  184. package/src/components/collections/async/AsyncError.vue +17 -0
  185. package/src/components/collections/async/AsyncLoading.vue +1 -0
  186. package/src/components/collections/attachment/AttachmentBlock.vue +561 -0
  187. package/src/components/collections/attachment/AttachmentInline.vue +90 -0
  188. package/src/components/collections/attachment/AttachmentMenu.vue +359 -0
  189. package/src/components/collections/attachment/VideoDetail.vue +375 -0
  190. package/src/components/collections/attachment/index.ts +6 -0
  191. package/src/components/collections/basic/Blockquote.vue +15 -0
  192. package/src/components/collections/basic/BulletList.vue +15 -0
  193. package/src/components/collections/basic/HardBreak.vue +11 -0
  194. package/src/components/collections/basic/Heading.vue +15 -0
  195. package/src/components/collections/basic/HorizontalRule.vue +11 -0
  196. package/src/components/collections/basic/ListItem.vue +15 -0
  197. package/src/components/collections/basic/OrderedList.vue +15 -0
  198. package/src/components/collections/basic/Paragraph.vue +19 -0
  199. package/src/components/collections/basic/Text.vue +73 -0
  200. package/src/components/collections/basic/index.ts +13 -0
  201. package/src/components/collections/callout/Callout.vue +77 -0
  202. package/src/components/collections/callout/index.ts +5 -0
  203. package/src/components/collections/code/CellOutput.vue +72 -0
  204. package/src/components/collections/code/CodeBlock.vue +83 -0
  205. package/src/components/collections/code/index.ts +6 -0
  206. package/src/components/collections/fold/FoldBlock.vue +130 -0
  207. package/src/components/collections/fold/index.ts +5 -0
  208. package/src/components/collections/grid/Grid.vue +70 -0
  209. package/src/components/collections/grid/index.ts +5 -0
  210. package/src/components/collections/iframe/IFrame.vue +19 -0
  211. package/src/components/collections/iframe/index.ts +5 -0
  212. package/src/components/collections/img/Image.vue +318 -0
  213. package/src/components/collections/img/index.ts +5 -0
  214. package/src/components/collections/index.ts +29 -0
  215. package/src/components/collections/math/MathDisplay.vue +42 -0
  216. package/src/components/collections/math/MathInline.vue +42 -0
  217. package/src/components/collections/math/index.ts +6 -0
  218. package/src/components/collections/multipleChoice/McChoices.vue +72 -0
  219. package/src/components/collections/multipleChoice/McQuestion.vue +61 -0
  220. package/src/components/collections/multipleChoice/McSolution.vue +47 -0
  221. package/src/components/collections/multipleChoice/MultipleChoice.vue +62 -0
  222. package/src/components/collections/multipleChoice/index.ts +8 -0
  223. package/src/components/collections/table/TableCell.vue +20 -0
  224. package/src/components/collections/table/TableContainer.vue +32 -0
  225. package/src/components/collections/table/TableHeader.vue +15 -0
  226. package/src/components/collections/table/TableRow.vue +15 -0
  227. package/src/components/collections/table/index.ts +8 -0
  228. package/src/components/collections/utils.ts +17 -0
  229. package/src/components/collections/wrapper/Doc.vue +15 -0
  230. package/src/components/collections/wrapper/SlotNode.vue +5 -0
  231. package/src/components/collections/wrapper/index.ts +6 -0
  232. package/src/components/index.ts +1 -0
  233. package/src/icons/Attachment/CardView.vue +21 -0
  234. package/src/icons/Attachment/Code/Bat.vue +26 -0
  235. package/src/icons/Attachment/Code/C.vue +26 -0
  236. package/src/icons/Attachment/Code/Cpp.vue +26 -0
  237. package/src/icons/Attachment/Code/Css.vue +34 -0
  238. package/src/icons/Attachment/Code/Go.vue +26 -0
  239. package/src/icons/Attachment/Code/Html.vue +34 -0
  240. package/src/icons/Attachment/Code/Java.vue +42 -0
  241. package/src/icons/Attachment/Code/Js.vue +26 -0
  242. package/src/icons/Attachment/Code/Json.vue +26 -0
  243. package/src/icons/Attachment/Code/Jsx.vue +30 -0
  244. package/src/icons/Attachment/Code/Md.vue +26 -0
  245. package/src/icons/Attachment/Code/Php.vue +26 -0
  246. package/src/icons/Attachment/Code/Python.vue +30 -0
  247. package/src/icons/Attachment/Code/Rb.vue +26 -0
  248. package/src/icons/Attachment/Code/Sh.vue +30 -0
  249. package/src/icons/Attachment/Code/Sql.vue +30 -0
  250. package/src/icons/Attachment/Code/Swift.vue +26 -0
  251. package/src/icons/Attachment/Code/Ts.vue +26 -0
  252. package/src/icons/Attachment/Code/Tsx.vue +30 -0
  253. package/src/icons/Attachment/Code/Vue.vue +24 -0
  254. package/src/icons/Attachment/Excel.vue +26 -0
  255. package/src/icons/Attachment/Eye.vue +15 -0
  256. package/src/icons/Attachment/FullScreen.vue +15 -0
  257. package/src/icons/Attachment/InlineView.vue +21 -0
  258. package/src/icons/Attachment/Pdf.vue +25 -0
  259. package/src/icons/Attachment/Ppt.vue +26 -0
  260. package/src/icons/Attachment/PreviewView.vue +21 -0
  261. package/src/icons/Attachment/UnknownFile.vue +26 -0
  262. package/src/icons/Attachment/VideoIcon.vue +25 -0
  263. package/src/icons/Attachment/VideoPlay.vue +15 -0
  264. package/src/icons/Attachment/Word.vue +26 -0
  265. package/src/icons/Code/Confirm.vue +38 -0
  266. package/src/icons/Code/Paste.vue +8 -0
  267. package/src/icons/Common/Choice.vue +28 -0
  268. package/src/icons/Common/Close.vue +15 -0
  269. package/src/icons/Common/Comment.vue +16 -0
  270. package/src/icons/Common/CopyAnchorLink.vue +15 -0
  271. package/src/icons/Common/Delete.vue +15 -0
  272. package/src/icons/Common/Download.vue +15 -0
  273. package/src/icons/Common/FoldClose.vue +9 -0
  274. package/src/icons/Common/FoldOpen.vue +9 -0
  275. package/src/icons/Common/Plate.vue +23 -0
  276. package/src/icons/Common/Question.vue +8 -0
  277. package/src/icons/Common/ShareTextLink.vue +15 -0
  278. package/src/index.ts +3 -0
  279. package/src/types.ts +236 -0
  280. package/src/utils/common.ts +6 -0
  281. package/src/utils/emoji.ts +3715 -0
  282. package/src/utils/globalStatus.ts +19 -0
  283. package/src/utils/shiki.ts +25 -0
  284. package/src/utils/useAttachment.ts +215 -0
  285. package/tsconfig.build.json +10 -0
  286. package/tsconfig.json +23 -0
  287. package/vite.config.ts +24 -0
@@ -0,0 +1,375 @@
1
+ <template>
2
+ <div class="ai-panel">
3
+ <div class="panel-header">
4
+ <div class="header-title">
5
+ <span class="icon">🤖</span>
6
+ <span>智能分析结果</span>
7
+ </div>
8
+ <button class="close-btn" @click="$emit('close')" title="关闭助手">
9
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
10
+ <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
11
+ </svg>
12
+ </button>
13
+ </div>
14
+
15
+ <div v-if="loading" class="panel-loading">
16
+ <div class="spinner"></div>
17
+ <p>正在生成分析结果...</p>
18
+ </div>
19
+
20
+ <div v-else-if="error" class="panel-error">
21
+ {{ error }}
22
+ </div>
23
+
24
+ <div v-else class="panel-content">
25
+ <div class="content-card summary-card" v-if="analysis?.summary">
26
+ <div class="card-header">
27
+ <span class="card-title">全文摘要</span>
28
+ </div>
29
+ <div class="summary-text" :class="{ expanded: isExpanded }">
30
+ {{ analysis.summary }}
31
+ </div>
32
+ <div class="expand-btn" v-if="analysis.summary.length > 100" @click="isExpanded = !isExpanded">
33
+ {{ isExpanded ? '收起' : '展开全文' }}
34
+ </div>
35
+ </div>
36
+
37
+ <div class="content-card chapters-card">
38
+ <div class="card-header">
39
+ <span class="card-title">章节速览</span>
40
+ <span class="badge">{{ analysis?.chapters?.length || 0 }}</span>
41
+ </div>
42
+
43
+ <div class="chapter-list">
44
+ <div v-for="(chapter, index) in analysis?.chapters || []" :key="index" class="chapter-item"
45
+ @click="seekToChapter(chapter)">
46
+ <div class="chapter-index">{{ index + 1 }}</div>
47
+ <div class="chapter-info">
48
+ <div class="chapter-title">{{ chapter.title }}</div>
49
+ <div class="chapter-time">
50
+ <i class="icon-time">🕒</i>
51
+ {{ formatTime(chapter.startTime) }} - {{ formatTime(chapter.endTime) }}
52
+ </div>
53
+ </div>
54
+ </div>
55
+
56
+ <div v-if="!analysis?.chapters || analysis.chapters.length === 0" class="empty-state">暂无章节信息</div>
57
+ </div>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </template>
62
+
63
+ <script setup lang="ts">
64
+ import { inject, onMounted, ref } from 'vue';
65
+ import { monitorApi } from '@datawhale/dipwap-render/apis/monitor';
66
+ import { videoProgressDetailApi } from '@datawhale/dipwap-render/apis/tingwu';
67
+ import { axiosKey } from '@datawhale/dipwap-render/apis/types';
68
+
69
+ // 接口定义
70
+ interface Chapter {
71
+ title: string;
72
+ startTime: number;
73
+ endTime: number;
74
+ }
75
+ interface Analysis {
76
+ summary?: string;
77
+ chapters?: Chapter[];
78
+ }
79
+
80
+ const props = defineProps<{
81
+ taskId: string;
82
+ videoRef: HTMLVideoElement | null;
83
+ }>();
84
+
85
+ const loading = ref(false);
86
+ const error = ref('');
87
+ const analysis = ref<Analysis | null>(null);
88
+ const isExpanded = ref(false);
89
+
90
+ const service = inject(axiosKey);
91
+
92
+ const loadAnalysis = async () => {
93
+ if (!props.taskId) return;
94
+ if (!service) return;
95
+ loading.value = true;
96
+ try {
97
+ // @ts-ignore
98
+ const data = await videoProgressDetailApi(service, { taskId: props.taskId });
99
+ analysis.value = {
100
+ summary: data.summary,
101
+ chapters: JSON.parse(data.chapters) as { title: string; startTime: number; endTime: number }[],
102
+ };
103
+ loading.value = false;
104
+ } catch (e) {
105
+ error.value = '加载失败';
106
+ loading.value = false;
107
+ console.error(e);
108
+ }
109
+ };
110
+
111
+ const seekToChapter = async (chapter: Chapter) => {
112
+ if (props.videoRef) {
113
+ props.videoRef.currentTime = chapter.startTime;
114
+ void props.videoRef.play();
115
+ }
116
+ if (service) {
117
+ // @ts-ignore
118
+ await monitorApi(service, {
119
+ log: JSON.stringify({
120
+ name: 'toggleVideoAiPanelSidebar',
121
+ chapterTitle: chapter.title,
122
+ tingwuTaskId: props.taskId,
123
+ videoPageUrl: window.location.href,
124
+ }),
125
+ });
126
+ }
127
+ };
128
+
129
+ const formatTime = (seconds: number) => {
130
+ const m = Math.floor(seconds / 60);
131
+ const s = Math.floor(seconds % 60);
132
+ return `${m}:${s.toString().padStart(2, '0')}`;
133
+ };
134
+
135
+ onMounted(async () => {
136
+ await loadAnalysis();
137
+ });
138
+ </script>
139
+
140
+ <style lang="scss" scoped>
141
+ $primary-color: #2563eb;
142
+ $border-color: #e5e7eb;
143
+ $bg-white: #ffffff;
144
+ $text-main: #111827;
145
+ $text-sub: #6b7280;
146
+ $hover-bg: #f3f4f6;
147
+
148
+ .ai-panel {
149
+ background: $bg-white;
150
+ border-radius: 8px;
151
+ border: 1px solid $border-color;
152
+ height: 100%;
153
+ max-height: 500px;
154
+ display: flex;
155
+ flex-direction: column;
156
+ overflow: hidden;
157
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
158
+ }
159
+
160
+ .panel-header {
161
+ padding: 12px 16px;
162
+ background-color: #eff6ff;
163
+ border-bottom: 1px solid #bfdbfe;
164
+ display: flex;
165
+ justify-content: space-between;
166
+ align-items: center;
167
+
168
+ .header-title {
169
+ font-size: 14px;
170
+ font-weight: 600;
171
+ color: #1e40af;
172
+ display: flex;
173
+ align-items: center;
174
+ gap: 8px;
175
+ }
176
+
177
+ // 新增:关闭按钮样式
178
+ .close-btn {
179
+ background: transparent;
180
+ border: none;
181
+ cursor: pointer;
182
+ color: #60a5fa; // 浅蓝色
183
+ padding: 4px;
184
+ border-radius: 4px;
185
+ display: flex;
186
+ align-items: center;
187
+ justify-content: center;
188
+ transition: all 0.2s;
189
+ width: 24px;
190
+ height: 24px;
191
+
192
+ svg {
193
+ width: 18px;
194
+ height: 18px;
195
+ }
196
+
197
+ &:hover {
198
+ background-color: rgba(255, 255, 255, 0.5);
199
+ color: #1e40af; // 深蓝色
200
+ }
201
+ }
202
+ }
203
+
204
+ // ... 后面的样式保持不变 ...
205
+ .panel-loading,
206
+ .panel-error {
207
+ padding: 32px;
208
+ text-align: center;
209
+ color: $text-sub;
210
+ font-size: 13px;
211
+
212
+ .spinner {
213
+ width: 20px;
214
+ height: 20px;
215
+ border: 2px solid $border-color;
216
+ border-top-color: $primary-color;
217
+ border-radius: 50%;
218
+ margin: 0 auto 12px;
219
+ animation: spin 1s linear infinite;
220
+ }
221
+ }
222
+
223
+ .panel-content {
224
+ flex: 1;
225
+ overflow-y: auto;
226
+ padding: 0;
227
+
228
+ &::-webkit-scrollbar {
229
+ width: 4px;
230
+ }
231
+
232
+ &::-webkit-scrollbar-thumb {
233
+ background: #d1d5db;
234
+ border-radius: 2px;
235
+ }
236
+ }
237
+
238
+ .content-card {
239
+ padding: 16px;
240
+ border-bottom: 1px solid $border-color;
241
+
242
+ &:last-child {
243
+ border-bottom: none;
244
+ }
245
+
246
+ .card-header {
247
+ display: flex;
248
+ justify-content: space-between;
249
+ align-items: center;
250
+ margin-bottom: 12px;
251
+
252
+ .card-title {
253
+ font-size: 13px;
254
+ font-weight: 700;
255
+ color: $text-sub;
256
+ text-transform: uppercase;
257
+ }
258
+
259
+ .badge {
260
+ font-size: 12px;
261
+ background: $hover-bg;
262
+ padding: 2px 6px;
263
+ border-radius: 4px;
264
+ color: $text-sub;
265
+ }
266
+ }
267
+ }
268
+
269
+ .summary-card {
270
+ .summary-text {
271
+ font-size: 14px;
272
+ line-height: 1.6;
273
+ color: #374151;
274
+ text-align: justify;
275
+ display: -webkit-box;
276
+ -webkit-line-clamp: 3;
277
+ -webkit-box-orient: vertical;
278
+ overflow: hidden;
279
+
280
+ &.expanded {
281
+ -webkit-line-clamp: unset;
282
+ overflow: visible;
283
+ }
284
+ }
285
+
286
+ .expand-btn {
287
+ margin-top: 8px;
288
+ font-size: 12px;
289
+ color: $primary-color;
290
+ cursor: pointer;
291
+
292
+ &:hover {
293
+ text-decoration: underline;
294
+ }
295
+ }
296
+ }
297
+
298
+ .chapter-list {
299
+ display: flex;
300
+ flex-direction: column;
301
+ gap: 8px;
302
+ }
303
+
304
+ .chapter-item {
305
+ display: flex;
306
+ gap: 12px;
307
+ padding: 8px;
308
+ border-radius: 6px;
309
+ cursor: pointer;
310
+ border: 1px solid transparent;
311
+ transition: all 0.2s;
312
+
313
+ &:hover {
314
+ background-color: $hover-bg;
315
+ border-color: $border-color;
316
+
317
+ .chapter-index {
318
+ background-color: white;
319
+ color: $primary-color;
320
+ }
321
+
322
+ .chapter-title {
323
+ color: $primary-color;
324
+ }
325
+ }
326
+
327
+ .chapter-index {
328
+ width: 20px;
329
+ height: 20px;
330
+ background-color: #dbeafe;
331
+ color: $primary-color;
332
+ font-size: 11px;
333
+ font-weight: 700;
334
+ display: flex;
335
+ align-items: center;
336
+ justify-content: center;
337
+ border-radius: 4px;
338
+ flex-shrink: 0;
339
+ margin-top: 2px;
340
+ }
341
+
342
+ .chapter-info {
343
+ flex: 1;
344
+ min-width: 0;
345
+
346
+ .chapter-title {
347
+ font-size: 14px;
348
+ font-weight: 500;
349
+ color: #374151;
350
+ margin-bottom: 4px;
351
+ }
352
+
353
+ .chapter-time {
354
+ font-size: 12px;
355
+ color: #9ca3af;
356
+ display: flex;
357
+ align-items: center;
358
+ gap: 4px;
359
+ }
360
+ }
361
+ }
362
+
363
+ .empty-state {
364
+ text-align: center;
365
+ color: #9ca3af;
366
+ font-size: 13px;
367
+ padding: 12px 0;
368
+ }
369
+
370
+ @keyframes spin {
371
+ to {
372
+ transform: rotate(360deg);
373
+ }
374
+ }
375
+ </style>
@@ -0,0 +1,6 @@
1
+ import { customDefineAsyncComponent } from '../utils';
2
+
3
+ export const attachmentMapper: Record<string, any> = {
4
+ 'attachment-inline': customDefineAsyncComponent(() => import('./AttachmentInline.vue')),
5
+ 'attachment-block': customDefineAsyncComponent(() => import('./AttachmentBlock.vue')),
6
+ };
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <blockquote>
3
+ <slot />
4
+ </blockquote>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import type { PMBlockquote } from '@datawhale/dipwap-types/index';
9
+
10
+ defineProps<{
11
+ node: PMBlockquote;
12
+ }>();
13
+ </script>
14
+
15
+ <style scoped></style>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <ul>
3
+ <slot />
4
+ </ul>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import type { PMBulletList } from '@datawhale/dipwap-types/index';
9
+
10
+ defineProps<{
11
+ node: PMBulletList;
12
+ }>();
13
+ </script>
14
+
15
+ <style scoped></style>
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <br />
3
+ </template>
4
+
5
+ <script setup lang="ts">
6
+ import type { PMHardBreak } from '@datawhale/dipwap-types/index';
7
+
8
+ defineProps<{
9
+ node: PMHardBreak;
10
+ }>();
11
+ </script>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <component :id="node.attrs.id" :is="`h${node.attrs.level}`" class="heading">
3
+ <slot />
4
+ </component>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import type { PMHeading } from '@datawhale/dipwap-types/index';
9
+
10
+ defineProps<{
11
+ node: PMHeading;
12
+ }>();
13
+ </script>
14
+
15
+ <style scoped></style>
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <hr />
3
+ </template>
4
+
5
+ <script setup lang="ts">
6
+ import type { PMThematicBreak } from '@datawhale/dipwap-types/index';
7
+
8
+ defineProps<{
9
+ node: PMThematicBreak;
10
+ }>();
11
+ </script>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <li>
3
+ <slot />
4
+ </li>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import type { PMListItem } from '@datawhale/dipwap-types/index';
9
+
10
+ defineProps<{
11
+ node: PMListItem;
12
+ }>();
13
+ </script>
14
+
15
+ <style scoped></style>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <ol :start="node.attrs.start">
3
+ <slot />
4
+ </ol>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import type { PMOrderedList } from '@datawhale/dipwap-types/index';
9
+
10
+ defineProps<{
11
+ node: PMOrderedList;
12
+ }>();
13
+ </script>
14
+
15
+ <style scoped></style>
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <p class="paragraph">
3
+ <slot />
4
+ </p>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import type { PMParagraph } from '@datawhale/dipwap-types/index';
9
+
10
+ defineProps<{
11
+ node: PMParagraph;
12
+ }>();
13
+ </script>
14
+
15
+ <style scoped>
16
+ p:empty::before {
17
+ content: '\00a0';
18
+ }
19
+ </style>
@@ -0,0 +1,73 @@
1
+ <template>
2
+ <template v-if="node.marks?.length && currentMarkType">
3
+ <!-- 每次取第0个mark渲染对应的标签 -->
4
+ <!-- 再取除了第0个以外的其他marks,再加上其他属性,递归地传至下一层 -->
5
+ <component
6
+ v-if="currentMarkType === 'link'"
7
+ :is="currentHTMLType"
8
+ :target="(currentMark as LinkMark).attrs?.href"
9
+ :href="(currentMark as LinkMark).attrs?.href"
10
+ :class="(currentMark as LinkMark).attrs?.class"
11
+ :rel="(currentMark as LinkMark).attrs?.rel"
12
+ >
13
+ <Text :node="{ ...node, marks: node.marks?.slice(1) }" />
14
+ </component>
15
+ <component
16
+ v-else-if="currentMarkType === 'highlight'"
17
+ :is="currentHTMLType"
18
+ :style="{
19
+ ...(currentMark as HighlightMark).attrs,
20
+ color: null,
21
+ 'background-color': (currentMark as HighlightMark).attrs.color,
22
+ }"
23
+ >
24
+ <Text :node="{ ...node, marks: node.marks?.slice(1) }" />
25
+ </component>
26
+ <component
27
+ v-else-if="currentMarkType === 'textStyle'"
28
+ :is="currentHTMLType"
29
+ :style="(currentMark as TextStyleMark).attrs ?? null"
30
+ >
31
+ <Text :node="{ ...node, marks: node.marks?.slice(1) }" />
32
+ </component>
33
+ <component v-else :is="currentHTMLType">
34
+ <Text :node="{ ...node, marks: node.marks?.slice(1) }" />
35
+ </component>
36
+ </template>
37
+ <SlotNode v-else>
38
+ {{ node.text }}
39
+ </SlotNode>
40
+ </template>
41
+
42
+ <script setup lang="ts">
43
+ import { computed } from 'vue';
44
+ import type { HighlightMark, LinkMark, PMText, TextStyleMark } from '@datawhale/dipwap-types/index';
45
+ import SlotNode from '../wrapper/SlotNode.vue';
46
+
47
+ const { node } = defineProps<{
48
+ node: PMText;
49
+ }>();
50
+
51
+ const currentMark = computed(() => {
52
+ return node.marks?.[0];
53
+ });
54
+
55
+ const currentMarkType = computed(() => {
56
+ return currentMark.value?.type;
57
+ });
58
+
59
+ const currentHTMLType = computed(() => {
60
+ return nodeTypeMap[currentMark.value?.type as keyof typeof nodeTypeMap];
61
+ });
62
+
63
+ const nodeTypeMap = {
64
+ bold: 'strong',
65
+ italic: 'em',
66
+ underline: 'u',
67
+ strike: 's',
68
+ highlight: 'mark',
69
+ textStyle: 'span',
70
+ link: 'a',
71
+ code: 'code',
72
+ };
73
+ </script>
@@ -0,0 +1,13 @@
1
+ import { customDefineAsyncComponent } from '../utils';
2
+
3
+ export const basicMapper: Record<string, any> = {
4
+ text: customDefineAsyncComponent(() => import('./Text.vue')),
5
+ paragraph: customDefineAsyncComponent(() => import('./Paragraph.vue')),
6
+ heading: customDefineAsyncComponent(() => import('./Heading.vue')),
7
+ orderedList: customDefineAsyncComponent(() => import('./OrderedList.vue')),
8
+ bulletList: customDefineAsyncComponent(() => import('./BulletList.vue')),
9
+ listItem: customDefineAsyncComponent(() => import('./ListItem.vue')),
10
+ horizontalRule: customDefineAsyncComponent(() => import('./HorizontalRule.vue')),
11
+ blockquote: customDefineAsyncComponent(() => import('./Blockquote.vue')),
12
+ hardBreak: customDefineAsyncComponent(() => import('./HardBreak.vue')),
13
+ };
@@ -0,0 +1,77 @@
1
+ <template>
2
+ <div class="callout-wrapper" :style="{ backgroundColor: node.attrs.bgColor, borderColor: node.attrs.bdColor }">
3
+ <div class="callout-icon">
4
+ {{ node.attrs.emoji ? EMOJI_MAP[node.attrs.emoji] : EMOJI_MAP['whale'] }}
5
+ </div>
6
+ <div class="callout-content">
7
+ <div class="node-view-content">
8
+ <TreeRecursive v-for="child in node.content" :node="child" :key="useId()" />
9
+ </div>
10
+ </div>
11
+ </div>
12
+ </template>
13
+
14
+ <script setup lang="ts">
15
+ import { useId } from 'vue';
16
+ import TreeRecursive from '@datawhale/dipwap-render/components/TreeRecursive.vue';
17
+ import { EMOJI_MAP } from '@datawhale/dipwap-render/utils/emoji';
18
+ import type { PMLarkCallout } from '@datawhale/dipwap-types/index';
19
+
20
+ const { node } = defineProps<{
21
+ node: PMLarkCallout;
22
+ }>();
23
+ </script>
24
+
25
+ <style scoped lang="scss">
26
+ .callout-wrapper {
27
+ position: relative;
28
+ margin: 16px 0;
29
+ padding: 16px;
30
+ border-radius: 6px;
31
+ display: flex;
32
+ flex-direction: row;
33
+ border-width: 1.5px;
34
+ border-style: solid;
35
+ .callout-icon {
36
+ font-size: 22px;
37
+ width: 26px;
38
+ height: 26px;
39
+ display: flex;
40
+ justify-content: center;
41
+ align-items: center;
42
+ cursor: default;
43
+ &:hover {
44
+ background-color: rgba(0, 0, 0, 0.1);
45
+ border-radius: 4px;
46
+ }
47
+ }
48
+ .callout-content {
49
+ padding-left: 12px;
50
+ display: flex;
51
+ justify-content: flex-start;
52
+ flex-direction: column;
53
+ flex: 1;
54
+ min-width: 0;
55
+ overflow-x: auto;
56
+ .node-view-content {
57
+ width: 100%;
58
+ & > :deep(*:first-child),
59
+ & > :deep(ul > li:first-child),
60
+ & > :deep(ul > li:first-child > p:first-child),
61
+ & > :deep(ol > li:first-child),
62
+ & > :deep(ol > li:first-child > p:first-child),
63
+ & > :deep(div:first-child > pre) {
64
+ margin-top: 0;
65
+ }
66
+ & > :deep(*:last-child),
67
+ & > :deep(ul > li:last-child),
68
+ & > :deep(ul > li:last-child > p:last-child),
69
+ & > :deep(ol > li:last-child),
70
+ & > :deep(ol > li:last-child > p:last-child),
71
+ & > :deep(div:last-child > pre) {
72
+ margin-bottom: 0;
73
+ }
74
+ }
75
+ }
76
+ }
77
+ </style>
@@ -0,0 +1,5 @@
1
+ import { customDefineAsyncComponent } from '../utils';
2
+
3
+ export const calloutMapper: Record<string, any> = {
4
+ callout: customDefineAsyncComponent(() => import('./Callout.vue')),
5
+ };