aegon-gen 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 (86) hide show
  1. package/package.json +12 -0
  2. package/src/App.vue +3 -0
  3. package/src/api/index.ts +19 -0
  4. package/src/api/modules/gen-ai/gen-entry/index.ts +30 -0
  5. package/src/api/modules/gen-ai/model-manager/index.ts +42 -0
  6. package/src/api/modules/gen-ai/model-manager/mockApi.ts +33 -0
  7. package/src/api/modules/index.ts +98 -0
  8. package/src/api/modules/user/index.ts +4 -0
  9. package/src/api/request.ts +102 -0
  10. package/src/assets/sample-access-icon.png +0 -0
  11. package/src/assets/sample-pie-chart.png +0 -0
  12. package/src/assets/vue.svg +1 -0
  13. package/src/components/CapsuleScrollbar.vue +93 -0
  14. package/src/components/Export/ExcelExport.vue +592 -0
  15. package/src/components/Export/ExcelExport2.vue +494 -0
  16. package/src/components/Export/ExcelExport3.vue +342 -0
  17. package/src/components/Export/ExcelExport4.vue +665 -0
  18. package/src/components/Export/excelExport.js +547 -0
  19. package/src/components/Export/excelExport.ts +551 -0
  20. package/src/components/GEN-AI/index.vue +142 -0
  21. package/src/components/GEN-AI/index1.vue +456 -0
  22. package/src/components/GEN-AI/index10.vue +5 -0
  23. package/src/components/GEN-AI/index2.vue +568 -0
  24. package/src/components/GEN-AI/index3.vue +623 -0
  25. package/src/components/GEN-AI/index4.vue +629 -0
  26. package/src/components/GEN-AI/index5.vue +578 -0
  27. package/src/components/GEN-AI/index6.vue +656 -0
  28. package/src/components/GEN-AI/index7.vue +717 -0
  29. package/src/components/GEN-AI/index8.vue +405 -0
  30. package/src/components/GEN-AI/index9.vue +1065 -0
  31. package/src/components/GEN-AI/types.ts +12 -0
  32. package/src/components/GEN-AI/utils.ts +42 -0
  33. package/src/components/HelloWorld.vue +41 -0
  34. package/src/components/PageCard.vue +7 -0
  35. package/src/components/PageHeader.vue +32 -0
  36. package/src/components/backup/index5 copy.vue +556 -0
  37. package/src/components/backup/index5.vue +620 -0
  38. package/src/components/backup/index9 copy.vue +1029 -0
  39. package/src/components/backup/index9-pro.vue +1065 -0
  40. package/src/components/backup/index9.vue +1057 -0
  41. package/src/components/el-date-picker.vue +64 -0
  42. package/src/directives/btnLoading.ts +427 -0
  43. package/src/directives/debounce copy.ts +670 -0
  44. package/src/directives/debounce.ts +98 -0
  45. package/src/directives/index.ts +25 -0
  46. package/src/layouts/MainLayout.vue +101 -0
  47. package/src/main.ts +85 -0
  48. package/src/router/index.ts +76 -0
  49. package/src/router/menus.ts +28 -0
  50. package/src/style.css +79 -0
  51. package/src/styles/_variables.scss +24 -0
  52. package/src/styles/app-button.css +26 -0
  53. package/src/styles/element-overrides.css +23 -0
  54. package/src/styles/global.css +44 -0
  55. package/src/styles/index.scss +1 -0
  56. package/src/styles/page-card.css +21 -0
  57. package/src/styles/variables.css +26 -0
  58. package/src/test/mock.ts +101 -0
  59. package/src/test/test1.vue +402 -0
  60. package/src/test/test2.vue +1689 -0
  61. package/src/types/gen-ai/gen-entry/index.ts +17 -0
  62. package/src/types/gen-ai/model-manager/index.ts +19 -0
  63. package/src/utils/docxExport.ts +1610 -0
  64. package/src/utils/gen-ai-navigation.ts +37 -0
  65. package/src/utils/gen-ai-scroll.ts +455 -0
  66. package/src/utils/openDataLoaderWordExport.ts +33 -0
  67. package/src/utils/pageScrollbar.ts +115 -0
  68. package/src/utils/randomTranscode.ts +87 -0
  69. package/src/utils/reportPdfExport.ts +44 -0
  70. package/src/views/AdminCenter/index.vue +817 -0
  71. package/src/views/Blank.vue +68 -0
  72. package/src/views/Home.vue +29 -0
  73. package/src/views/ReportCenter/index.vue +1380 -0
  74. package/src/views/TemplateCenter/Knowledge.ts +83 -0
  75. package/src/views/TemplateCenter/data.d.ts +10 -0
  76. package/src/views/TemplateCenter/index.vue +1205 -0
  77. package/src/views/TemplateCenter/service.ts +69 -0
  78. package/src/views/gen-ai/components/RecentReportsTable.vue +193 -0
  79. package/src/views/gen-ai/gen-entry/index.vue +309 -0
  80. package/src/views/gen-ai/gen-entry/mockData.ts +160 -0
  81. package/src/views/gen-ai/management-center/index.vue +53 -0
  82. package/src/views/gen-ai/model-manager/ChapterTitleScroll.vue +275 -0
  83. package/src/views/gen-ai/model-manager/index.vue +1205 -0
  84. package/src/views/gen-ai/model-manager/mockData.ts +122 -0
  85. package/src/views/gen-ai/report-center/index.vue +158 -0
  86. package/src/vite-env.d.ts +38 -0
