@xuda.io/ai_module 1.1.4011 → 1.1.4013

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.
Files changed (2) hide show
  1. package/index.mjs +42 -2
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -5146,14 +5146,14 @@ const ai_chat_conversation = async function (req, job_id, headers) {
5146
5146
  try {
5147
5147
  const obj = { id: output?.output?.[0]?.id, ts: Date.now(), ai_agent_id: output.state._currentAgent.name, attachments };
5148
5148
  conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_id);
5149
- debugger;
5149
+
5150
5150
  conversation_doc.ts = Date.now();
5151
5151
  conversation_doc.stat = 3;
5152
5152
  conversation_doc.messages.push(obj);
5153
5153
 
5154
5154
  let inputTokens = output?.state?._context.usage?.inputTokens || 0;
5155
5155
  let outputTokens = output?.state?._context?.usage?.outputTokens || 0;
5156
- debugger;
5156
+
5157
5157
  for (const item of output?.state?._modelResponses || []) {
5158
5158
  inputTokens += item.usage.inputTokens;
5159
5159
  outputTokens += item.usage.outputTokens;
@@ -6395,3 +6395,43 @@ export const create_mini_app = async function (req, job_id, headers) {
6395
6395
  return { code: -33, data: err.message || String(err) };
6396
6396
  }
6397
6397
  };
6398
+
6399
+ export const pin_ai_agent = async function (req) {
6400
+ const { uid, ai_agent_id } = req;
6401
+ try {
6402
+ const app_id = await account_module.get_account_default_project_id(uid);
6403
+ const ai_agent_doc = await db_module.get_app_couch_doc_native(app_id, ai_agent_id);
6404
+
6405
+ ai_agent_doc.studio_meta.pinned = true;
6406
+
6407
+ const contact_save_ret = await db_module.save_couch_doc('xuda_contacts', contact_doc);
6408
+
6409
+ return contact_save_ret;
6410
+ } catch (err) {
6411
+ return {
6412
+ code: -24,
6413
+ data: err.message,
6414
+ };
6415
+ }
6416
+ };
6417
+
6418
+ export const unpin_contact = async function (req) {
6419
+ const { contact_id } = req;
6420
+ try {
6421
+ const contact_ret = await db_module.get_couch_doc('xuda_contacts', contact_id);
6422
+ if (contact_ret.code < 0) {
6423
+ return contact_ret;
6424
+ }
6425
+ var contact_doc = contact_ret.data;
6426
+ contact_doc.pinned = false;
6427
+
6428
+ const contact_save_ret = await db_module.save_couch_doc('xuda_contacts', contact_doc);
6429
+
6430
+ return contact_save_ret;
6431
+ } catch (err) {
6432
+ return {
6433
+ code: -24,
6434
+ data: err.message,
6435
+ };
6436
+ }
6437
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4011",
3
+ "version": "1.1.4013",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",