Skip to content

Commit bda6087

Browse files
authored
Update event.js
1 parent 3e36220 commit bda6087

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

event.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @version 0.0.8 更新 OpenAI 3.5 模型 & 并新增 Axios 超时配置,避免无响应问题
1+
// @version 0.0.9 调整了 axios 的报错的输出,以便于调试。
22
const aircode = require("aircode");
33
const lark = require("@larksuiteoapi/node-sdk");
44
var axios = require("axios");
@@ -137,7 +137,6 @@ async function cmdClear(sessionId, messageId) {
137137

138138
// 通过 OpenAI API 获取回复
139139
async function getOpenAIReply(prompt) {
140-
logger("send prompt: " + JSON.stringify(prompt));
141140

142141
var data = JSON.stringify({
143142
model: OPENAI_MODEL,
@@ -166,7 +165,7 @@ async function getOpenAIReply(prompt) {
166165
return response.data.choices[0].message.content.replace("\n\n", "");
167166

168167
}catch(e){
169-
logger(e)
168+
logger(e.response.data)
170169
return "问题太难了 出错了. (uДu〃).";
171170
}
172171

@@ -257,7 +256,6 @@ async function doctor() {
257256
}
258257

259258
async function handleReply(userInput, sessionId, messageId, eventId) {
260-
logger("userInput: " + userInput);
261259
const question = userInput.text.replace("@_user_1", "");
262260
logger("question: " + question);
263261
const action = question.trim();
@@ -271,7 +269,6 @@ async function handleReply(userInput, sessionId, messageId, eventId) {
271269

272270
// update content to the event record
273271
const evt_record = await EventDB.where({ event_id: eventId }).findOne();
274-
console.log(evt_record);
275272
evt_record.content = userInput.text;
276273
await EventDB.save(evt_record);
277274
return { code: 0 };
@@ -312,7 +309,7 @@ module.exports = async function (params, context) {
312309
// 对于同一个事件,只处理一次
313310
const count = await EventDB.where({ event_id: eventId }).count();
314311
if (count != 0) {
315-
logger("deal repeat event");
312+
logger("skip repeat event");
316313
return { code: 1 };
317314
}
318315
await EventDB.save({ event_id: eventId });

0 commit comments

Comments
 (0)