@@ -0,0 +1,87 @@
1
+ export type TranscodeMethod =
2
+ | 'plain'
3
+ | 'base64'
4
+ | 'url'
5
+ | 'unicode'
6
+ | 'hex'
7
+ | 'htmlEntity'
8
+ | 'binary'
9
+
10
+ export const transcodeMethodLabels: Record<TranscodeMethod, string> = {
11
+ plain: '原文',
12
+ base64: 'Base64',
13
+ url: 'URL 编码',
14
+ unicode: 'Unicode 转义',
15
+ hex: 'Hex 编码',
16
+ htmlEntity: 'HTML 实体',
17
+ binary: '二进制',
18
+ }
19
+
20
+ const utf8Encoder = new TextEncoder()
21
+
22
+ function toBytes(text: string): Uint8Array {
23
+ return utf8Encoder.encode(text)
24
+ }
25
+
26
+ function bytesToBinary(bytes: Uint8Array): string {
27
+ return Array.from(bytes, (b) => b.toString(2).padStart(8, '0')).join(' ')
28
+ }
29
+
30
+ function bytesToHex(bytes: Uint8Array): string {
31
+ return Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join(' ')
32
+ }
33
+
34
+ function toBase64(text: string): string {
35
+ const bytes = toBytes(text)
36
+ let binary = ''
37
+ bytes.forEach((b) => {
38
+ binary += String.fromCharCode(b)
39
+ })
40
+ return btoa(binary)
41
+ }
42
+
43
+ function toUnicodeEscape(text: string): string {
44
+ return Array.from(text)
45
+ .map((ch) => {
46
+ const code = ch.codePointAt(0) ?? 0
47
+ return code > 0xffff
48
+ ? `\\u{${code.toString(16)}}`
49
+ : `\\u${code.toString(16).padStart(4, '0')}`
50
+ })
51
+ .join('')
52
+ }
53
+
54
+ function toHtmlEntity(text: string): string {
55
+ return Array.from(text)
56
+ .map((ch) => `&#${(ch.codePointAt(0) ?? 0)};`)
57
+ .join('')
58
+ }
59
+
60
+ const transcoders: Record<Exclude<TranscodeMethod, 'plain'>, (text: string) => string> = {
61
+ base64: toBase64,
62
+ url: (text) => encodeURIComponent(text),
63
+ unicode: toUnicodeEscape,
64
+ hex: (text) => bytesToHex(toBytes(text)),
65
+ htmlEntity: toHtmlEntity,
66
+ binary: (text) => bytesToBinary(toBytes(text)),
67
+ }
68
+
69
+ export function pickRandomTranscodeMethod(): TranscodeMethod {
70
+ const methods = Object.keys(transcoders) as Exclude<TranscodeMethod, 'plain'>[]
71
+ return methods[Math.floor(Math.random() * methods.length)] ?? 'hex'
72
+ }
73
+
74
+ export function transcodeText(text: string, method: TranscodeMethod = pickRandomTranscodeMethod()): {
75
+ method: TranscodeMethod
76
+ label: string
77
+ result: string
78
+ } {
79
+ if (method === 'plain') {
80
+ return { method, label: transcodeMethodLabels.plain, result: text }
81
+ }
82
+ return {
83
+ method,
84
+ label: transcodeMethodLabels[method],
85
+ result: transcoders[method](text),
86
+ }
87
+ }
@@ -0,0 +1,44 @@
1
+ import html2canvas from 'html2canvas'
2
+ import { jsPDF } from 'jspdf'
3
+
4
+ export interface ReportPdfExportOptions {
5
+ scale?: number
6
+ backgroundColor?: string
7
+ }
8
+
9
+ export async function renderReportPdfBlob(
10
+ element: HTMLElement,
11
+ options: ReportPdfExportOptions = {},
12
+ ): Promise<Blob> {
13
+ const scale = options.scale ?? 2.5
14
+ const backgroundColor = options.backgroundColor ?? '#ffffff'
15
+
16
+ const canvas = await html2canvas(element, {
17
+ scale,
18
+ backgroundColor,
19
+ useCORS: true,
20
+ logging: false,
21
+ windowWidth: element.scrollWidth,
22
+ })
23
+
24
+ const imgData = canvas.toDataURL('image/png')
25
+ const pdf = new jsPDF('p', 'mm', 'a4')
26
+ const imgWidth = 210
27
+ const pageHeight = 297
28
+ const imgHeight = (canvas.height * imgWidth) / canvas.width
29
+
30
+ let heightLeft = imgHeight
31
+ let position = 0
32
+
33
+ pdf.addImage(imgData, 'PNG', 0, position, imgWidth, imgHeight)
34
+ heightLeft -= pageHeight
35
+
36
+ while (heightLeft > 0) {
37
+ position = heightLeft - imgHeight
38
+ pdf.addPage()
39
+ pdf.addImage(imgData, 'PNG', 0, position, imgWidth, imgHeight)
40
+ heightLeft -= pageHeight
41
+ }
42
+
43
+ return pdf.output('blob')
44
+ }