@xuda.io/ai_module 1.1.4016 → 1.1.4018
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 +12 -14
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2384,7 +2384,7 @@ const get_user_ai_agents = async function (uid) {
|
|
|
2384
2384
|
};
|
|
2385
2385
|
|
|
2386
2386
|
export const get_ai_agents = async function (req, job_id, headers) {
|
|
2387
|
-
let { uid, _id, search, filter_type = 'all', limit, skip,
|
|
2387
|
+
let { uid, _id, search, filter_type = 'all', limit, skip, agent_id } = req;
|
|
2388
2388
|
|
|
2389
2389
|
try {
|
|
2390
2390
|
if (_id) {
|
|
@@ -2454,8 +2454,8 @@ export const get_ai_agents = async function (req, job_id, headers) {
|
|
|
2454
2454
|
};
|
|
2455
2455
|
}
|
|
2456
2456
|
|
|
2457
|
-
if (
|
|
2458
|
-
opt.selector._id =
|
|
2457
|
+
if (agent_id) {
|
|
2458
|
+
opt.selector._id = agent_id;
|
|
2459
2459
|
}
|
|
2460
2460
|
//////////////
|
|
2461
2461
|
|
|
@@ -2464,7 +2464,7 @@ export const get_ai_agents = async function (req, job_id, headers) {
|
|
|
2464
2464
|
let user_agents = { docs: [], total_docs: 0 };
|
|
2465
2465
|
if (filter_type !== 'pending') {
|
|
2466
2466
|
user_agents = await db_module.find_app_couch_query(app_id, opt);
|
|
2467
|
-
if (!limit ||
|
|
2467
|
+
if (!limit || agent_id) {
|
|
2468
2468
|
user_agents.total_docs = user_agents.docs.length;
|
|
2469
2469
|
} else {
|
|
2470
2470
|
delete opt.sort;
|
|
@@ -6420,19 +6420,17 @@ export const pin_ai_agent = async function (req) {
|
|
|
6420
6420
|
}
|
|
6421
6421
|
};
|
|
6422
6422
|
|
|
6423
|
-
export const
|
|
6424
|
-
const {
|
|
6423
|
+
export const unpin_ai_agent = async function (req) {
|
|
6424
|
+
const { uid, agent_id } = req;
|
|
6425
6425
|
try {
|
|
6426
|
-
const
|
|
6427
|
-
|
|
6428
|
-
return contact_ret;
|
|
6429
|
-
}
|
|
6430
|
-
var contact_doc = contact_ret.data;
|
|
6431
|
-
contact_doc.pinned = false;
|
|
6426
|
+
const app_id = await account_module.get_account_default_project_id(uid);
|
|
6427
|
+
const ai_agent_doc = await db_module.get_app_couch_doc_native(app_id, agent_id);
|
|
6432
6428
|
|
|
6433
|
-
|
|
6429
|
+
ai_agent_doc.studio_meta.pinned = false;
|
|
6434
6430
|
|
|
6435
|
-
|
|
6431
|
+
const save_ret = await db_module.save_app_couch_doc(app_id, ai_agent_doc);
|
|
6432
|
+
|
|
6433
|
+
return save_ret;
|
|
6436
6434
|
} catch (err) {
|
|
6437
6435
|
return {
|
|
6438
6436
|
code: -24,
|