Browse Source

aichat跳转路由

master
xueyinfei 2 weeks ago
parent
commit
4c7b0bd133
  1. 2
      vue-fastapi-frontend/src/views/aichat/MdRenderer.vue
  2. 7
      vue-fastapi-frontend/src/views/aichat/aichat.vue

2
vue-fastapi-frontend/src/views/aichat/MdRenderer.vue

@ -21,7 +21,7 @@
</div>
</div>
<div v-if="item.type === 'router'" style="width: 100%;margin-top: 5px">
<el-link :underline="false" @click="jumpToPath(item.content)">{{'跳转'+ item.content.name}}</el-link>
<el-link :underline="false" type="primary" @click="jumpToPath(item.content)">{{'点击跳转'+ item.content.name}}</el-link>
</div>
<div v-else style="width: 100%;margin-top: 5px">
<markdown :markdown-string="item.content"></markdown>

7
vue-fastapi-frontend/src/views/aichat/aichat.vue

@ -494,7 +494,6 @@ const getWrite = (reader) => {
if (done) return;
const decoder = new TextDecoder('utf-8');
let str = decoder.decode(value, { stream: true });
console.log(str)
tempResult += str;
// 2使
@ -524,7 +523,7 @@ const getWrite = (reader) => {
const processChunk = (chunk) => {
const lastMsg = chatList.value[chatList.value.length - 1];
console.log(chunk)
// 5
if (chunk.docs?.length) {
lastMsg.content.push({ content: chunk.docs, type: "docs" });
@ -534,7 +533,7 @@ const getWrite = (reader) => {
lastMsg.content.push({ content: chunk.html_image, type: "html_image" });
} else if (chunk.table?.length) {
lastMsg.content.push({ content: chunk.table, type: "table" });
} else if (chunk.router?.length) {
} else if (chunk.router) {
lastMsg.content.push({ content: chunk.router, type: "router" });
} else if (chunk.choices?.length) {
// 6
@ -547,7 +546,6 @@ const getWrite = (reader) => {
? content.replace(/\n{2,}/g, '\n\n')
: content.replace(/\n/g, ' ');
const lastContent = lastMsg.content[lastMsg.content.length - 1];
console.log(lastContent)
if (lastContent?.type === "text") {
lastContent.content += text;
} else {
@ -558,7 +556,6 @@ const getWrite = (reader) => {
// 7
if (chunk.isEnd || chunk.is_end) {
lastMsg.isEnd = true;
console.log(lastMsg)
lastMsg.time = formatDate(new Date());
}

Loading…
Cancel
Save