const { data } = await checkCensor({ msg: `${this.content}用中文回答` });
if (data.data) {
const object = {
content: "您的问题不在我的能力范围之内。",
role: "assistant",
};
this.chatList.push(object);
$(".ai-content .content").animate({ scrollTop: 900000 }, 400);
this.loading = false;
this.content = "";
return;
}
$(".ai-content .content").animate({ scrollTop: 900000 }, 400);
this.content = "";
try {
const response = await fetch("https://www.chatbase.co/api/v1/chat", {
method: "POST",
headers: {
Authorization: this.botInfo.authorization,
},
body: JSON.stringify({
messages: [...this.chatList].slice(-5),
chatId: this.botInfo.chatId,
stream: this.botInfo.stream,
model: this.botInfo.model,
}),
});
const data = response.body;
if (!data) {
// error happened
}
const reader = data.getReader();
const decoder = new TextDecoder();
let done = false;
const object2