mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-10-09 15:03:21 +08:00
askAi进度条支持markdown
This commit is contained in:
@@ -41,7 +41,6 @@
|
||||
|
||||
<script>
|
||||
import { defineComponent } from "vue";
|
||||
import DOMPurify from "dompurify";
|
||||
|
||||
export default defineComponent({
|
||||
name: "AIChatHistory",
|
||||
@@ -82,15 +81,7 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
getAssistantMsg(content) {
|
||||
const markedContent = quickcommand.markdownParse(content.trim());
|
||||
const processedContent = markedContent
|
||||
.replace("<p><think>", "<think><p>")
|
||||
.replace("</think></p>", "</p></think>")
|
||||
.replace("<think>\n\n</think>", "");
|
||||
const purifiedContent = DOMPurify.sanitize(processedContent, {
|
||||
ADD_TAGS: ["think"],
|
||||
});
|
||||
return purifiedContent;
|
||||
return window.aiResponseParser(content);
|
||||
},
|
||||
|
||||
getUserMsg(content) {
|
||||
|
@@ -56,7 +56,6 @@
|
||||
import CommandTypeTag from "../CommandTypeTag.vue";
|
||||
import platformTypes from "js/options/platformTypes.js";
|
||||
import programs from "js/options/programs.js";
|
||||
import DOMPurify from "dompurify";
|
||||
|
||||
export default {
|
||||
name: "DenseLayout",
|
||||
@@ -90,7 +89,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
purify(content) {
|
||||
return DOMPurify.sanitize(content);
|
||||
return window.DOMPurify.sanitize(content);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@@ -51,7 +51,6 @@
|
||||
import CommandTypeTag from "../CommandTypeTag.vue";
|
||||
import platformTypes from "js/options/platformTypes.js";
|
||||
import programs from "js/options/programs.js";
|
||||
import DOMPurify from "dompurify";
|
||||
|
||||
export default {
|
||||
name: "ListLayout",
|
||||
@@ -82,7 +81,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
purify(content) {
|
||||
return DOMPurify.sanitize(content);
|
||||
return window.DOMPurify.sanitize(content);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@@ -35,7 +35,6 @@
|
||||
<script>
|
||||
import CommandTypeTag from "../CommandTypeTag.vue";
|
||||
import platformTypes from "js/options/platformTypes.js";
|
||||
import DOMPurify from "dompurify";
|
||||
|
||||
export default {
|
||||
name: "MiniLayout",
|
||||
@@ -52,7 +51,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
purify(content) {
|
||||
return DOMPurify.sanitize(content);
|
||||
return window.DOMPurify.sanitize(content);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@@ -11,7 +11,7 @@
|
||||
</q-card-section>
|
||||
<q-card-section
|
||||
v-if="options.isHtml"
|
||||
v-html="options.message"
|
||||
v-html="purify(options.message)"
|
||||
class="content"
|
||||
/>
|
||||
<q-card-section v-else v-text="options.message" class="content" />
|
||||
@@ -32,6 +32,9 @@ export default {
|
||||
this.$emit("clickOK", true);
|
||||
this.hide();
|
||||
},
|
||||
purify(html) {
|
||||
return window.DOMPurify.sanitize(html);
|
||||
},
|
||||
},
|
||||
props: {
|
||||
options: Object,
|
||||
|
@@ -85,3 +85,8 @@
|
||||
color: #007bff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.markdown hr {
|
||||
border-style: solid;
|
||||
border-width: 0.5px;
|
||||
}
|
||||
|
Reference in New Issue
Block a user