Add thinking support for chat (#220)
Co-authored-by: AceDataCloud <office@acedata.cloud>
This commit is contained in:
1 parent
68ae661cf2
commit
4e5ef549ad
3 files changed
+22
-2
No files matched your search
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"type": "minor",
|
||||||
|
"comment": "add thinking support in chat",
|
||||||
|
"packageName": "@acedatacloud/nexior",
|
||||||
|
"email": "office@acedata.cloud",
|
||||||
|
"dependentChangeType": "patch"
|
||||||
|
}
|
||||||
@@ -58,3 +58,13 @@ pre button {
|
|||||||
.markdown-body hr {
|
.markdown-body hr {
|
||||||
height: 1px !important;
|
height: 1px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.markdown-body .think {
|
||||||
|
// white-space: pre-wrap;
|
||||||
|
line-height: inherit;
|
||||||
|
border-left: 3px solid var(--el-border-color);
|
||||||
|
padding-left: 10px;
|
||||||
|
line-height: 20px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--el-text-color-regular);
|
||||||
|
}
|
||||||
@@ -19,7 +19,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
setup(props, { attrs }) {
|
setup(props, { attrs }) {
|
||||||
const md = new MarkdownIt(props.options).use(katex as any, {
|
const md = new MarkdownIt({ ...props.options, html: true }).use(katex as any, {
|
||||||
delimiters: 'all',
|
delimiters: 'all',
|
||||||
throwOnError: false,
|
throwOnError: false,
|
||||||
errorColor: '#cc0000',
|
errorColor: '#cc0000',
|
||||||
@@ -28,7 +28,10 @@ export default defineComponent({
|
|||||||
|
|
||||||
const content = computed(() => {
|
const content = computed(() => {
|
||||||
const src = props.source;
|
const src = props.source;
|
||||||
return md?.render(src);
|
return md
|
||||||
|
?.render(src)
|
||||||
|
.replace(/<think>/g, `<div class="think">`)
|
||||||
|
.replace(/<\/think>/g, `</div>`);
|
||||||
});
|
});
|
||||||
|
|
||||||
return () =>
|
return () =>
|
||||||
|
|||||||
Reference in new issue
Block a user