@xuda.io/ai_module 1.1.4949 → 1.1.4950

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 +36 -36
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1082,7 +1082,7 @@ const check_studio_doc_tool = tool({
1082
1082
  export const get_chat_conversation = async function (req) {
1083
1083
  let { conversation_id, order = 'asc', limit = 9999, skip = 0, _id, uid } = req;
1084
1084
 
1085
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
1085
+ const account_profile_info = await get_active_account_profile_info(uid);
1086
1086
 
1087
1087
  if (_id) {
1088
1088
  let data = await db_module.get_app_couch_doc(account_profile_info.app_id, _id);
@@ -1125,7 +1125,7 @@ export const get_chat_conversation = async function (req) {
1125
1125
  export const get_ai_chats = async function (req, job_id, headers) {
1126
1126
  let { uid, reference_id, _id, search, filter_type = 'all', conversation_type, limit, skip, conversation_id, profile_id } = req;
1127
1127
 
1128
- const account_profile_info = await account_ms.get_active_account_profile_info(uid, profile_id);
1128
+ const account_profile_info = await get_active_account_profile_info(uid, profile_id);
1129
1129
 
1130
1130
  const get_conversation_background = function (doc) {
1131
1131
  let deg = 145;
@@ -1359,7 +1359,7 @@ export const get_ai_chats = async function (req, job_id, headers) {
1359
1359
  export const delete_ai_chat = async function (req) {
1360
1360
  let { conversation_id, uid } = req;
1361
1361
 
1362
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
1362
+ const account_profile_info = await get_active_account_profile_info(uid);
1363
1363
 
1364
1364
  const app_id = await account_ms.get_account_default_project_id(uid);
1365
1365
  let conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_id);
@@ -1402,7 +1402,7 @@ export const delete_ai_chat = async function (req) {
1402
1402
  export const archive_ai_chat = async function (req) {
1403
1403
  let { conversation_id, uid } = req;
1404
1404
 
1405
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
1405
+ const account_profile_info = await get_active_account_profile_info(uid);
1406
1406
 
1407
1407
  try {
1408
1408
  await team_ms.validate_share_exist(uid, 'chat', conversation_id);
@@ -1425,7 +1425,7 @@ export const archive_ai_chat = async function (req) {
1425
1425
 
1426
1426
  export const unarchive_ai_chat = async function (req) {
1427
1427
  let { conversation_id, uid } = req;
1428
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
1428
+ const account_profile_info = await get_active_account_profile_info(uid);
1429
1429
 
1430
1430
  try {
1431
1431
  let conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_id);
@@ -1522,7 +1522,7 @@ const create_image = async function (uid, prompt, model = 'gpt-image-1-mini', si
1522
1522
 
1523
1523
  const get_studio_doc = async function (req) {
1524
1524
  let { uid, _id } = req;
1525
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
1525
+ const account_profile_info = await get_active_account_profile_info(uid);
1526
1526
 
1527
1527
  const app_id = await account_ms.get_account_default_project_id(uid);
1528
1528
  try {
@@ -1842,7 +1842,7 @@ export const get_ai_agent_info = async function (uid, job_id, headers, doc, from
1842
1842
  };
1843
1843
 
1844
1844
  const get_user_ai_agents = async function (uid) {
1845
- // const account_profile_info = await account_ms.get_active_account_profile_info(uid);
1845
+ // const account_profile_info = await get_active_account_profile_info(uid);
1846
1846
 
1847
1847
  let opt = {
1848
1848
  selector: {
@@ -1856,7 +1856,7 @@ const get_user_ai_agents = async function (uid) {
1856
1856
 
1857
1857
  export const get_ai_agents = async function (req, job_id, headers) {
1858
1858
  let { uid, _id, search, filter_type = 'all', limit, skip, agent_id, profile_id } = req;
1859
- const account_profile_info = await account_ms.get_active_account_profile_info(uid, profile_id);
1859
+ const account_profile_info = await get_active_account_profile_info(uid, profile_id);
1860
1860
  try {
1861
1861
  if (_id) {
1862
1862
  let doc_ret = await get_studio_doc({ _id, uid });
@@ -2021,7 +2021,7 @@ export const get_ai_agents = async function (req, job_id, headers) {
2021
2021
  export const delete_ai_agent = async function (req) {
2022
2022
  let { agent_id, uid, app_id } = req;
2023
2023
 
2024
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
2024
+ const account_profile_info = await get_active_account_profile_info(uid);
2025
2025
 
2026
2026
  // const project_db = await get_account_project_db(uid);
2027
2027
 
@@ -2063,7 +2063,7 @@ export const delete_ai_agent = async function (req) {
2063
2063
  export const uninstall_ai_agent = async function (req) {
2064
2064
  let { agent_id, uid } = req;
2065
2065
 
2066
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
2066
+ const account_profile_info = await get_active_account_profile_info(uid);
2067
2067
 
2068
2068
  try {
2069
2069
  let agent_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, agent_id);
@@ -2085,7 +2085,7 @@ export const uninstall_ai_agent = async function (req) {
2085
2085
  export const unarchive_ai_agent = async function (req) {
2086
2086
  let { agent_id, uid } = req;
2087
2087
 
2088
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
2088
+ const account_profile_info = await get_active_account_profile_info(uid);
2089
2089
 
2090
2090
  try {
2091
2091
  let agent_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, agent_id);
@@ -2106,7 +2106,7 @@ export const unarchive_ai_agent = async function (req) {
2106
2106
  };
2107
2107
  export const archive_ai_agent = async function (req) {
2108
2108
  let { agent_id, uid } = req;
2109
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
2109
+ const account_profile_info = await get_active_account_profile_info(uid);
2110
2110
 
2111
2111
  try {
2112
2112
  await team_ms.validate_share_exist(uid, 'ai_agent', agent_id);
@@ -2130,7 +2130,7 @@ export const archive_ai_agent = async function (req) {
2130
2130
  export const archive_mini_app = async function (req) {
2131
2131
  let { prog_id, uid } = req;
2132
2132
 
2133
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
2133
+ const account_profile_info = await get_active_account_profile_info(uid);
2134
2134
 
2135
2135
  try {
2136
2136
  await team_ms.validate_share_exist(uid, 'miniapp', prog_id);
@@ -2154,7 +2154,7 @@ export const archive_mini_app = async function (req) {
2154
2154
  export const unarchive_mini_app = async function (req) {
2155
2155
  let { prog_id, uid } = req;
2156
2156
 
2157
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
2157
+ const account_profile_info = await get_active_account_profile_info(uid);
2158
2158
 
2159
2159
  try {
2160
2160
  let prog_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, prog_id);
@@ -2176,7 +2176,7 @@ export const unarchive_mini_app = async function (req) {
2176
2176
  export const delete_mini_app = async function (req) {
2177
2177
  let { prog_id, uid } = req;
2178
2178
 
2179
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
2179
+ const account_profile_info = await get_active_account_profile_info(uid);
2180
2180
 
2181
2181
  try {
2182
2182
  let prog_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, prog_id);
@@ -2205,7 +2205,7 @@ export const delete_mini_app = async function (req) {
2205
2205
  export const update_ai_agent = async function (req, job_id, headers) {
2206
2206
  let { agent_id, agentConfig, uid } = req;
2207
2207
 
2208
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
2208
+ const account_profile_info = await get_active_account_profile_info(uid);
2209
2209
 
2210
2210
  try {
2211
2211
  let agent_doc = await await db_module.get_app_couch_doc_native(account_profile_info.app_id, agent_id);
@@ -2246,7 +2246,7 @@ export const update_ai_agent = async function (req, job_id, headers) {
2246
2246
 
2247
2247
  export const get_apps = async function (req, job_id, headers) {
2248
2248
  let { uid, _id, search, filter_type = 'all', limit, skip, mini_app_id, profile_id } = req;
2249
- const account_profile_info = await account_ms.get_active_account_profile_info(uid, profile_id);
2249
+ const account_profile_info = await get_active_account_profile_info(uid, profile_id);
2250
2250
  try {
2251
2251
  if (_id) return await get_studio_doc({ _id, uid });
2252
2252
  ///////////////
@@ -2388,7 +2388,7 @@ export const get_apps = async function (req, job_id, headers) {
2388
2388
  // };
2389
2389
 
2390
2390
  const upload_agent_files = async function (uid, agent_doc) {
2391
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
2391
+ const account_profile_info = await get_active_account_profile_info(uid);
2392
2392
 
2393
2393
  let { agentConfig } = agent_doc;
2394
2394
  for await (let tool of agentConfig.agent_tools || []) {
@@ -2572,7 +2572,7 @@ const upload_agent_files = async function (uid, agent_doc) {
2572
2572
 
2573
2573
  const save_agent_status = async function (uid, agent_id, stat, agentConfig) {
2574
2574
  // const project_db = await get_account_project_db(uid);
2575
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
2575
+ const account_profile_info = await get_active_account_profile_info(uid);
2576
2576
 
2577
2577
  try {
2578
2578
  let agent_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, agent_id);
@@ -2592,7 +2592,7 @@ export const create_ai_agent = async function (req, job_id, headers) {
2592
2592
 
2593
2593
  const { account_project_id: app_id, account_info } = await account_ms.get_default_project_account_doc(uid);
2594
2594
 
2595
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
2595
+ const account_profile_info = await get_active_account_profile_info(uid);
2596
2596
  const { account_profile_obj } = account_profile_info;
2597
2597
  try {
2598
2598
  const param = { uid, properties: { menuName: agentConfig.agent_name, menuTitle: agentConfig.agent_name, menuType: 'ai_agent' }, checkedInUserName: account_info.first_name + ' ' + account_info.last_name, app_id: account_profile_info.app_id, parentId: 'ai_agents' };
@@ -2626,7 +2626,7 @@ export const update_ai_agent_properties = async function (doc, app_id, uid, fiel
2626
2626
  debugger;
2627
2627
  const db_doc = await db_module.get_app_couch_doc_native(app_id, doc._id);
2628
2628
  // const { account_profile_info } = doc.studio_meta;
2629
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
2629
+ const account_profile_info = await get_active_account_profile_info(uid);
2630
2630
 
2631
2631
  const get_agent_assistant_name = async function () {
2632
2632
  const ret = await submit_chat_gpt_prompt({
@@ -3367,7 +3367,7 @@ export const create_conversation = async function (req, job_id, headers) {
3367
3367
  const { profile_id, uid, prompt, perform_ai_execution = true, email_id, email_direction = 'out', from_mailbox, date_created } = req;
3368
3368
  let { reference_type, reference_id = '', conversation_type, email_recipient_type } = req;
3369
3369
 
3370
- const account_profile_info = await account_ms.get_active_account_profile_info(uid, profile_id);
3370
+ const account_profile_info = await get_active_account_profile_info(uid, profile_id);
3371
3371
  const { account_profile_obj } = account_profile_info;
3372
3372
  try {
3373
3373
  if (conversation_type === 'email') {
@@ -3454,7 +3454,7 @@ export const create_conversation = async function (req, job_id, headers) {
3454
3454
 
3455
3455
  const conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_doc._id);
3456
3456
 
3457
- const recipient_account_profile_info = await account_ms.get_active_account_profile_info(recipient_uid);
3457
+ const recipient_account_profile_info = await get_active_account_profile_info(recipient_uid);
3458
3458
  let recipient_conversation_doc = await db_module.get_app_couch_doc_native(recipient_account_profile_info.app_id, conversation_doc._id);
3459
3459
  recipient_conversation_doc.title = conversation_doc.title;
3460
3460
 
@@ -3579,7 +3579,7 @@ export const submit_chat_conversation = async function (req, job_id, headers) {
3579
3579
  let { conversation_id } = req;
3580
3580
  try {
3581
3581
  if (!conversation_id) throw new Error('missing conversation_id');
3582
- const account_profile_info = await account_ms.get_active_account_profile_info(uid, profile_id);
3582
+ const account_profile_info = await get_active_account_profile_info(uid, profile_id);
3583
3583
 
3584
3584
  let conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_id);
3585
3585
  req.conversation_doc = conversation_doc;
@@ -3645,13 +3645,13 @@ const update_conversation_mood_level = async function (uid, target_contacts = []
3645
3645
  const mood_level_obj = JSON5.parse(mood_level.data);
3646
3646
 
3647
3647
  for await (const target of target_contacts) {
3648
- const account_profile_info = await account_ms.get_active_account_profile_info(target.uid);
3648
+ const account_profile_info = await get_active_account_profile_info(target.uid);
3649
3649
  let conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_id);
3650
3650
  conversation_doc.mood_level = mood_level_obj.mood_level;
3651
3651
  await db_module.save_app_couch_doc_native(account_profile_info.app_id, conversation_doc);
3652
3652
 
3653
3653
  if (update_contact) {
3654
- const account_profile_info = await account_ms.get_active_account_profile_info(target.uid);
3654
+ const account_profile_info = await get_active_account_profile_info(target.uid);
3655
3655
  let contact_doc = await account_ms.get_contact(account_profile_info.uid, target.contact_id);
3656
3656
  contact_doc.contact_mood_level = mood_level_obj.mood_level;
3657
3657
  contact_doc.ts = Date.now();
@@ -3665,7 +3665,7 @@ const update_conversation_mood_level = async function (uid, target_contacts = []
3665
3665
 
3666
3666
  const contact_chat_conversation = async function (req, job_id, headers) {
3667
3667
  const { uid, profile_id } = req;
3668
- const account_profile_info = await account_ms.get_active_account_profile_info(uid, profile_id);
3668
+ const account_profile_info = await get_active_account_profile_info(uid, profile_id);
3669
3669
  let { prompt, conversation_doc, attachments = [], ai_agents } = req;
3670
3670
 
3671
3671
  const conversation_id = conversation_doc._id;
@@ -3729,7 +3729,7 @@ const contact_chat_conversation = async function (req, job_id, headers) {
3729
3729
 
3730
3730
  const chat_note = async function (req, job_id, headers) {
3731
3731
  const { uid, profile_id } = req;
3732
- const account_profile_info = await account_ms.get_active_account_profile_info(uid, profile_id);
3732
+ const account_profile_info = await get_active_account_profile_info(uid, profile_id);
3733
3733
  let { prompt: body, conversation_doc, attachments = [], ai_agents } = req;
3734
3734
  try {
3735
3735
  const conversation_id = conversation_doc._id;
@@ -3791,7 +3791,7 @@ const chat_note = async function (req, job_id, headers) {
3791
3791
 
3792
3792
  const chat_email = async function (req, job_id, headers) {
3793
3793
  const { profile_id, uid, email_id, perform_ai_execution = true, from_mailbox, _thread_reentry, email_direction } = req;
3794
- const account_profile_info = await account_ms.get_active_account_profile_info(uid, profile_id);
3794
+ const account_profile_info = await get_active_account_profile_info(uid, profile_id);
3795
3795
  let { prompt: body, conversation_doc, attachments = [], ai_agents } = req;
3796
3796
  try {
3797
3797
  if (!account_profile_info.account_profile_obj?.email_account_id) {
@@ -3933,7 +3933,7 @@ const chat_email = async function (req, job_id, headers) {
3933
3933
 
3934
3934
  const ai_chat_conversation = async function (req, job_id, headers) {
3935
3935
  const { uid, gtp_token, profile_id } = req;
3936
- const account_profile_info = await account_ms.get_active_account_profile_info(uid, profile_id);
3936
+ const account_profile_info = await get_active_account_profile_info(uid, profile_id);
3937
3937
  let { prompt, conversation_doc, attachments = [], ai_agents, output_format = 'md', stream = true, with_context = true } = req;
3938
3938
  await _utils.delay(1000);
3939
3939
  const conversation_id = conversation_doc._id;
@@ -4674,12 +4674,12 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4674
4674
  setTimeout(async () => {
4675
4675
  const app_id = 'prj712ffdf5aa8adce6cedef988f9c12392'; //'prj3937cb6f9a31c8c7dea25055bba845b1'; //
4676
4676
  const uid = 'd39126e0e2c51ffbd1aad10709fc8335';
4677
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
4677
+ const account_profile_info = await get_active_account_profile_info(uid);
4678
4678
 
4679
4679
  // await init_studio_units();
4680
4680
  let ret;
4681
4681
 
4682
- // ret = await account_ms.get_active_account_profile_info(uid);
4682
+ // ret = await get_active_account_profile_info(uid);
4683
4683
  // ret = await is_spam_email(uid, 'dsgr8-2994400420@gigs.craigslist.org', 'To: You, From: Us - 70% Off Stickers & Labels Today Only');
4684
4684
  // ret = await is_spam_email(uid, 'noreply@tm.openai.com', 'Please update your Plus payment method', account_profile_info);
4685
4685
  // ret = await is_business_contact_has_person(uid, 'Eden Avrahami', 'eden.ioshka@gmail.com', 'Re: Account Accesses - Donwell Garage Doors', 'Hey Yosi,We didn’t get an update, please wait for my updates- you will be the first to know Thanks,Eden', account_profile_info);
@@ -5108,7 +5108,7 @@ export const create_avatar = async function (req, job_id, headers) {
5108
5108
  throw new Error('invalid url');
5109
5109
  }
5110
5110
 
5111
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
5111
+ const account_profile_info = await get_active_account_profile_info(uid);
5112
5112
 
5113
5113
  const account_obj = await db_module.get_couch_doc_native('xuda_accounts', uid);
5114
5114
  const account_info = account_obj.account_info;
@@ -5705,7 +5705,7 @@ export const modify_profile_avatar = async function (req, job_id, headers) {
5705
5705
  // the function modify human avatar
5706
5706
  const { methods = [], docType, uid, url, _id, name, account_type } = req;
5707
5707
  let { metadata } = req;
5708
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
5708
+ const account_profile_info = await get_active_account_profile_info(uid);
5709
5709
 
5710
5710
  try {
5711
5711
  let prompt = '';
@@ -5820,7 +5820,7 @@ const create_ai_agent_image = async function (req, job_id, headers) {
5820
5820
  const tempOutputPath = path.join(tempDir, `output_${uniqueId}.png`);
5821
5821
 
5822
5822
  const { app_id, uid, ai_agent_id, tags } = req;
5823
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
5823
+ const account_profile_info = await get_active_account_profile_info(uid);
5824
5824
  const ai_agent_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, ai_agent_id);
5825
5825
  const account_doc = await db_module.get_couch_doc_native('xuda_accounts', uid);
5826
5826
 
@@ -5954,7 +5954,7 @@ export const create_mini_app = async function (req, job_id, headers) {
5954
5954
  const { uid, prompt } = req;
5955
5955
  try {
5956
5956
  const { account_project_id: app_id, account_info } = await account_ms.get_default_project_account_doc(uid);
5957
- const account_profile_info = await account_ms.get_active_account_profile_info(uid);
5957
+ const account_profile_info = await get_active_account_profile_info(uid);
5958
5958
  const { account_profile_obj } = account_profile_info;
5959
5959
 
5960
5960
  const param = { uid, properties: { menuName: prompt, menuTitle: prompt, menuType: 'component' }, checkedInUserName: account_info.first_name + ' ' + account_info.last_name, app_id, parentId: 'programs' };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4949",
3
+ "version": "1.1.4950",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",