@xuda.io/ai_module 1.1.4236 → 1.1.4238

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 +23 -20
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4451,32 +4451,35 @@ const chat_note = async function (req, job_id, headers) {
4451
4451
  const { uid } = req;
4452
4452
  const account_profile_info = await account_module.get_active_account_profile_info(uid);
4453
4453
  let { prompt, conversation_doc, attachments = [], ai_agents } = req;
4454
+ try {
4455
+ const conversation_id = conversation_doc._id;
4454
4456
 
4455
- const conversation_id = conversation_doc._id;
4456
-
4457
- const sender_app_id = account_profile_info.app_id; //await account_module.get_account_default_project_id(uid);
4458
- let sender_conversation_doc = await db_module.get_app_couch_doc_native(sender_app_id, conversation_id);
4457
+ const sender_app_id = account_profile_info.app_id; //await account_module.get_account_default_project_id(uid);
4458
+ let sender_conversation_doc = await db_module.get_app_couch_doc_native(sender_app_id, conversation_id);
4459
4459
 
4460
- await attachment_handler(uid, sender_app_id, conversation_id, attachments, account_profile_info);
4460
+ await attachment_handler(uid, sender_app_id, conversation_id, attachments, account_profile_info);
4461
4461
 
4462
- const item = await client.conversations.items.create(conversation_id, {
4463
- items: [
4464
- {
4465
- type: 'message',
4466
- role: 'user',
4467
- content: [{ type: 'input_text', text: prompt }],
4468
- },
4469
- ],
4470
- });
4462
+ const item = await client.conversations.items.create(conversation_id, {
4463
+ items: [
4464
+ {
4465
+ type: 'message',
4466
+ role: 'user',
4467
+ content: [{ type: 'input_text', text: prompt }],
4468
+ },
4469
+ ],
4470
+ });
4471
4471
 
4472
- let obj = { id: item.data[0].id, ts: Date.now(), uid, read: true, conversation_type: 'note' };
4472
+ let obj = { id: item.data[0].id, ts: Date.now(), uid, read: true, conversation_type: 'note' };
4473
4473
 
4474
- sender_conversation_doc.messages.push(obj);
4475
- await db_module.save_app_couch_doc_native(sender_app_id, sender_conversation_doc);
4474
+ sender_conversation_doc.messages.push(obj);
4475
+ await db_module.save_app_couch_doc_native(sender_app_id, sender_conversation_doc);
4476
4476
 
4477
- await db_module.save_app_couch_doc(sender_app_id, { _id: obj.id, stat: 3, docType: 'chat_conversation_item', uid, conversation_type: obj.conversation_type, date_created_ts: obj.ts, conversation_id });
4477
+ await db_module.save_app_couch_doc_native(sender_app_id, { _id: obj.id, stat: 3, docType: 'chat_conversation_item', uid, conversation_type: obj.conversation_type, date_created_ts: obj.ts, conversation_id });
4478
4478
 
4479
- return { code: 15, data: item };
4479
+ return { code: 15, data: item };
4480
+ } catch (err) {
4481
+ return { code: -15, data: err.message };
4482
+ }
4480
4483
  };
4481
4484
 
4482
4485
  const ai_chat_conversation = async function (req, job_id, headers) {
@@ -6027,7 +6030,7 @@ export const modify_profile_avatar = async function (req, job_id, headers) {
6027
6030
 
6028
6031
  export const get_ai_workspace_pending_counts = async function (req, job_id, headers) {
6029
6032
  const { uid } = req;
6030
-
6033
+ debugger;
6031
6034
  try {
6032
6035
  const workspace_pending_counts_ret = await db_module.get_couch_view('xuda_team', 'pending_workspace_requests_count', {
6033
6036
  startkey: [uid, ''],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4236",
3
+ "version": "1.1.4238",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",