aegon-lv97 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/gen-ai/build-report/chartStreamRefs.ts +227 -0
  2. package/gen-ai/build-report/coherence-check/index.vue +559 -0
  3. package/gen-ai/build-report/components/ReportChapterWorkspace.vue +4571 -0
  4. package/gen-ai/build-report/components/ReportConfigPanel.vue +727 -0
  5. package/gen-ai/build-report/components/ReportGenerateSettingsPanel.vue +2361 -0
  6. package/gen-ai/build-report/components/ReportGeneratingPanel.vue +1765 -0
  7. package/gen-ai/build-report/components/ReportPromptPanel.vue +625 -0
  8. package/gen-ai/build-report/components/ReportSourceFileSummary.vue +665 -0
  9. package/gen-ai/build-report/components/ReportSourcesPanel.vue +1327 -0
  10. package/gen-ai/build-report/components/ReportTemplateDetail.vue +191 -0
  11. package/gen-ai/build-report/components/ReportTemplateEditorFormPanel.vue +667 -0
  12. package/gen-ai/build-report/components/ReportTemplatePicker.vue +302 -0
  13. package/gen-ai/build-report/components/ReportWorkflowSidebar.vue +148 -0
  14. package/gen-ai/build-report/components/paramsSetting.vue +886 -0
  15. package/gen-ai/build-report/components/reportEdit.vue +2283 -0
  16. package/gen-ai/build-report/index.vue +856 -0
  17. package/gen-ai/build-report/report-domain.ts +1133 -0
  18. package/gen-ai/build-report/report-template-data.ts +295 -0
  19. package/gen-ai/build-report/useReportWorkflow.ts +1386 -0
  20. package/gen-ai/common/assets/NotoSans-SC.woff2 +0 -0
  21. package/gen-ai/common/assets/NotoSans-TC.woff2 +0 -0
  22. package/gen-ai/common/assets/NotoSans.woff2 +0 -0
  23. package/gen-ai/common/assets/fonts.css +278 -0
  24. package/gen-ai/common/assets/pagination.css +163 -0
  25. package/gen-ai/common/directives/btnLoading.ts +455 -0
  26. package/gen-ai/common/directives/debounce.ts +98 -0
  27. package/gen-ai/common/directives/index.ts +30 -0
  28. package/gen-ai/common/en.md +417 -0
  29. package/gen-ai/common/index.ts +36 -0
  30. package/gen-ai/common/types/component-expose.ts +9 -0
  31. package/gen-ai/common/utils/api-res-status.ts +7 -0
  32. package/gen-ai/common/utils/navigation.ts +59 -0
  33. package/gen-ai/common/utils/remote-request.ts +45 -0
  34. package/gen-ai/common/utils/scroll.ts +577 -0
  35. package/gen-ai/components/AIExport/docx-export.ts +950 -0
  36. package/gen-ai/components/AIExport/docxExport.ts +2566 -0
  37. package/gen-ai/components/AIExport/index.ts +52 -0
  38. package/gen-ai/components/AIExport/parseMarkdownHtml.ts +653 -0
  39. package/gen-ai/components/CapsuleScrollbar.vue +149 -0
  40. package/gen-ai/components/ChapterTitleScroll.vue +468 -0
  41. package/gen-ai/components/EntryHeroNavCards.vue +379 -0
  42. package/gen-ai/components/GenAiPagination.vue +52 -0
  43. package/gen-ai/components/ModelCard.vue +1114 -0
  44. package/gen-ai/components/Preview/FilePreviewPage.vue +949 -0
  45. package/gen-ai/components/Preview/PreviewCapsuleScroll.vue +205 -0
  46. package/gen-ai/components/Preview/PreviewOutlineTree.vue +148 -0
  47. package/gen-ai/components/Preview/index.ts +11 -0
  48. package/gen-ai/components/Preview/preview.ts +724 -0
  49. package/gen-ai/components/PromptField.vue +505 -0
  50. package/gen-ai/components/RecentReportsTable.vue +974 -0
  51. package/gen-ai/components/ReportCollapsibleSection.vue +172 -0
  52. package/gen-ai/components/ReportHistoryList.vue +637 -0
  53. package/gen-ai/components/ReportSectionConfirmPopover.vue +251 -0
  54. package/gen-ai/components/editor/ChapterTiptapEditor.vue +3718 -0
  55. package/gen-ai/components/editor/StructureBlockView.vue +441 -0
  56. package/gen-ai/components/editor/TiptapToolbar.vue +1036 -0
  57. package/gen-ai/components/editor/TypewriterDocEditor.vue +422 -0
  58. package/gen-ai/components/editor/_StructureOrgNode.vue +326 -0
  59. package/gen-ai/components/editor/index.ts +28 -0
  60. package/gen-ai/components/editor/parseMarkdownHtml.ts +754 -0
  61. package/gen-ai/components/editor/reviewCitationTip.ts +163 -0
  62. package/gen-ai/gen-entry/api/index.ts +32 -0
  63. package/gen-ai/gen-entry/index.vue +287 -0
  64. package/gen-ai/gen-entry/types/index.ts +4 -0
  65. package/gen-ai/i.mark +2 -0
  66. package/gen-ai/management-center/index.vue +1815 -0
  67. package/gen-ai/management-center/mockData.ts +248 -0
  68. package/gen-ai/management-center/types/index.ts +37 -0
  69. package/gen-ai/model-manager/TemplateEditorFormPanel.vue +661 -0
  70. package/gen-ai/model-manager/api/index.ts +32 -0
  71. package/gen-ai/model-manager/api/mockApi.ts +33 -0
  72. package/gen-ai/model-manager/index.vue +1583 -0
  73. package/gen-ai/model-manager/mockData.ts +177 -0
  74. package/gen-ai/model-manager/template-detail-shared.ts +154 -0
  75. package/gen-ai/model-manager/template-editor.vue +345 -0
  76. package/gen-ai/model-manager/types/index.ts +40 -0
  77. package/gen-ai/model-manager/utils.ts +25 -0
  78. package/package.json +12 -0
