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.
- package/gen-ai/build-report/chartStreamRefs.ts +227 -0
- package/gen-ai/build-report/coherence-check/index.vue +559 -0
- package/gen-ai/build-report/components/ReportChapterWorkspace.vue +4571 -0
- package/gen-ai/build-report/components/ReportConfigPanel.vue +727 -0
- package/gen-ai/build-report/components/ReportGenerateSettingsPanel.vue +2361 -0
- package/gen-ai/build-report/components/ReportGeneratingPanel.vue +1765 -0
- package/gen-ai/build-report/components/ReportPromptPanel.vue +625 -0
- package/gen-ai/build-report/components/ReportSourceFileSummary.vue +665 -0
- package/gen-ai/build-report/components/ReportSourcesPanel.vue +1327 -0
- package/gen-ai/build-report/components/ReportTemplateDetail.vue +191 -0
- package/gen-ai/build-report/components/ReportTemplateEditorFormPanel.vue +667 -0
- package/gen-ai/build-report/components/ReportTemplatePicker.vue +302 -0
- package/gen-ai/build-report/components/ReportWorkflowSidebar.vue +148 -0
- package/gen-ai/build-report/components/paramsSetting.vue +886 -0
- package/gen-ai/build-report/components/reportEdit.vue +2283 -0
- package/gen-ai/build-report/index.vue +856 -0
- package/gen-ai/build-report/report-domain.ts +1133 -0
- package/gen-ai/build-report/report-template-data.ts +295 -0
- package/gen-ai/build-report/useReportWorkflow.ts +1386 -0
- package/gen-ai/common/assets/NotoSans-SC.woff2 +0 -0
- package/gen-ai/common/assets/NotoSans-TC.woff2 +0 -0
- package/gen-ai/common/assets/NotoSans.woff2 +0 -0
- package/gen-ai/common/assets/fonts.css +278 -0
- package/gen-ai/common/assets/pagination.css +163 -0
- package/gen-ai/common/directives/btnLoading.ts +455 -0
- package/gen-ai/common/directives/debounce.ts +98 -0
- package/gen-ai/common/directives/index.ts +30 -0
- package/gen-ai/common/en.md +417 -0
- package/gen-ai/common/index.ts +36 -0
- package/gen-ai/common/types/component-expose.ts +9 -0
- package/gen-ai/common/utils/api-res-status.ts +7 -0
- package/gen-ai/common/utils/navigation.ts +59 -0
- package/gen-ai/common/utils/remote-request.ts +45 -0
- package/gen-ai/common/utils/scroll.ts +577 -0
- package/gen-ai/components/AIExport/docx-export.ts +950 -0
- package/gen-ai/components/AIExport/docxExport.ts +2566 -0
- package/gen-ai/components/AIExport/index.ts +52 -0
- package/gen-ai/components/AIExport/parseMarkdownHtml.ts +653 -0
- package/gen-ai/components/CapsuleScrollbar.vue +149 -0
- package/gen-ai/components/ChapterTitleScroll.vue +468 -0
- package/gen-ai/components/EntryHeroNavCards.vue +379 -0
- package/gen-ai/components/GenAiPagination.vue +52 -0
- package/gen-ai/components/ModelCard.vue +1114 -0
- package/gen-ai/components/Preview/FilePreviewPage.vue +949 -0
- package/gen-ai/components/Preview/PreviewCapsuleScroll.vue +205 -0
- package/gen-ai/components/Preview/PreviewOutlineTree.vue +148 -0
- package/gen-ai/components/Preview/index.ts +11 -0
- package/gen-ai/components/Preview/preview.ts +724 -0
- package/gen-ai/components/PromptField.vue +505 -0
- package/gen-ai/components/RecentReportsTable.vue +974 -0
- package/gen-ai/components/ReportCollapsibleSection.vue +172 -0
- package/gen-ai/components/ReportHistoryList.vue +637 -0
- package/gen-ai/components/ReportSectionConfirmPopover.vue +251 -0
- package/gen-ai/components/editor/ChapterTiptapEditor.vue +3718 -0
- package/gen-ai/components/editor/StructureBlockView.vue +441 -0
- package/gen-ai/components/editor/TiptapToolbar.vue +1036 -0
- package/gen-ai/components/editor/TypewriterDocEditor.vue +422 -0
- package/gen-ai/components/editor/_StructureOrgNode.vue +326 -0
- package/gen-ai/components/editor/index.ts +28 -0
- package/gen-ai/components/editor/parseMarkdownHtml.ts +754 -0
- package/gen-ai/components/editor/reviewCitationTip.ts +163 -0
- package/gen-ai/gen-entry/api/index.ts +32 -0
- package/gen-ai/gen-entry/index.vue +287 -0
- package/gen-ai/gen-entry/types/index.ts +4 -0
- package/gen-ai/i.mark +2 -0
- package/gen-ai/management-center/index.vue +1815 -0
- package/gen-ai/management-center/mockData.ts +248 -0
- package/gen-ai/management-center/types/index.ts +37 -0
- package/gen-ai/model-manager/TemplateEditorFormPanel.vue +661 -0
- package/gen-ai/model-manager/api/index.ts +32 -0
- package/gen-ai/model-manager/api/mockApi.ts +33 -0
- package/gen-ai/model-manager/index.vue +1583 -0
- package/gen-ai/model-manager/mockData.ts +177 -0
- package/gen-ai/model-manager/template-detail-shared.ts +154 -0
- package/gen-ai/model-manager/template-editor.vue +345 -0
- package/gen-ai/model-manager/types/index.ts +40 -0
- package/gen-ai/model-manager/utils.ts +25 -0
- package/package.json +12 -0
|
@@ -0,0 +1,625 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<aside class="report-prompt-panel" :class="{ 'is-compact': !promptOpen && !chapterHistoryOpen }">
|
|
3
|
+
<ReportCollapsibleSection v-model:open="promptOpen" title="Prompt">
|
|
4
|
+
<div :key="promptFormRenderKey" class="report-prompt-panel__content">
|
|
5
|
+
<div class="report-prompt-panel__prompt">
|
|
6
|
+
<PromptField
|
|
7
|
+
v-model="promptChapterForm.prompt"
|
|
8
|
+
label="Prompt"
|
|
9
|
+
layout="stack"
|
|
10
|
+
:required="false"
|
|
11
|
+
:rows="8"
|
|
12
|
+
min-height="180px"
|
|
13
|
+
:maxlength="1300"
|
|
14
|
+
:disabled="!chapterEditMode"
|
|
15
|
+
@ai-assist="handleAiAssist"
|
|
16
|
+
enable-ai-dialog
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div class="report-prompt-panel__options">
|
|
21
|
+
<label class="report-prompt-panel__option report-prompt-panel__option--inline">
|
|
22
|
+
<input
|
|
23
|
+
v-model="promptChapterForm.enableBodyContent"
|
|
24
|
+
type="checkbox"
|
|
25
|
+
class="report-prompt-panel__checkbox"
|
|
26
|
+
:disabled="!chapterEditMode"
|
|
27
|
+
/>
|
|
28
|
+
<span class="report-prompt-panel__option-label">正文內容</span>
|
|
29
|
+
<input
|
|
30
|
+
v-model.number="promptChapterForm.bodyWordLimit"
|
|
31
|
+
type="number"
|
|
32
|
+
class="report-prompt-panel__number-input"
|
|
33
|
+
:disabled="!chapterEditMode || !promptChapterForm.enableBodyContent"
|
|
34
|
+
min="1"
|
|
35
|
+
max="5000"
|
|
36
|
+
/>
|
|
37
|
+
<span class="report-prompt-panel__option-suffix">字以內</span>
|
|
38
|
+
</label>
|
|
39
|
+
|
|
40
|
+
<div class="report-prompt-panel__option-group">
|
|
41
|
+
<div class="report-prompt-panel__option-header">
|
|
42
|
+
<label class="report-prompt-panel__option">
|
|
43
|
+
<input
|
|
44
|
+
v-model="promptChapterForm.enableTable"
|
|
45
|
+
type="checkbox"
|
|
46
|
+
class="report-prompt-panel__checkbox"
|
|
47
|
+
:disabled="!chapterEditMode"
|
|
48
|
+
/>
|
|
49
|
+
<span class="report-prompt-panel__option-label">生成表格</span>
|
|
50
|
+
</label>
|
|
51
|
+
<button
|
|
52
|
+
type="button"
|
|
53
|
+
class="report-prompt-panel__fold-toggle"
|
|
54
|
+
aria-label="展開或收起生成設置"
|
|
55
|
+
@click="optionsDetailsOpen = !optionsDetailsOpen"
|
|
56
|
+
>
|
|
57
|
+
<span
|
|
58
|
+
class="report-prompt-panel__fold-arrow"
|
|
59
|
+
:class="{ 'is-open': optionsDetailsOpen }"
|
|
60
|
+
aria-hidden="true"
|
|
61
|
+
/>
|
|
62
|
+
</button>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<div v-show="optionsDetailsOpen" class="report-prompt-panel__details">
|
|
66
|
+
<div v-if="promptChapterForm.enableTable" class="report-prompt-panel__nested">
|
|
67
|
+
<label class="report-prompt-panel__field">
|
|
68
|
+
<span class="report-prompt-panel__field-label">表格標題</span>
|
|
69
|
+
<el-input
|
|
70
|
+
v-model="promptChapterForm.tableTitle"
|
|
71
|
+
class="report-prompt-panel__input"
|
|
72
|
+
:disabled="!chapterEditMode"
|
|
73
|
+
/>
|
|
74
|
+
</label>
|
|
75
|
+
<label class="report-prompt-panel__field">
|
|
76
|
+
<span class="report-prompt-panel__field-label">列標籤</span>
|
|
77
|
+
<el-input
|
|
78
|
+
v-model="promptChapterForm.tableRowLabels"
|
|
79
|
+
type="textarea"
|
|
80
|
+
:rows="3"
|
|
81
|
+
resize="none"
|
|
82
|
+
class="report-prompt-panel__textarea"
|
|
83
|
+
:disabled="!chapterEditMode"
|
|
84
|
+
/>
|
|
85
|
+
</label>
|
|
86
|
+
<label class="report-prompt-panel__field">
|
|
87
|
+
<span class="report-prompt-panel__field-label">欄標籤</span>
|
|
88
|
+
<el-input
|
|
89
|
+
v-model="promptChapterForm.tableColumnLabels"
|
|
90
|
+
type="textarea"
|
|
91
|
+
:rows="3"
|
|
92
|
+
resize="none"
|
|
93
|
+
class="report-prompt-panel__textarea"
|
|
94
|
+
:disabled="!chapterEditMode"
|
|
95
|
+
/>
|
|
96
|
+
</label>
|
|
97
|
+
<label class="report-prompt-panel__field">
|
|
98
|
+
<span class="report-prompt-panel__field-label">內容</span>
|
|
99
|
+
<el-input
|
|
100
|
+
v-model="promptChapterForm.tableContent"
|
|
101
|
+
type="textarea"
|
|
102
|
+
:rows="3"
|
|
103
|
+
resize="none"
|
|
104
|
+
class="report-prompt-panel__textarea"
|
|
105
|
+
:disabled="!chapterEditMode"
|
|
106
|
+
/>
|
|
107
|
+
</label>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<div
|
|
111
|
+
class="report-prompt-panel__option-group report-prompt-panel__option-group--nested"
|
|
112
|
+
>
|
|
113
|
+
<label class="report-prompt-panel__option">
|
|
114
|
+
<input
|
|
115
|
+
v-model="promptChapterForm.enableSourceChart"
|
|
116
|
+
type="checkbox"
|
|
117
|
+
class="report-prompt-panel__checkbox"
|
|
118
|
+
:disabled="!chapterEditMode"
|
|
119
|
+
/>
|
|
120
|
+
<span class="report-prompt-panel__option-label">引用資訊源圖表</span>
|
|
121
|
+
</label>
|
|
122
|
+
|
|
123
|
+
<div v-if="promptChapterForm.enableSourceChart" class="report-prompt-panel__nested">
|
|
124
|
+
<label class="report-prompt-panel__field">
|
|
125
|
+
<span class="report-prompt-panel__field-label">圖表描述</span>
|
|
126
|
+
<el-input
|
|
127
|
+
v-model="promptChapterForm.chartDescription"
|
|
128
|
+
type="textarea"
|
|
129
|
+
:rows="4"
|
|
130
|
+
resize="none"
|
|
131
|
+
class="report-prompt-panel__textarea"
|
|
132
|
+
:disabled="!chapterEditMode"
|
|
133
|
+
/>
|
|
134
|
+
</label>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
<div class="report-prompt-panel__actions">
|
|
139
|
+
<button
|
|
140
|
+
type="button"
|
|
141
|
+
class="app-btn app-btn--wide report-prompt-generate-btn"
|
|
142
|
+
:disabled="!chapterEditMode"
|
|
143
|
+
v-aiDebounce
|
|
144
|
+
v-aiBtnLoading
|
|
145
|
+
@click="handleGenerateChapter"
|
|
146
|
+
>
|
|
147
|
+
生成章節內容
|
|
148
|
+
</button>
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
</ReportCollapsibleSection>
|
|
155
|
+
|
|
156
|
+
<ReportCollapsibleSection v-model:open="chapterHistoryOpen" title="章節歷史">
|
|
157
|
+
<ReportHistoryList
|
|
158
|
+
v-model:active-key="activeChapterHistoryKey"
|
|
159
|
+
:items="chapterHistoryItems"
|
|
160
|
+
:show-title="false"
|
|
161
|
+
@continue-draft="handleContinueDraft"
|
|
162
|
+
/>
|
|
163
|
+
</ReportCollapsibleSection>
|
|
164
|
+
</aside>
|
|
165
|
+
</template>
|
|
166
|
+
|
|
167
|
+
<script lang="ts">
|
|
168
|
+
export interface PromptLibraryItem {
|
|
169
|
+
id: string
|
|
170
|
+
label: string
|
|
171
|
+
content: string
|
|
172
|
+
}
|
|
173
|
+
</script>
|
|
174
|
+
|
|
175
|
+
<script setup lang="ts">
|
|
176
|
+
import genAiReportEditorApi from '@/api/modules/build-report/reportEditor'
|
|
177
|
+
import { useGenAiBuildReportStore } from '@/store/modules/gen-ai'
|
|
178
|
+
import type { GenAiChartAsStreamParams } from '@/types/gen-ai/build-report/reportEditor'
|
|
179
|
+
import { ElInput, ElMessage } from 'element-plus'
|
|
180
|
+
import { nextTick, onBeforeUnmount, ref, watch } from 'vue'
|
|
181
|
+
import { closeAiBtnLoading } from '../../common/directives'
|
|
182
|
+
import {
|
|
183
|
+
PromptField,
|
|
184
|
+
ReportCollapsibleSection,
|
|
185
|
+
ReportHistoryList,
|
|
186
|
+
type ReportHistoryItem,
|
|
187
|
+
} from '../../common'
|
|
188
|
+
import { useReportWorkflow } from '../useReportWorkflow'
|
|
189
|
+
|
|
190
|
+
const genAiBuildReportStore = useGenAiBuildReportStore()
|
|
191
|
+
|
|
192
|
+
const {
|
|
193
|
+
draft,
|
|
194
|
+
promptChapterForm,
|
|
195
|
+
chapterEditMode,
|
|
196
|
+
chapterHistoryItems,
|
|
197
|
+
activeChapterHistoryKey,
|
|
198
|
+
chapterHistoryOpen,
|
|
199
|
+
chapterHistoryPreviewBody,
|
|
200
|
+
chapterHistoryApplyToken,
|
|
201
|
+
sourceFiles,
|
|
202
|
+
startChapterContentTypewriter,
|
|
203
|
+
stopChapterContentTypewriter,
|
|
204
|
+
markChapterContentFirstChunk,
|
|
205
|
+
chapterContentStreamEpoch,
|
|
206
|
+
chapterContentStreamLive,
|
|
207
|
+
activeChapterSectionId,
|
|
208
|
+
requestOpenAiPromptDialog,
|
|
209
|
+
enterChapterEditMode,
|
|
210
|
+
setChapterChartAuditEventId,
|
|
211
|
+
clearChapterChartAuditEventId,
|
|
212
|
+
upsertChapterChartStreamRef,
|
|
213
|
+
clearChapterChartStreamRefs,
|
|
214
|
+
} = useReportWorkflow()
|
|
215
|
+
|
|
216
|
+
const promptOpen = ref(true)
|
|
217
|
+
const optionsDetailsOpen = ref(false)
|
|
218
|
+
/** 歷史反顯時遞增,強制 Prompt 區 checkbox/input 重掛載 */
|
|
219
|
+
const promptFormRenderKey = ref(0)
|
|
220
|
+
|
|
221
|
+
/** 無章節歷史時默認收起 */
|
|
222
|
+
watch(
|
|
223
|
+
chapterHistoryItems,
|
|
224
|
+
(items) => {
|
|
225
|
+
if (!items.length) chapterHistoryOpen.value = false
|
|
226
|
+
},
|
|
227
|
+
{ deep: true, immediate: true }
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
/** 版本套用後刷新 Prompt UI:展開詳情並重掛表單,保證全量反顯 */
|
|
231
|
+
watch(chapterHistoryApplyToken, async () => {
|
|
232
|
+
if (!activeChapterHistoryKey.value) return
|
|
233
|
+
promptOpen.value = true
|
|
234
|
+
optionsDetailsOpen.value = true
|
|
235
|
+
await nextTick()
|
|
236
|
+
promptFormRenderKey.value += 1
|
|
237
|
+
})
|
|
238
|
+
|
|
239
|
+
/** 草稿「繼續編輯」:反顯該版本 Prompt / 正文 / 資訊源(靜態無打字機),並進入編輯模式 */
|
|
240
|
+
function handleContinueDraft(item: ReportHistoryItem) {
|
|
241
|
+
const key = item.key
|
|
242
|
+
if (!key) return
|
|
243
|
+
// 已選中同一草稿時強制再觸發一次 watch,確保三塊數據按該版本回填
|
|
244
|
+
if (activeChapterHistoryKey.value === key) {
|
|
245
|
+
activeChapterHistoryKey.value = ''
|
|
246
|
+
}
|
|
247
|
+
activeChapterHistoryKey.value = key
|
|
248
|
+
enterChapterEditMode()
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function handleAiAssist() {
|
|
252
|
+
if (!chapterEditMode.value) return
|
|
253
|
+
requestOpenAiPromptDialog('prompt-panel')
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
let chapterContentGenerateSeq = 0
|
|
257
|
+
let chapterContentAbort: AbortController | null = null
|
|
258
|
+
|
|
259
|
+
/** 切章時中止進行中的 chartAsStream,避免寫入錯章 */
|
|
260
|
+
watch(chapterContentStreamEpoch, () => {
|
|
261
|
+
chapterContentAbort?.abort()
|
|
262
|
+
chapterContentAbort = null
|
|
263
|
+
chapterContentGenerateSeq += 1
|
|
264
|
+
})
|
|
265
|
+
|
|
266
|
+
/** Prompt 面板 → ChartAsStreamDTO 全量入參 */
|
|
267
|
+
function buildChartAsStreamParams(): GenAiChartAsStreamParams {
|
|
268
|
+
const form = promptChapterForm
|
|
269
|
+
return {
|
|
270
|
+
// 報告配置「模型」value;未選時為空字串
|
|
271
|
+
modelName: String(draft.model || '').trim(),
|
|
272
|
+
promptDetail: form.prompt.trim() || 'who are you?',
|
|
273
|
+
promptType: 'INSTANCE_PROMPT_DETAIL',
|
|
274
|
+
contentLengthLimit: form.enableBodyContent ? form.bodyWordLimit || 500 : null,
|
|
275
|
+
tableInfo: {
|
|
276
|
+
enableTable: form.enableTable ? 'Y' : 'N',
|
|
277
|
+
tableTitle: form.tableTitle,
|
|
278
|
+
columnLabel: form.tableRowLabels,
|
|
279
|
+
barLabel: form.tableColumnLabels,
|
|
280
|
+
content: form.tableContent,
|
|
281
|
+
},
|
|
282
|
+
chartInfo: {
|
|
283
|
+
enableChart: form.enableSourceChart ? 'Y' : 'N',
|
|
284
|
+
chartDesc: form.chartDescription,
|
|
285
|
+
},
|
|
286
|
+
// 資訊源當前勾選列表(全選 / 全不選 / 部分)
|
|
287
|
+
fileIdList: sourceFiles.value.filter((file) => file.selected).map((file) => file.id),
|
|
288
|
+
instanceId: String(genAiBuildReportStore.instanceId ?? '').trim(),
|
|
289
|
+
// 0924:当前章节 sectionId
|
|
290
|
+
sectionId: String(activeChapterSectionId.value ?? '').trim(),
|
|
291
|
+
// 0924
|
|
292
|
+
categoryId: 1,
|
|
293
|
+
temperature: null,
|
|
294
|
+
maxTokens: null,
|
|
295
|
+
stream: true,
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/** 生成章節內容 chartAsStream:先清空標題外正文並繪出標題,再流式續打 */
|
|
300
|
+
async function generateGenAiSectionContent() {
|
|
301
|
+
const seq = ++chapterContentGenerateSeq
|
|
302
|
+
chapterContentAbort?.abort()
|
|
303
|
+
chapterContentAbort = new AbortController()
|
|
304
|
+
const signal = chapterContentAbort.signal
|
|
305
|
+
const previousBody = chapterHistoryPreviewBody.value
|
|
306
|
+
clearChapterChartAuditEventId()
|
|
307
|
+
clearChapterChartStreamRefs()
|
|
308
|
+
startChapterContentTypewriter()
|
|
309
|
+
// 先讓中欄只保留章節標題(正文已清空),再關 loading、開始收流
|
|
310
|
+
await nextTick()
|
|
311
|
+
if (seq !== chapterContentGenerateSeq) return
|
|
312
|
+
markChapterContentFirstChunk()
|
|
313
|
+
await nextTick()
|
|
314
|
+
if (seq !== chapterContentGenerateSeq) return
|
|
315
|
+
|
|
316
|
+
let received = false
|
|
317
|
+
|
|
318
|
+
try {
|
|
319
|
+
for await (const chunk of genAiReportEditorApi.streamChartAsStream(
|
|
320
|
+
buildChartAsStreamParams(),
|
|
321
|
+
signal,
|
|
322
|
+
{
|
|
323
|
+
onAuditEvent: (auditEventId) => setChapterChartAuditEventId(auditEventId),
|
|
324
|
+
//0918:event:REF → SSERefList.push;message 打字时 [ref:chunkId] 再匹配
|
|
325
|
+
onRefEvent: (ref) => upsertChapterChartStreamRef(ref),
|
|
326
|
+
}
|
|
327
|
+
)) {
|
|
328
|
+
if (seq !== chapterContentGenerateSeq) return
|
|
329
|
+
received = true
|
|
330
|
+
chapterHistoryPreviewBody.value = `${chapterHistoryPreviewBody.value ?? ''}${chunk}`
|
|
331
|
+
if (String(chapterHistoryPreviewBody.value).trim()) markChapterContentFirstChunk()
|
|
332
|
+
}
|
|
333
|
+
try {
|
|
334
|
+
const stored = String(
|
|
335
|
+
sessionStorage.getItem('gen-ai-chapter-chart-audit-event-id') ?? ''
|
|
336
|
+
).trim()
|
|
337
|
+
if (stored) setChapterChartAuditEventId(stored)
|
|
338
|
+
} catch {
|
|
339
|
+
/* ignore */
|
|
340
|
+
}
|
|
341
|
+
if (seq !== chapterContentGenerateSeq) return
|
|
342
|
+
if (!received || !String(chapterHistoryPreviewBody.value ?? '').trim()) {
|
|
343
|
+
stopChapterContentTypewriter()
|
|
344
|
+
chapterHistoryPreviewBody.value = previousBody
|
|
345
|
+
return false
|
|
346
|
+
}
|
|
347
|
+
return true
|
|
348
|
+
} catch (err) {
|
|
349
|
+
if (signal.aborted || seq !== chapterContentGenerateSeq) return
|
|
350
|
+
console.error('接口异常', err)
|
|
351
|
+
stopChapterContentTypewriter()
|
|
352
|
+
chapterHistoryPreviewBody.value = previousBody
|
|
353
|
+
return err instanceof Error && err.message.trim() ? err.message : false
|
|
354
|
+
} finally {
|
|
355
|
+
if (seq === chapterContentGenerateSeq) {
|
|
356
|
+
markChapterContentFirstChunk()
|
|
357
|
+
// 0924:流结束才允许打字机收口
|
|
358
|
+
chapterContentStreamLive.value = false
|
|
359
|
+
// 0924
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
onBeforeUnmount(() => {
|
|
365
|
+
chapterContentAbort?.abort()
|
|
366
|
+
chapterContentAbort = null
|
|
367
|
+
})
|
|
368
|
+
|
|
369
|
+
function handleGenerateChapter() {
|
|
370
|
+
if (!chapterEditMode.value) {
|
|
371
|
+
closeAiBtnLoading('.report-prompt-generate-btn')
|
|
372
|
+
return
|
|
373
|
+
}
|
|
374
|
+
if (!promptChapterForm.prompt.trim()) {
|
|
375
|
+
ElMessage.warning('請先填寫 Prompt')
|
|
376
|
+
closeAiBtnLoading('.report-prompt-generate-btn')
|
|
377
|
+
return
|
|
378
|
+
}
|
|
379
|
+
ElMessage.success('章節內容生成中')
|
|
380
|
+
void generateGenAiSectionContent()
|
|
381
|
+
.then((ok) => {
|
|
382
|
+
if (ok === false) ElMessage.warning('接口异常')
|
|
383
|
+
else if (typeof ok === 'string') ElMessage.warning(ok)
|
|
384
|
+
})
|
|
385
|
+
.finally(() => {
|
|
386
|
+
closeAiBtnLoading('.report-prompt-generate-btn')
|
|
387
|
+
})
|
|
388
|
+
}
|
|
389
|
+
</script>
|
|
390
|
+
|
|
391
|
+
<style scoped>
|
|
392
|
+
.report-prompt-panel {
|
|
393
|
+
display: flex;
|
|
394
|
+
flex-direction: column;
|
|
395
|
+
gap: 14px;
|
|
396
|
+
min-width: 0;
|
|
397
|
+
height: 100%;
|
|
398
|
+
box-sizing: border-box;
|
|
399
|
+
overflow: visible;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.report-prompt-panel.is-compact {
|
|
403
|
+
height: auto;
|
|
404
|
+
align-self: flex-start;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.report-prompt-panel > :deep(.report-collapsible-section:last-child:not(.is-collapsed)) {
|
|
408
|
+
flex: 1;
|
|
409
|
+
display: flex;
|
|
410
|
+
flex-direction: column;
|
|
411
|
+
min-height: 0;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.report-prompt-panel
|
|
415
|
+
> :deep(
|
|
416
|
+
.report-collapsible-section:last-child:not(.is-collapsed) .report-collapsible-section__body
|
|
417
|
+
) {
|
|
418
|
+
flex: 1;
|
|
419
|
+
display: flex;
|
|
420
|
+
flex-direction: column;
|
|
421
|
+
min-height: 0;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.report-prompt-panel :deep(.report-collapsible-section__toggle) {
|
|
425
|
+
border-bottom: none;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.report-prompt-panel
|
|
429
|
+
:deep(.report-collapsible-section.is-collapsed .report-collapsible-section__toggle) {
|
|
430
|
+
padding-bottom: 0;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.report-prompt-panel__content {
|
|
434
|
+
display: flex;
|
|
435
|
+
flex-direction: column;
|
|
436
|
+
gap: 8px;
|
|
437
|
+
min-width: 0;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.report-prompt-panel__prompt :deep(.gen-ai-prompt-field__label) {
|
|
441
|
+
display: none;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.report-prompt-panel__prompt :deep(.gen-ai-prompt-field--row) {
|
|
445
|
+
grid-template-columns: minmax(0, 1fr);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.report-prompt-panel__prompt :deep(.gen-ai-prompt-field__count) {
|
|
449
|
+
margin-top: 2px;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.report-prompt-panel__options {
|
|
453
|
+
display: flex;
|
|
454
|
+
flex-direction: column;
|
|
455
|
+
gap: 8px;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
.report-prompt-panel__option-group {
|
|
459
|
+
display: flex;
|
|
460
|
+
flex-direction: column;
|
|
461
|
+
gap: 6px;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.report-prompt-panel__option-header {
|
|
465
|
+
display: flex;
|
|
466
|
+
align-items: center;
|
|
467
|
+
justify-content: space-between;
|
|
468
|
+
gap: 8px;
|
|
469
|
+
min-width: 0;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
.report-prompt-panel__fold-toggle {
|
|
473
|
+
display: inline-flex;
|
|
474
|
+
align-items: center;
|
|
475
|
+
justify-content: center;
|
|
476
|
+
flex-shrink: 0;
|
|
477
|
+
width: 24px;
|
|
478
|
+
height: 24px;
|
|
479
|
+
margin: 0;
|
|
480
|
+
padding: 0;
|
|
481
|
+
border: 0;
|
|
482
|
+
background: none;
|
|
483
|
+
cursor: pointer;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.report-prompt-panel__fold-arrow {
|
|
487
|
+
display: inline-block;
|
|
488
|
+
width: 0;
|
|
489
|
+
height: 0;
|
|
490
|
+
border-left: 5px solid transparent;
|
|
491
|
+
border-right: 5px solid transparent;
|
|
492
|
+
border-bottom: 7px solid #c53355;
|
|
493
|
+
transition: transform 0.2s ease;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.report-prompt-panel__fold-arrow.is-open {
|
|
497
|
+
transform: rotate(180deg);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.report-prompt-panel__option {
|
|
501
|
+
display: inline-flex;
|
|
502
|
+
align-items: center;
|
|
503
|
+
gap: 8px;
|
|
504
|
+
cursor: pointer;
|
|
505
|
+
user-select: none;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.report-prompt-panel__option--inline {
|
|
509
|
+
flex-wrap: wrap;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
.report-prompt-panel__checkbox {
|
|
513
|
+
width: 14px;
|
|
514
|
+
height: 14px;
|
|
515
|
+
margin: 0;
|
|
516
|
+
accent-color: #c53355;
|
|
517
|
+
flex-shrink: 0;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
.report-prompt-panel__option-label {
|
|
521
|
+
font-size: 13px;
|
|
522
|
+
font-weight: 500;
|
|
523
|
+
color: #303133;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.report-prompt-panel__option-suffix {
|
|
527
|
+
font-size: 13px;
|
|
528
|
+
color: #606266;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.report-prompt-panel__number-input {
|
|
532
|
+
width: 64px;
|
|
533
|
+
height: 28px;
|
|
534
|
+
padding: 2px 8px;
|
|
535
|
+
border: 1px solid #dcdfe6;
|
|
536
|
+
border-radius: 4px;
|
|
537
|
+
font-size: 13px;
|
|
538
|
+
color: #303133;
|
|
539
|
+
box-sizing: border-box;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.report-prompt-panel__number-input:disabled {
|
|
543
|
+
background: #f5f7fa;
|
|
544
|
+
color: #c0c4cc;
|
|
545
|
+
cursor: not-allowed;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.report-prompt-panel__nested {
|
|
549
|
+
display: flex;
|
|
550
|
+
flex-direction: column;
|
|
551
|
+
gap: 8px;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.report-prompt-panel__details {
|
|
555
|
+
display: flex;
|
|
556
|
+
flex-direction: column;
|
|
557
|
+
gap: 8px;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
.report-prompt-panel__option-group--nested {
|
|
561
|
+
margin-top: 0;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
.report-prompt-panel__field {
|
|
565
|
+
display: flex;
|
|
566
|
+
flex-direction: column;
|
|
567
|
+
gap: 4px;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
.report-prompt-panel__field-label {
|
|
571
|
+
font-size: 13px;
|
|
572
|
+
color: #606266;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
.report-prompt-panel__input :deep(.el-input__wrapper),
|
|
576
|
+
.report-prompt-panel__textarea :deep(.el-textarea__inner) {
|
|
577
|
+
border-radius: 4px;
|
|
578
|
+
font-size: 13px;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.report-prompt-panel__textarea :deep(.el-textarea__inner) {
|
|
582
|
+
min-height: 72px;
|
|
583
|
+
line-height: 1.6;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
.report-prompt-panel__actions {
|
|
587
|
+
display: flex;
|
|
588
|
+
justify-content: center;
|
|
589
|
+
padding-top: 8px;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
.app-btn {
|
|
593
|
+
display: inline-flex;
|
|
594
|
+
align-items: center;
|
|
595
|
+
justify-content: center;
|
|
596
|
+
box-sizing: border-box;
|
|
597
|
+
width: 160px;
|
|
598
|
+
height: 39px;
|
|
599
|
+
min-width: 160px;
|
|
600
|
+
padding: 0;
|
|
601
|
+
border: 1px solid #c53355;
|
|
602
|
+
border-radius: 4px;
|
|
603
|
+
background: #c53355;
|
|
604
|
+
color: #fff;
|
|
605
|
+
font-size: 14px;
|
|
606
|
+
font-weight: 600;
|
|
607
|
+
line-height: 1;
|
|
608
|
+
cursor: pointer;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
.app-btn:hover:not(:disabled) {
|
|
612
|
+
background: #fff;
|
|
613
|
+
color: #c53355;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
.app-btn:disabled {
|
|
617
|
+
opacity: 0.45;
|
|
618
|
+
cursor: not-allowed;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.app-btn--wide {
|
|
622
|
+
width: 160px;
|
|
623
|
+
min-width: 160px;
|
|
624
|
+
}
|
|
625
|
+
</style>
|