aegon-lv82 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.
- package/package.json +12 -0
- package/src/App.vue +44 -0
- package/src/api/index.ts +19 -0
- package/src/api/modules/build-report/reportEditor.ts +526 -0
- package/src/api/modules/build-report/reportPermission.ts +64 -0
- package/src/api/modules/index.ts +69 -0
- package/src/api/modules/industry/green_mortgage.ts +42 -0
- package/src/api/modules/user/index.ts +4 -0
- package/src/api/request.ts +124 -0
- package/src/assets/sample-access-icon.png +0 -0
- package/src/assets/sample-pie-chart.png +0 -0
- package/src/assets/vue.svg +1 -0
- package/src/components/CapsuleScrollbar.vue +7 -0
- package/src/components/Export/ExcelExport.vue +592 -0
- package/src/components/Export/ExcelExport2.vue +494 -0
- package/src/components/Export/ExcelExport3.vue +342 -0
- package/src/components/Export/ExcelExport4.vue +665 -0
- package/src/components/Export/excelExport.js +547 -0
- package/src/components/Export/excelExport.ts +551 -0
- package/src/components/GEN-AI/index.vue +140 -0
- package/src/components/GEN-AI/index1.vue +422 -0
- package/src/components/GEN-AI/index10.vue +5 -0
- package/src/components/GEN-AI/index2.vue +548 -0
- package/src/components/GEN-AI/index3.vue +605 -0
- package/src/components/GEN-AI/index4.vue +609 -0
- package/src/components/GEN-AI/index5.vue +558 -0
- package/src/components/GEN-AI/index6.vue +634 -0
- package/src/components/GEN-AI/index7.vue +688 -0
- package/src/components/GEN-AI/index8.vue +458 -0
- package/src/components/GEN-AI/index9.vue +1217 -0
- package/src/components/GEN-AI/types.ts +12 -0
- package/src/components/GEN-AI/utils.ts +42 -0
- package/src/components/HelloWorld.vue +41 -0
- package/src/components/PageCard.vue +124 -0
- package/src/components/PageHeader.vue +32 -0
- package/src/components/backup/index5 copy.vue +556 -0
- package/src/components/backup/index5.vue +620 -0
- package/src/components/backup/index9 copy.vue +1029 -0
- package/src/components/backup/index9-pro.vue +1065 -0
- package/src/components/backup/index9.vue +1057 -0
- package/src/directives/btnLoading.ts +455 -0
- package/src/directives/debounce copy.ts +670 -0
- package/src/directives/debounce.ts +98 -0
- package/src/directives/index.ts +25 -0
- package/src/layouts/MainLayout.vue +129 -0
- package/src/main.ts +76 -0
- package/src/router/index.ts +142 -0
- package/src/router/menus.ts +28 -0
- package/src/store/modules/gen-ai/index.ts +1 -0
- package/src/store/modules/gen-ai/reportBuild.ts +37 -0
- package/src/style.css +79 -0
- package/src/styles/report-config-popover.css +39 -0
- package/src/styles/report-icon-btn.css +19 -0
- package/src/test/mock.ts +101 -0
- package/src/test/test1.vue +402 -0
- package/src/test/test2.vue +1689 -0
- package/src/types/gen-ai/build-report/reportEditor.ts +684 -0
- package/src/utils/function.ts +46 -0
- package/src/utils/gen-ai-navigation.ts +1 -0
- package/src/utils/gen-ai-scroll.ts +1 -0
- package/src/utils/openDataLoaderWordExport.ts +33 -0
- package/src/utils/pageScrollbar.ts +115 -0
- package/src/utils/randomTranscode.ts +87 -0
- package/src/utils/reportPdfExport.ts +44 -0
- package/src/views/Blank.vue +68 -0
- package/src/views/Home.vue +29 -0
- package/src/views/TemplateCenter/Knowledge.ts +83 -0
- package/src/views/TemplateCenter/data.d.ts +10 -0
- package/src/views/TemplateCenter/index.vue +1128 -0
- package/src/views/TemplateCenter/service.ts +69 -0
- package/src/views/gen-ai/build-report/chartStreamRefs.ts +174 -0
- package/src/views/gen-ai/build-report/coherence-check/index.vue +559 -0
- package/src/views/gen-ai/build-report/components/ReportChapterWorkspace.vue +4258 -0
- package/src/views/gen-ai/build-report/components/ReportConfigPanel.vue +727 -0
- package/src/views/gen-ai/build-report/components/ReportGenerateSettingsPanel.vue +2361 -0
- package/src/views/gen-ai/build-report/components/ReportGeneratingPanel.vue +1765 -0
- package/src/views/gen-ai/build-report/components/ReportPromptPanel.vue +614 -0
- package/src/views/gen-ai/build-report/components/ReportSourceFileSummary.vue +656 -0
- package/src/views/gen-ai/build-report/components/ReportSourcesPanel.vue +1327 -0
- package/src/views/gen-ai/build-report/components/ReportTemplateDetail.vue +191 -0
- package/src/views/gen-ai/build-report/components/ReportTemplateEditorFormPanel.vue +667 -0
- package/src/views/gen-ai/build-report/components/ReportTemplatePicker.vue +302 -0
- package/src/views/gen-ai/build-report/components/ReportWorkflowSidebar.vue +148 -0
- package/src/views/gen-ai/build-report/components/paramsSetting.vue +886 -0
- package/src/views/gen-ai/build-report/components/reportEdit.vue +2283 -0
- package/src/views/gen-ai/build-report/index.vue +856 -0
- package/src/views/gen-ai/build-report/report-domain.ts +1133 -0
- package/src/views/gen-ai/build-report/report-template-data.ts +295 -0
- package/src/views/gen-ai/build-report/useReportWorkflow.ts +1408 -0
- package/src/views/gen-ai/common/assets/NotoSans-SC.woff2 +0 -0
- package/src/views/gen-ai/common/assets/NotoSans-TC.woff2 +0 -0
- package/src/views/gen-ai/common/assets/NotoSans.woff2 +0 -0
- package/src/views/gen-ai/common/assets/fonts.css +278 -0
- package/src/views/gen-ai/common/assets/pagination.css +163 -0
- package/src/views/gen-ai/common/directives/btnLoading.ts +455 -0
- package/src/views/gen-ai/common/directives/debounce.ts +98 -0
- package/src/views/gen-ai/common/directives/index.ts +30 -0
- package/src/views/gen-ai/common/en.md +417 -0
- package/src/views/gen-ai/common/index.ts +36 -0
- package/src/views/gen-ai/common/types/component-expose.ts +9 -0
- package/src/views/gen-ai/common/utils/api-res-status.ts +7 -0
- package/src/views/gen-ai/common/utils/navigation.ts +59 -0
- package/src/views/gen-ai/common/utils/remote-request.ts +45 -0
- package/src/views/gen-ai/common/utils/scroll.ts +577 -0
- package/src/views/gen-ai/components/AIExport/docx-export.ts +950 -0
- package/src/views/gen-ai/components/AIExport/docxExport.ts +2566 -0
- package/src/views/gen-ai/components/AIExport/index.ts +52 -0
- package/src/views/gen-ai/components/AIExport/parseMarkdownHtml.ts +649 -0
- package/src/views/gen-ai/components/CapsuleScrollbar.vue +149 -0
- package/src/views/gen-ai/components/ChapterTitleScroll.vue +468 -0
- package/src/views/gen-ai/components/EntryHeroNavCards.vue +379 -0
- package/src/views/gen-ai/components/GenAiPagination.vue +52 -0
- package/src/views/gen-ai/components/ModelCard.vue +1114 -0
- package/src/views/gen-ai/components/Preview/FilePreviewPage.vue +947 -0
- package/src/views/gen-ai/components/Preview/PreviewCapsuleScroll.vue +205 -0
- package/src/views/gen-ai/components/Preview/PreviewOutlineTree.vue +148 -0
- package/src/views/gen-ai/components/Preview/index.ts +11 -0
- package/src/views/gen-ai/components/Preview/preview.ts +722 -0
- package/src/views/gen-ai/components/PromptField.vue +505 -0
- package/src/views/gen-ai/components/RecentReportsTable.vue +974 -0
- package/src/views/gen-ai/components/ReportCollapsibleSection.vue +172 -0
- package/src/views/gen-ai/components/ReportHistoryList.vue +637 -0
- package/src/views/gen-ai/components/ReportSectionConfirmPopover.vue +251 -0
- package/src/views/gen-ai/components/editor/ChapterTiptapEditor.vue +3139 -0
- package/src/views/gen-ai/components/editor/StructureBlockView.vue +441 -0
- package/src/views/gen-ai/components/editor/TiptapToolbar.vue +1036 -0
- package/src/views/gen-ai/components/editor/TypewriterDocEditor.vue +398 -0
- package/src/views/gen-ai/components/editor/_StructureOrgNode.vue +326 -0
- package/src/views/gen-ai/components/editor/index.ts +12 -0
- package/src/views/gen-ai/components/editor/parseMarkdownHtml.ts +667 -0
- package/src/views/gen-ai/gen-entry/api/index.ts +32 -0
- package/src/views/gen-ai/gen-entry/index.vue +287 -0
- package/src/views/gen-ai/gen-entry/types/index.ts +4 -0
- package/src/views/gen-ai/i.mark +2 -0
- package/src/views/gen-ai/management-center/index.vue +1815 -0
- package/src/views/gen-ai/management-center/mockData.ts +248 -0
- package/src/views/gen-ai/management-center/types/index.ts +37 -0
- package/src/views/gen-ai/model-manager/TemplateEditorFormPanel.vue +661 -0
- package/src/views/gen-ai/model-manager/api/index.ts +32 -0
- package/src/views/gen-ai/model-manager/api/mockApi.ts +33 -0
- package/src/views/gen-ai/model-manager/index.vue +1583 -0
- package/src/views/gen-ai/model-manager/mockData.ts +177 -0
- package/src/views/gen-ai/model-manager/template-detail-shared.ts +154 -0
- package/src/views/gen-ai/model-manager/template-editor.vue +345 -0
- package/src/views/gen-ai/model-manager/types/index.ts +40 -0
- package/src/views/gen-ai/model-manager/utils.ts +25 -0
- package/src/views/greenMortgage.vue +1834 -0
- package/src/vite-env.d.ts +46 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { buildAuthHeaders } from '../../api/request'
|
|
2
|
+
import { HEDERA_SYSTEM_PROMPT } from './Knowledge'
|
|
3
|
+
|
|
4
|
+
/** Browser calls dev proxy; keys stay in .env on the server. */
|
|
5
|
+
export const CHAT_API_URL = '/api/chat/completions'
|
|
6
|
+
|
|
7
|
+
export const CHAT_MODEL =
|
|
8
|
+
import.meta.env.VITE_CHAT_MODEL ?? 'qwen/qwen-2.5-7b-instruct:free'
|
|
9
|
+
|
|
10
|
+
export const CHAT_PROVIDER_LABEL =
|
|
11
|
+
import.meta.env.VITE_CHAT_PROVIDER_LABEL ?? 'OpenRouter · Qwen 2.5'
|
|
12
|
+
|
|
13
|
+
export function buildChatMessages(userContent: string) {
|
|
14
|
+
return [
|
|
15
|
+
{ role: 'system' as const, content: HEDERA_SYSTEM_PROMPT },
|
|
16
|
+
{ role: 'user' as const, content: userContent },
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function* streamChatCompletion(
|
|
21
|
+
messages: Array<{ role: string; content: string }>,
|
|
22
|
+
) {
|
|
23
|
+
const response = await fetch(CHAT_API_URL, {
|
|
24
|
+
method: 'POST',
|
|
25
|
+
headers: buildAuthHeaders(),
|
|
26
|
+
body: JSON.stringify({
|
|
27
|
+
model: CHAT_MODEL,
|
|
28
|
+
messages,
|
|
29
|
+
stream: true,
|
|
30
|
+
temperature: 0.7,
|
|
31
|
+
max_tokens: 2048,
|
|
32
|
+
}),
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
if (!response.ok) {
|
|
36
|
+
throw new Error(`HTTP ${response.status}`)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const reader = response.body?.getReader()
|
|
40
|
+
if (!reader) {
|
|
41
|
+
throw new Error('No reader')
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const decoder = new TextDecoder()
|
|
45
|
+
let buffer = ''
|
|
46
|
+
|
|
47
|
+
while (true) {
|
|
48
|
+
const { done, value } = await reader.read()
|
|
49
|
+
if (done) break
|
|
50
|
+
|
|
51
|
+
buffer += decoder.decode(value, { stream: true })
|
|
52
|
+
const lines = buffer.split('\n')
|
|
53
|
+
buffer = lines.pop() || ''
|
|
54
|
+
|
|
55
|
+
for (const line of lines) {
|
|
56
|
+
const trimmed = line.trim()
|
|
57
|
+
if (!trimmed || trimmed === 'data: [DONE]') continue
|
|
58
|
+
if (!trimmed.startsWith('data: ')) continue
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
const json = JSON.parse(trimmed.slice(6))
|
|
62
|
+
const delta = json.choices?.[0]?.delta?.content || ''
|
|
63
|
+
if (delta) yield delta
|
|
64
|
+
} catch {
|
|
65
|
+
/* ignore malformed SSE chunks */
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* chartAsStream SSE Type:REF / getSectionVersionList.refList / AdjustInstance.instanceContents[].refList
|
|
3
|
+
* 按 chunkId 备用,供正文 [ref:uuid] 匹配 tip(打字機與靜態預覽共用)
|
|
4
|
+
*/
|
|
5
|
+
export type ChartStreamRefItem = {
|
|
6
|
+
chunkId: string
|
|
7
|
+
filePath: string
|
|
8
|
+
filePreviewUrl: string
|
|
9
|
+
index: number
|
|
10
|
+
sourceName: string
|
|
11
|
+
sourceText: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const STORAGE_KEY = 'gen-ai-chart-stream-refs'
|
|
15
|
+
const CHUNK_ID_RE =
|
|
16
|
+
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i
|
|
17
|
+
|
|
18
|
+
const refsByChunkId = new Map<string, ChartStreamRefItem>()
|
|
19
|
+
|
|
20
|
+
export const CHART_STREAM_REFS_UPDATED_EVENT = 'gen-ai-chart-stream-refs-updated'
|
|
21
|
+
|
|
22
|
+
function notifyRefsUpdated() {
|
|
23
|
+
if (typeof window === 'undefined') return
|
|
24
|
+
window.dispatchEvent(new Event(CHART_STREAM_REFS_UPDATED_EVENT))
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function hydrateFromSession() {
|
|
28
|
+
if (refsByChunkId.size) return
|
|
29
|
+
try {
|
|
30
|
+
const raw = sessionStorage.getItem(STORAGE_KEY)
|
|
31
|
+
if (!raw) return
|
|
32
|
+
const list = JSON.parse(raw) as ChartStreamRefItem[]
|
|
33
|
+
if (!Array.isArray(list)) return
|
|
34
|
+
//0917 丟棄 tip 聯調 Mock REF(CBRE / Grade A / 甲級寫字樓)
|
|
35
|
+
const mockRe =
|
|
36
|
+
/Grade A Offices|甲級寫字樓\s*2024|POC source file\s*-\s*CBRE_2024|CBRE_2024c/i
|
|
37
|
+
let dropped = false
|
|
38
|
+
for (const item of list) {
|
|
39
|
+
const normalized = normalizeChartStreamRef(item)
|
|
40
|
+
if (!normalized) continue
|
|
41
|
+
if (mockRe.test(`${normalized.sourceName}\n${normalized.sourceText}`)) {
|
|
42
|
+
dropped = true
|
|
43
|
+
continue
|
|
44
|
+
}
|
|
45
|
+
refsByChunkId.set(normalized.chunkId, normalized)
|
|
46
|
+
}
|
|
47
|
+
if (dropped) persistToSession()
|
|
48
|
+
} catch {
|
|
49
|
+
/* ignore */
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function persistToSession() {
|
|
54
|
+
try {
|
|
55
|
+
sessionStorage.setItem(STORAGE_KEY, JSON.stringify([...refsByChunkId.values()]))
|
|
56
|
+
} catch {
|
|
57
|
+
/* ignore */
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function normalizeChartStreamRef(raw: unknown): ChartStreamRefItem | null {
|
|
62
|
+
if (!raw || typeof raw !== 'object') return null
|
|
63
|
+
const o = raw as Record<string, unknown>
|
|
64
|
+
const chunkId = String(o.chunkId ?? o.chunkld ?? '').trim()
|
|
65
|
+
if (!CHUNK_ID_RE.test(chunkId)) return null
|
|
66
|
+
const indexRaw = Number(o.index)
|
|
67
|
+
const index = Number.isFinite(indexRaw) && indexRaw > 0 ? Math.floor(indexRaw) : 0
|
|
68
|
+
if (!index) return null
|
|
69
|
+
return {
|
|
70
|
+
chunkId,
|
|
71
|
+
filePath: String(o.filePath ?? '').trim(),
|
|
72
|
+
filePreviewUrl: String(o.filePreviewUrl ?? '').trim(),
|
|
73
|
+
index,
|
|
74
|
+
sourceName: String(o.sourceName ?? '').trim(),
|
|
75
|
+
sourceText: String(o.sourceText ?? '').trim(),
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** 解析單值 / 數組 / JSON 字符串為 Ref 列表 */
|
|
80
|
+
function collectRefsFromValue(value: unknown): ChartStreamRefItem[] {
|
|
81
|
+
if (value == null) return []
|
|
82
|
+
if (typeof value === 'string') {
|
|
83
|
+
const text = value.trim()
|
|
84
|
+
if (!text) return []
|
|
85
|
+
try {
|
|
86
|
+
return collectRefsFromValue(JSON.parse(text))
|
|
87
|
+
} catch {
|
|
88
|
+
return []
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (Array.isArray(value)) {
|
|
92
|
+
const out: ChartStreamRefItem[] = []
|
|
93
|
+
for (const item of value) {
|
|
94
|
+
const normalized = normalizeChartStreamRef(item)
|
|
95
|
+
if (normalized) out.push(normalized)
|
|
96
|
+
}
|
|
97
|
+
return out
|
|
98
|
+
}
|
|
99
|
+
const one = normalizeChartStreamRef(value)
|
|
100
|
+
return one ? [one] : []
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 從接口單條記錄抽取引用列表(字段名統一 refList;兼容舊 Ref / ref / refs)
|
|
105
|
+
* 適用 getSectionVersionList.data[]、AdjustInstance.instanceContents[]
|
|
106
|
+
*/
|
|
107
|
+
export function collectChartStreamRefsFromRecord(raw: unknown): ChartStreamRefItem[] {
|
|
108
|
+
if (!raw || typeof raw !== 'object') return []
|
|
109
|
+
const o = raw as Record<string, unknown>
|
|
110
|
+
const buckets = [o.refList, o.Ref, o.ref, o.refs, o.REF]
|
|
111
|
+
const out: ChartStreamRefItem[] = []
|
|
112
|
+
const seen = new Set<string>()
|
|
113
|
+
for (const bucket of buckets) {
|
|
114
|
+
for (const item of collectRefsFromValue(bucket)) {
|
|
115
|
+
if (seen.has(item.chunkId)) continue
|
|
116
|
+
seen.add(item.chunkId)
|
|
117
|
+
out.push(item)
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return out
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function upsertChartStreamRef(
|
|
124
|
+
raw: unknown,
|
|
125
|
+
options?: { silent?: boolean }
|
|
126
|
+
): ChartStreamRefItem | null {
|
|
127
|
+
hydrateFromSession()
|
|
128
|
+
const item = normalizeChartStreamRef(raw)
|
|
129
|
+
if (!item) return null
|
|
130
|
+
refsByChunkId.set(item.chunkId, item)
|
|
131
|
+
persistToSession()
|
|
132
|
+
if (!options?.silent) notifyRefsUpdated()
|
|
133
|
+
return item
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** 批量寫入接口返回的 Ref;寫完只通知一次,供靜態預覽立刻匹配 tip */
|
|
137
|
+
export function upsertChartStreamRefsFromSources(sources: unknown): number {
|
|
138
|
+
hydrateFromSession()
|
|
139
|
+
const list = Array.isArray(sources) ? sources : [sources]
|
|
140
|
+
let count = 0
|
|
141
|
+
for (const source of list) {
|
|
142
|
+
for (const item of collectChartStreamRefsFromRecord(source)) {
|
|
143
|
+
refsByChunkId.set(item.chunkId, item)
|
|
144
|
+
count += 1
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (count > 0) {
|
|
148
|
+
persistToSession()
|
|
149
|
+
notifyRefsUpdated()
|
|
150
|
+
}
|
|
151
|
+
return count
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function getChartStreamRef(chunkId: string): ChartStreamRefItem | undefined {
|
|
155
|
+
hydrateFromSession()
|
|
156
|
+
const id = String(chunkId ?? '').trim()
|
|
157
|
+
if (!id) return undefined
|
|
158
|
+
return refsByChunkId.get(id)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function clearChartStreamRefs() {
|
|
162
|
+
refsByChunkId.clear()
|
|
163
|
+
try {
|
|
164
|
+
sessionStorage.removeItem(STORAGE_KEY)
|
|
165
|
+
} catch {
|
|
166
|
+
/* ignore */
|
|
167
|
+
}
|
|
168
|
+
notifyRefsUpdated()
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export function listChartStreamRefs(): ChartStreamRefItem[] {
|
|
172
|
+
hydrateFromSession()
|
|
173
|
+
return [...refsByChunkId.values()].sort((a, b) => a.index - b.index)
|
|
174
|
+
}
|