|
@@ -30,7 +30,7 @@
|
|
|
<span v-else>{{ userInfo.name }}</span>
|
|
|
</div>
|
|
|
<div class="chat" :class="{ botChat: item.role == 'assistant' }">
|
|
|
- <span>{{ item.content }}</span>
|
|
|
+ <span v-html="item.content"></span>
|
|
|
</div>
|
|
|
</template>
|
|
|
</div>
|
|
@@ -65,6 +65,7 @@ const userInfo = ref({});
|
|
|
const resultData = ref("");
|
|
|
const disabled = ref(false);
|
|
|
const chatBox = ref(null);
|
|
|
+const lastChat = ref("");
|
|
|
const msg = ref([
|
|
|
{
|
|
|
role: "system",
|
|
@@ -120,9 +121,15 @@ const enterChat = () => {
|
|
|
// console.log("原:", message);
|
|
|
let newMsg = message
|
|
|
.replace(/data:/gi, "")
|
|
|
- .replace("\n", "")
|
|
|
+ .replace(/\n/gi, "")
|
|
|
+ if(newMsg == "" && lastChat.value == ""){
|
|
|
+ newMsg = "</br>"
|
|
|
+ }else{
|
|
|
+ lastChat.value = newMsg
|
|
|
+ }
|
|
|
+ // .replace("\n", "")
|
|
|
// console.log("改:", newMsg);
|
|
|
- let v = resultData.value.replace("\n", "") + newMsg.replace("\n", "");
|
|
|
+ let v = resultData.value+ newMsg;
|
|
|
resultData.value = v;
|
|
|
msg.value[msg.value.length - 1].content = resultData.value;
|
|
|
return reader.read().then(processText);
|