This commit is contained in:
shaoyongjun 2024-05-16 19:55:15 +08:00
parent 8aef5f48be
commit 77ef0fde0a

View File

@ -27,6 +27,7 @@
overflow-y: scroll;
border-bottom: 1px solid #ccc;
padding-bottom: 10px;
white-space: pre-line;
}
#user-input {
@ -56,6 +57,10 @@
color: #000;
}
.gpt span{
white-space: pre-line;
}
.sender {
font-weight: bold;
}
@ -131,7 +136,7 @@
// body
body,
// 收到事件时的回调。这里将事件的data显示在htmlSpanElement中
(event) => {const content = getContent(event.data); if (content) htmlSpanElement.innerHTML += content},
(event) => {const content = getContent(event.data); if (content) htmlSpanElement.innerHTML += content.toString()},
// 结束时的回调。1.将消息添加到历史消息中 2.将等待状态设置为false
() => {addMessage("assistant", htmlSpanElement.innerHTML); waiting = false},
// 发生错误时的回调