@@ -0,0 +1,227 @@
1
+ /**
2
+ * //0918 tip / 預覽
3
+ *
4
+ * 点击「生成章节内容」后:
5
+ * 1. 清空 SSERefList
6
+ * 2. 每条 event:REF → SSERefList.push(REF对象)
7
+ * 3. 打字机处理 event:message 正文时,用 [ref:{chunkId}] 匹配 SSERefList[].chunkId
8
+ * 命中 → tip + popup;未命中 → 过滤
9
+ *
10
+ * // 0924 getSectionVersionList / AdjustInstance.refList 字段:
11
+ * index / chunkId / filePath / filePreviewUrl / sourcePage / sourceName / sourceText / sourceType / knowledgeType / score
12
+ * refList 可为数组,或同样结构的 JSON 字符串
13
+ */
14
+ // 0924
15
+ export type ChartStreamRefItem = {
16
+ chunkId: string
17
+ filePath: string
18
+ filePreviewUrl: string
19
+ index: number
20
+ sourceName: string
21
+ sourceText: string
22
+ sourcePage: string
23
+ sourceType: string
24
+ knowledgeType: string
25
+ score: string
26
+ }
27
+
28
+ const STORAGE_KEY = 'gen-ai-chart-stream-refs'
29
+ const CHUNK_ID_RE =
30
+ /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i
31
+
32
+ /** 点击生成章节内容后,SSE event:REF 全部 push 进此数组 */
33
+ export const SSERefList: ChartStreamRefItem[] = []
34
+
35
+ export const CHART_STREAM_REFS_UPDATED_EVENT = 'gen-ai-chart-stream-refs-updated'
36
+
37
+ function notifyRefsUpdated() {
38
+ if (typeof window === 'undefined') return
39
+ window.dispatchEvent(new Event(CHART_STREAM_REFS_UPDATED_EVENT))
40
+ }
41
+
42
+ function normalizeChunkId(raw: unknown): string {
43
+ return String(raw ?? '')
44
+ .trim()
45
+ .toLowerCase()
46
+ }
47
+
48
+ function persistToSession() {
49
+ try {
50
+ sessionStorage.setItem(STORAGE_KEY, JSON.stringify(SSERefList))
51
+ } catch {
52
+ /* ignore */
53
+ }
54
+ }
55
+
56
+ function hydrateFromSession() {
57
+ if (SSERefList.length) return
58
+ try {
59
+ const raw = sessionStorage.getItem(STORAGE_KEY)
60
+ if (!raw) return
61
+ const list = JSON.parse(raw) as ChartStreamRefItem[]
62
+ if (!Array.isArray(list)) return
63
+ for (const item of list) {
64
+ const normalized = normalizeChartStreamRef(item)
65
+ if (!normalized) continue
66
+ SSERefList.push({
67
+ ...normalized,
68
+ index: normalized.index > 0 ? normalized.index : SSERefList.length + 1,
69
+ })
70
+ }
71
+ } catch {
72
+ /* ignore */
73
+ }
74
+ }
75
+
76
+ /** 按图提取 6 字段;匹配主键 chunkId */
77
+ export function normalizeChartStreamRef(raw: unknown): ChartStreamRefItem | null {
78
+ if (!raw || typeof raw !== 'object') return null
79
+ const o = raw as Record<string, unknown>
80
+ const chunkId = normalizeChunkId(o.chunkId)
81
+ if (!CHUNK_ID_RE.test(chunkId)) return null
82
+ const indexRaw = Number(o.index)
83
+ const index = Number.isFinite(indexRaw) && indexRaw > 0 ? Math.floor(indexRaw) : 0
84
+ return {
85
+ chunkId,
86
+ filePath: String(o.filePath ?? '').trim(),
87
+ filePreviewUrl: String(o.filePreviewUrl ?? '').trim(),
88
+ index,
89
+ sourceName: String(o.sourceName ?? '').trim(),
90
+ sourceText: String(o.sourceText ?? '').trim(),
91
+ sourcePage: String(o.sourcePage ?? '').trim(),
92
+ sourceType: String(o.sourceType ?? '').trim(),
93
+ knowledgeType: String(o.knowledgeType ?? '').trim(),
94
+ score: String(o.score ?? '').trim(),
95
+ }
96
+ }
97
+ // 0924
98
+
99
+ function collectRefsFromValue(value: unknown): ChartStreamRefItem[] {
100
+ if (value == null) return []
101
+ if (typeof value === 'string') {
102
+ const text = value.trim()
103
+ if (!text) return []
104
+ try {
105
+ return collectRefsFromValue(JSON.parse(text))
106
+ } catch {
107
+ return []
108
+ }
109
+ }
110
+ if (Array.isArray(value)) {
111
+ const out: ChartStreamRefItem[] = []
112
+ for (const item of value) {
113
+ const normalized = normalizeChartStreamRef(item)
114
+ if (normalized) out.push(normalized)
115
+ }
116
+ return out
117
+ }
118
+ const one = normalizeChartStreamRef(value)
119
+ return one ? [one] : []
120
+ }
121
+
122
+ /** getSectionVersionList / AdjustInstance → refList(旧名 Ref) */
123
+ export function collectChartStreamRefsFromRecord(raw: unknown): ChartStreamRefItem[] {
124
+ if (!raw || typeof raw !== 'object') return []
125
+ const o = raw as Record<string, unknown>
126
+ const buckets = [o.refList, o.Ref]
127
+ const out: ChartStreamRefItem[] = []
128
+ const seen = new Set<string>()
129
+ for (const bucket of buckets) {
130
+ for (const item of collectRefsFromValue(bucket)) {
131
+ if (seen.has(item.chunkId)) continue
132
+ seen.add(item.chunkId)
133
+ out.push(item)
134
+ }
135
+ }
136
+ return out
137
+ }
138
+
139
+ /**
140
+ * event:REF → SSERefList.push
141
+ * 同 chunkId 已存在则覆盖,否则 push
142
+ * 注意:push 路径不 hydrate,避免 clear 之后又被 session 旧数据灌回
143
+ */
144
+ export function upsertChartStreamRef(
145
+ raw: unknown,
146
+ options?: { silent?: boolean }
147
+ ): ChartStreamRefItem | null {
148
+ const normalized = normalizeChartStreamRef(raw)
149
+ if (!normalized) {
150
+ console.warn('[SSERefList] push 失败(缺 chunkId)', raw)
151
+ return null
152
+ }
153
+ const item: ChartStreamRefItem = {
154
+ ...normalized,
155
+ index: normalized.index > 0 ? normalized.index : SSERefList.length + 1,
156
+ }
157
+ const existAt = SSERefList.findIndex((r) => r.chunkId === item.chunkId)
158
+ if (existAt >= 0) SSERefList[existAt] = item
159
+ else SSERefList.push(item)
160
+ persistToSession()
161
+ console.log('[SSERefList] push', {
162
+ chunkId: item.chunkId,
163
+ index: item.index,
164
+ length: SSERefList.length,
165
+ })
166
+ if (!options?.silent) notifyRefsUpdated()
167
+ return item
168
+ }
169
+
170
+ /** 静态预览:refList 批量 push 进 SSERefList */
171
+ export function upsertChartStreamRefsFromSources(sources: unknown): number {
172
+ hydrateFromSession()
173
+ const list = Array.isArray(sources) ? sources : [sources]
174
+ let count = 0
175
+ for (const source of list) {
176
+ for (const item of collectChartStreamRefsFromRecord(source)) {
177
+ const next: ChartStreamRefItem = {
178
+ ...item,
179
+ index: item.index > 0 ? item.index : SSERefList.length + 1,
180
+ }
181
+ const existAt = SSERefList.findIndex((r) => r.chunkId === next.chunkId)
182
+ if (existAt >= 0) SSERefList[existAt] = next
183
+ else SSERefList.push(next)
184
+ count += 1
185
+ }
186
+ }
187
+ if (count > 0) {
188
+ persistToSession()
189
+ console.log('[SSERefList] 批量 push', { count, length: SSERefList.length })
190
+ notifyRefsUpdated()
191
+ }
192
+ return count
193
+ }
194
+
195
+ /**
196
+ * 打字机 message:[ref:{chunkId}] → 在 SSERefList 里按 chunkId 匹配
197
+ */
198
+ export function getChartStreamRef(chunkId: string): ChartStreamRefItem | undefined {
199
+ hydrateFromSession()
200
+ const id = normalizeChunkId(chunkId)
201
+ if (!id) return undefined
202
+ return SSERefList.find((item) => item.chunkId === id)
203
+ }
204
+
205
+ /** 点击生成章节内容时先清空 */
206
+ export function clearChartStreamRefs() {
207
+ SSERefList.length = 0
208
+ try {
209
+ sessionStorage.removeItem(STORAGE_KEY)
210
+ } catch {
211
+ /* ignore */
212
+ }
213
+ console.log('[SSERefList] 已清空')
214
+ notifyRefsUpdated()
215
+ }
216
+
217
+ export function listChartStreamRefs(): ChartStreamRefItem[] {
218
+ hydrateFromSession()
219
+ return [...SSERefList].sort((a, b) => a.index - b.index)
220
+ }
221
+
222
+ // 0924:编辑器晚于 refList 挂载时再通知一次,把已入库的 tip 画出来
223
+ export function notifyChartStreamRefsUpdated() {
224
+ if (!SSERefList.length) return
225
+ notifyRefsUpdated()
226
+ }
227
+ // 0924