修复数组包数组的问题
This commit is contained in:
@@ -82,7 +82,7 @@ app.post("/v1/messages", (req, res) => {
|
|||||||
|
|
||||||
// 对于多条消息,只保留最后两条用户消息传入 chat,其他作为文件上传
|
// 对于多条消息,只保留最后两条用户消息传入 chat,其他作为文件上传
|
||||||
if(userMessage.length > 2) {
|
if(userMessage.length > 2) {
|
||||||
lastUserMessage = [userMessage.slice(-2)];
|
lastUserMessage = userMessage.slice(-2);
|
||||||
|
|
||||||
// user message to plaintext
|
// user message to plaintext
|
||||||
let previousMessages = userMessage.slice(0,userMessage.length-2).map((msg) => {
|
let previousMessages = userMessage.slice(0,userMessage.length-2).map((msg) => {
|
||||||
@@ -141,7 +141,7 @@ app.post("/v1/messages", (req, res) => {
|
|||||||
youcom_params.append("page", "0");
|
youcom_params.append("page", "0");
|
||||||
youcom_params.append("count", "0");
|
youcom_params.append("count", "0");
|
||||||
youcom_params.append("safeSearch", "Off");
|
youcom_params.append("safeSearch", "Off");
|
||||||
youcom_params.append("q", userQuery);
|
youcom_params.append("q", userQuery.trim());
|
||||||
youcom_params.append("incognito", "true");
|
youcom_params.append("incognito", "true");
|
||||||
youcom_params.append("chatId", msgid);
|
youcom_params.append("chatId", msgid);
|
||||||
youcom_params.append("traceId", msgid);
|
youcom_params.append("traceId", msgid);
|
||||||
@@ -197,7 +197,7 @@ app.post("/v1/messages", (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//console.log(chunk);
|
console.log(chunk);
|
||||||
if (chunk.indexOf("event: youChatToken\n") != -1) {
|
if (chunk.indexOf("event: youChatToken\n") != -1) {
|
||||||
chunk.split("\n").forEach((line) => {
|
chunk.split("\n").forEach((line) => {
|
||||||
if (line.startsWith(`data: {"youChatToken"`)) {
|
if (line.startsWith(`data: {"youChatToken"`)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user