1
- // @version 0.0.8 更新 OpenAI 3.5 模型 & 并新增 Axios 超时配置,避免无响应问题
1
+ // @version 0.0.9 调整了 axios 的报错的输出,以便于调试。
2
2
const aircode = require ( "aircode" ) ;
3
3
const lark = require ( "@larksuiteoapi/node-sdk" ) ;
4
4
var axios = require ( "axios" ) ;
@@ -137,7 +137,6 @@ async function cmdClear(sessionId, messageId) {
137
137
138
138
// 通过 OpenAI API 获取回复
139
139
async function getOpenAIReply ( prompt ) {
140
- logger ( "send prompt: " + JSON . stringify ( prompt ) ) ;
141
140
142
141
var data = JSON . stringify ( {
143
142
model : OPENAI_MODEL ,
@@ -166,7 +165,7 @@ async function getOpenAIReply(prompt) {
166
165
return response . data . choices [ 0 ] . message . content . replace ( "\n\n" , "" ) ;
167
166
168
167
} catch ( e ) {
169
- logger ( e )
168
+ logger ( e . response . data )
170
169
return "问题太难了 出错了. (uДu〃)." ;
171
170
}
172
171
@@ -257,7 +256,6 @@ async function doctor() {
257
256
}
258
257
259
258
async function handleReply ( userInput , sessionId , messageId , eventId ) {
260
- logger ( "userInput: " + userInput ) ;
261
259
const question = userInput . text . replace ( "@_user_1" , "" ) ;
262
260
logger ( "question: " + question ) ;
263
261
const action = question . trim ( ) ;
@@ -271,7 +269,6 @@ async function handleReply(userInput, sessionId, messageId, eventId) {
271
269
272
270
// update content to the event record
273
271
const evt_record = await EventDB . where ( { event_id : eventId } ) . findOne ( ) ;
274
- console . log ( evt_record ) ;
275
272
evt_record . content = userInput . text ;
276
273
await EventDB . save ( evt_record ) ;
277
274
return { code : 0 } ;
@@ -312,7 +309,7 @@ module.exports = async function (params, context) {
312
309
// 对于同一个事件,只处理一次
313
310
const count = await EventDB . where ( { event_id : eventId } ) . count ( ) ;
314
311
if ( count != 0 ) {
315
- logger ( "deal repeat event" ) ;
312
+ logger ( "skip repeat event" ) ;
316
313
return { code : 1 } ;
317
314
}
318
315
await EventDB . save ( { event_id : eventId } ) ;
0 commit comments