From 713fb4ed53c44e096ece0f7b67ffffb08deda545 Mon Sep 17 00:00:00 2001 From: rogersun Date: Tue, 21 Jul 2026 10:13:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0html=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 27 +++++++++++++++++++++++++++ package.json | 1 + src/views/ai_show/index.vue | 18 ++++++++++++++++-- yarn.lock | 21 ++++++++++++++++++++- 4 files changed, 64 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6da3193..f1c5f0f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,7 @@ "sortablejs": "^1.15.2", "vite-plugin-commonjs": "^0.10.1", "vue": "^3.3.8", + "vue-dompurify-html": "^5.3.0", "vue-router": "^4.0.13", "vue3-ace-editor": "^2.2.4", "vuex": "^4.0.2", @@ -1328,6 +1329,12 @@ "undici-types": "~6.21.0" } }, + "node_modules/@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://mirrors.cloud.tencent.com/npm/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "optional": true + }, "node_modules/@types/web-bluetooth": { "version": "0.0.20", "resolved": "https://mirrors.cloud.tencent.com/npm/@types/web-bluetooth/-/web-bluetooth-0.0.20.tgz", @@ -1719,6 +1726,14 @@ "node": ">=8" } }, + "node_modules/dompurify": { + "version": "3.4.12", + "resolved": "https://mirrors.cloud.tencent.com/npm/dompurify/-/dompurify-3.4.12.tgz", + "integrity": "sha512-zQvGet8Z2sWbQhCmfFz/T5QWH2oBmjnqK3qvOjaqaNLrLEF912WamU+ohnTp0TCep/MFVHpdJuCZEdFOdTnEFg==", + "optionalDependencies": { + "@types/trusted-types": "^2.0.7" + } + }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://mirrors.cloud.tencent.com/npm/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -3631,6 +3646,18 @@ "integrity": "sha512-O02tnvIfOQVmnvoWwuSydwRoHjZVt8UEBR+2p4rT35p8GAy5VTlWP8o5qXfJR/GWCN0nVZoYWsVUvx2jwgdBmQ==", "license": "MIT" }, + "node_modules/vue-dompurify-html": { + "version": "5.3.0", + "resolved": "https://mirrors.cloud.tencent.com/npm/vue-dompurify-html/-/vue-dompurify-html-5.3.0.tgz", + "integrity": "sha512-HJQGBHbfSPcb6Mu97McdKbX7TqRHZa6Ji8OCpCNyuHca5QvQZ8IiuwghFPSO8OkSQfqXPNPKFMZdCOrnGGmOSQ==", + "license": "MIT", + "dependencies": { + "dompurify": "^3.2.5" + }, + "peerDependencies": { + "vue": "^3.4.36" + } + }, "node_modules/vue-router": { "version": "4.6.4", "resolved": "https://mirrors.cloud.tencent.com/npm/vue-router/-/vue-router-4.6.4.tgz", diff --git a/package.json b/package.json index f221a01..2f44741 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "sortablejs": "^1.15.2", "vite-plugin-commonjs": "^0.10.1", "vue": "^3.3.8", + "vue-dompurify-html": "^5.3.0", "vue-router": "^4.0.13", "vue3-ace-editor": "^2.2.4", "vuex": "^4.0.2", diff --git a/src/views/ai_show/index.vue b/src/views/ai_show/index.vue index 9b8e0a8..710ac48 100644 --- a/src/views/ai_show/index.vue +++ b/src/views/ai_show/index.vue @@ -30,6 +30,7 @@ const loading = ref(false) const think = ref('') const aiModel = ref('') const promptVersion = ref('') +const htmlView = ref('') // 日期控件参数 const calendarStart = ref('') @@ -106,6 +107,7 @@ async function get_data(type) { force.value = compareSwitch.value === 'new' test_date_option.value = [] promptVersion.value = '' + htmlView.value = '' console.log('get_test_date-type', type) if (set_default.includes(type)) { test_date.value = '' @@ -128,6 +130,10 @@ async function get_data(type) { think.value = res.data.think aiModel.value = res.data.ai_model promptVersion.value = res.data.prompt_version + if (res.data.report) { + htmlView.value = res.data.report + console.log('htmlView', htmlView.value) + } if (compareSwitch.value === 'template') { showData.value = res.data.template_obj compareCount.value = res.data.template_count @@ -534,10 +540,10 @@ onBeforeMount( - AI返回结果: + 报告: - {{ showResult }} + @@ -556,6 +562,14 @@ onBeforeMount( {{ prompt }} + + + AI返回结果: + + + {{ showResult }} + + AI思考过程: diff --git a/yarn.lock b/yarn.lock index c9711ce..99db9f6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -177,6 +177,11 @@ dependencies: undici-types "~6.21.0" +"@types/trusted-types@^2.0.7": + version "2.0.7" + resolved "https://mirrors.cloud.tencent.com/npm/@types/trusted-types/-/trusted-types-2.0.7.tgz" + integrity sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw== + "@types/web-bluetooth@^0.0.20": version "0.0.20" resolved "https://mirrors.cloud.tencent.com/npm/@types/web-bluetooth/-/web-bluetooth-0.0.20.tgz" @@ -447,6 +452,13 @@ detect-libc@^2.0.3: resolved "https://mirrors.cloud.tencent.com/npm/detect-libc/-/detect-libc-2.1.2.tgz" integrity sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ== +dompurify@^3.2.5: + version "3.4.12" + resolved "https://mirrors.cloud.tencent.com/npm/dompurify/-/dompurify-3.4.12.tgz" + integrity sha512-zQvGet8Z2sWbQhCmfFz/T5QWH2oBmjnqK3qvOjaqaNLrLEF912WamU+ohnTp0TCep/MFVHpdJuCZEdFOdTnEFg== + optionalDependencies: + "@types/trusted-types" "^2.0.7" + dunder-proto@^1.0.1: version "1.0.1" resolved "https://mirrors.cloud.tencent.com/npm/dunder-proto/-/dunder-proto-1.0.1.tgz" @@ -1330,6 +1342,13 @@ vue-component-type-helpers@^3.2.4: resolved "https://mirrors.cloud.tencent.com/npm/vue-component-type-helpers/-/vue-component-type-helpers-3.2.6.tgz" integrity sha512-O02tnvIfOQVmnvoWwuSydwRoHjZVt8UEBR+2p4rT35p8GAy5VTlWP8o5qXfJR/GWCN0nVZoYWsVUvx2jwgdBmQ== +vue-dompurify-html@^5.3.0: + version "5.3.0" + resolved "https://mirrors.cloud.tencent.com/npm/vue-dompurify-html/-/vue-dompurify-html-5.3.0.tgz" + integrity sha512-HJQGBHbfSPcb6Mu97McdKbX7TqRHZa6Ji8OCpCNyuHca5QvQZ8IiuwghFPSO8OkSQfqXPNPKFMZdCOrnGGmOSQ== + dependencies: + dompurify "^3.2.5" + vue-router@^4.0.13: version "4.6.4" resolved "https://mirrors.cloud.tencent.com/npm/vue-router/-/vue-router-4.6.4.tgz" @@ -1337,7 +1356,7 @@ vue-router@^4.0.13: dependencies: "@vue/devtools-api" "^6.6.4" -vue@^3, vue@^3.2.0, vue@^3.2.25, vue@^3.3.0, vue@^3.3.8, vue@^3.5.0, vue@^3.5.13, "vue@2 || 3", vue@3.5.31: +vue@^3, vue@^3.2.0, vue@^3.2.25, vue@^3.3.0, vue@^3.3.8, vue@^3.4.36, vue@^3.5.0, vue@^3.5.13, "vue@2 || 3", vue@3.5.31: version "3.5.31" resolved "https://mirrors.cloud.tencent.com/npm/vue/-/vue-3.5.31.tgz" integrity sha512-iV/sU9SzOlmA/0tygSmjkEN6Jbs3nPoIPFhCMLD2STrjgOU8DX7ZtzMhg4ahVwf5Rp9KoFzcXeB1ZrVbLBp5/Q==