Tue May 30 02:40:00 UTC 2023 inscode

上级 e5e6b3c8
......@@ -7,7 +7,7 @@
</div>
<template v-for="(item, index) in dialogs" :key="index">
<div class="dialog-item" :class="{ 'dialog-item-me': item.role === 'me', 'dialog-item-ai': item.role === 'ai' }">
<div class="dialog-item-main">renderMarkdown({{ item.text }})</div>
<div class="dialog-item-main">{{ renderMarkdown(item.text,item.role) }}</div>
</div>
</template>
</div>
......@@ -25,7 +25,7 @@
</div>
</template>
<script>
import marked from 'marked';
import { marked } from '/node_modules/.vite/deps/marked.js';
import Prism from 'prismjs';
import 'prismjs/themes/prism-okaidia.css';
import { fetchEventSource } from '@microsoft/fetch-event-source';
......@@ -113,7 +113,9 @@ export default {
handleNewChat() {
this.dialogs = [];
},
renderMarkdown(text) {
renderMarkdown(text,role) {
if(role == 'me')
return text;
marked.setOptions({
highlight: function (code, lang) {
if (Prism.languages.hasOwnProperty(lang)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册