@xuda.io/ai_module 1.1.5582 → 1.1.5583
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +17 -37
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2283,49 +2283,29 @@ export const unarchive_ai_agent = async function (req) {
|
|
|
2283
2283
|
};
|
|
2284
2284
|
|
|
2285
2285
|
const update_agent_conversation_items_stat = async function (app_id, agent_id, stat, conversation_id) {
|
|
2286
|
-
const
|
|
2287
|
-
|
|
2288
|
-
if (conversation_id) {
|
|
2289
|
-
conversation_ids.push(conversation_id);
|
|
2290
|
-
} else {
|
|
2291
|
-
const conversations_ret = await db_module.find_app_couch_query(app_id, {
|
|
2292
|
-
selector: {
|
|
2293
|
-
docType: 'chat_conversation',
|
|
2294
|
-
reference_id: agent_id,
|
|
2295
|
-
},
|
|
2296
|
-
fields: ['_id'],
|
|
2297
|
-
limit: 9999,
|
|
2298
|
-
});
|
|
2299
|
-
|
|
2300
|
-
conversation_ids.push(...(conversations_ret.docs || []).map((doc) => doc._id).filter(Boolean));
|
|
2301
|
-
}
|
|
2302
|
-
|
|
2303
|
-
let updated = 0;
|
|
2286
|
+
const target_conversation_id = conversation_id || agent_id;
|
|
2304
2287
|
const ts = Date.now();
|
|
2305
2288
|
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
});
|
|
2289
|
+
const items_ret = await db_module.find_app_couch_query(app_id, {
|
|
2290
|
+
selector: {
|
|
2291
|
+
docType: 'chat_conversation_item',
|
|
2292
|
+
conversation_id: target_conversation_id,
|
|
2293
|
+
stat: { $lt: 4 },
|
|
2294
|
+
},
|
|
2295
|
+
limit: 9999,
|
|
2296
|
+
});
|
|
2315
2297
|
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2298
|
+
const docs = (items_ret.docs || []).map((doc) => ({
|
|
2299
|
+
...doc,
|
|
2300
|
+
stat,
|
|
2301
|
+
ts,
|
|
2302
|
+
}));
|
|
2321
2303
|
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
updated += docs.length;
|
|
2325
|
-
}
|
|
2304
|
+
if (docs.length) {
|
|
2305
|
+
await db_module.sava_app_couch_bulk_docs(app_id, docs);
|
|
2326
2306
|
}
|
|
2327
2307
|
|
|
2328
|
-
return
|
|
2308
|
+
return docs.length;
|
|
2329
2309
|
};
|
|
2330
2310
|
|
|
2331
2311
|
export const archive_ai_agent = async function (req) {
|