@xuda.io/ai_module 1.1.4138 → 1.1.4140

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 +12 -12
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1724,7 +1724,7 @@ export const get_chat_conversation = async function (req) {
1724
1724
  export const get_ai_chats = async function (req, job_id, headers) {
1725
1725
  let { uid, reference_id, _id, search, filter_type = 'all', conversation_type, limit, skip, conversation_id } = req;
1726
1726
 
1727
- const active_account_profile_info = await account_module.get_active_account_profile_info(uid);
1727
+ const account_profile_info = await account_module.get_active_account_profile_info(uid);
1728
1728
 
1729
1729
  const get_conversation_background = function (doc) {
1730
1730
  let deg = 145;
@@ -1863,7 +1863,7 @@ export const get_ai_chats = async function (req, job_id, headers) {
1863
1863
  let ai_chats = { docs: [], total_docs: 0 };
1864
1864
 
1865
1865
  if (filter_type !== 'pending') {
1866
- ai_chats = await db_module.find_app_couch_query(active_account_profile_info.app_id, opt);
1866
+ ai_chats = await db_module.find_app_couch_query(account_profile_info.app_id, opt);
1867
1867
  if (!limit || conversation_id) {
1868
1868
  ai_chats.total_docs = ai_chats.docs.length;
1869
1869
  } else {
@@ -1872,7 +1872,7 @@ export const get_ai_chats = async function (req, job_id, headers) {
1872
1872
  opt.limit = 9999;
1873
1873
  opt.fields = ['_id'];
1874
1874
 
1875
- const counter = await db_module.find_app_couch_query(active_account_profile_info.app_id, opt);
1875
+ const counter = await db_module.find_app_couch_query(account_profile_info.app_id, opt);
1876
1876
  ai_chats.total_docs = counter.docs.length;
1877
1877
  }
1878
1878
  }
@@ -1966,7 +1966,7 @@ export const archive_ai_chat = async function (req) {
1966
1966
 
1967
1967
  let conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_id);
1968
1968
  debugger;
1969
- if (conversation_doc.uid !== uid && conversation_doc?.active_account_profile_info?.account_profile_obj?.shared_from_uid !== uid) {
1969
+ if (conversation_doc.uid !== uid && conversation_doc?.account_profile_info?.account_profile_obj?.shared_from_uid !== uid) {
1970
1970
  throw new Error('Operation not allowed');
1971
1971
  }
1972
1972
 
@@ -4175,7 +4175,7 @@ export const create_conversation = async function (req, job_id, headers) {
4175
4175
  const { uid, prompt } = req;
4176
4176
  let { reference_type, reference_id = '', conversation_type } = req;
4177
4177
 
4178
- const active_account_profile_info = await account_module.get_active_account_profile_info(uid);
4178
+ const account_profile_info = await account_module.get_active_account_profile_info(uid);
4179
4179
 
4180
4180
  const app_id = await account_module.get_account_default_project_id(uid);
4181
4181
 
@@ -4196,10 +4196,10 @@ export const create_conversation = async function (req, job_id, headers) {
4196
4196
  conversation_obj,
4197
4197
  conversation_type,
4198
4198
  initiator_uid: uid,
4199
- // account_profile_id: active_account_profile_info.account_profile_id,
4200
- active_account_profile_info,
4199
+ // account_profile_id: account_profile_info.account_profile_id,
4200
+ account_profile_info,
4201
4201
  };
4202
- const save_ret = await db_module.save_app_couch_doc(active_account_profile_info.app_id, conversation_doc);
4202
+ const save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, conversation_doc);
4203
4203
 
4204
4204
  let contact_uid_chat_conversation, receiver_contact_id, receiver_contact_doc;
4205
4205
 
@@ -4227,12 +4227,12 @@ export const create_conversation = async function (req, job_id, headers) {
4227
4227
 
4228
4228
  setTimeout(async () => {
4229
4229
  // Ask GPT for title
4230
- const title = await submit_chat_gpt_prompt({ uid, prompt: `create title for the prompt return 5 words result maximum text only without options : ${prompt}`, model: 'gpt-5-nano', metadata: { conversation_id: conversation_doc._id, func: 'create_conversation' } });
4230
+ const title = await submit_chat_gpt_prompt({ uid, prompt: `create title for the prompt return 5 words result maximum text only without options : ${prompt}`, model: 'gpt-5-nano', metadata: { conversation_id: conversation_doc._id, func: 'create_conversation' }, account_profile_info });
4231
4231
 
4232
- conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_obj.id);
4232
+ conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_obj.id);
4233
4233
  conversation_doc.title = title.data;
4234
4234
 
4235
- await db_module.save_app_couch_doc_native(app_id, conversation_doc);
4235
+ await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_doc);
4236
4236
 
4237
4237
  await update_thumbnail('conversation', conversation_doc, app_id, uid, job_id, headers);
4238
4238
 
@@ -4241,7 +4241,7 @@ export const create_conversation = async function (req, job_id, headers) {
4241
4241
  // write conversation to host after thumbnail update
4242
4242
  // get sender conversation
4243
4243
 
4244
- const sender_conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_obj.id);
4244
+ const sender_conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_obj.id);
4245
4245
  const receiver_app_id = await account_module.get_account_default_project_id(contact_uid_chat_conversation);
4246
4246
 
4247
4247
  let receiver_conversation_doc = await db_module.get_app_couch_doc_native(receiver_app_id, conversation_obj.id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4138",
3
+ "version": "1.1.4140",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",