@xuda.io/ai_module 1.1.4971 → 1.1.4973

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 +24 -24
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -438,7 +438,7 @@ const fetch_data_tool = tool({
438
438
  // throw new Error(`table have at least one index id`);
439
439
  // }
440
440
 
441
- // const title_ret = await submit_chat_gpt_prompt({ uid, prompt: `create title for ${subject} return 5 words result maximum text only without options `, model: 'gpt-5-nano' });
441
+ // const title_ret = await submit_chat_gpt_prompt({ uid, prompt: `create title for ${subject} return 5 words result maximum text only without options `, model: _conf.default_ai_model });
442
442
 
443
443
  // const menuType = 'component';
444
444
  // const parentId = 'programs';
@@ -494,7 +494,7 @@ const fetch_data_tool = tool({
494
494
  // const html_ret = await submit_chat_gpt_prompt({
495
495
  // uid,
496
496
  // prompt: `Create a single-page landing layout with a Tailwind-styled contact form (fields: ${JSON.stringify(contactFormFields)}, subject: ${subject}). No navigation. Return only the <body> content. contact info:${JSON.stringify(account_info)} ${JSON.stringify(app_obj.app_general_prop)}`,
497
- // model: 'gpt-5-nano',
497
+ // model: _conf.default_ai_model,
498
498
  // });
499
499
  // debugger;
500
500
  // const progUi = xudaPrase(html_ret.data);
@@ -2633,7 +2633,7 @@ export const update_ai_agent_properties = async function (doc, app_id, uid, fiel
2633
2633
  prompt: `Generate a professional assistant name (e.g., “Data Analyst Assistant”) for the AI agent titled:
2634
2634
  “${doc.properties.menuName}” and also base on the instructions : "${doc.agentConfig.agent_instructions}"
2635
2635
  Output one option 3 words max.`,
2636
- model,
2636
+ model: _conf.default_ai_model,
2637
2637
  metadata: { agent_id: db_doc._id, func: 'get_agent_assistant_name' },
2638
2638
  account_profile_info,
2639
2639
  });
@@ -2658,7 +2658,7 @@ export const update_ai_agent_properties = async function (doc, app_id, uid, fiel
2658
2658
  Automation & Integration
2659
2659
  Security & Risk
2660
2660
  Infrastructure & Cloud`,
2661
- model,
2661
+ model: _conf.default_ai_model,
2662
2662
  metadata: { agent_id: db_doc._id, func: 'get_agent_category' },
2663
2663
  account_profile_info,
2664
2664
  });
@@ -2672,7 +2672,7 @@ export const update_ai_agent_properties = async function (doc, app_id, uid, fiel
2672
2672
  prompt: `Generate agent industry for the AI agent titled:
2673
2673
  “${doc.properties.menuName}” choose only one from the list:
2674
2674
  Artificial Intelligence,SaaS,Fintech,Healthtech,Edtech,Blockchain/Crypto,Cybersecurity,Gaming,Consulting,Marketing & Advertising,Human Resources,Legal Services,Real Estate,E-commerce,Retail,Fashion & Apparel,Consumer Goods,Healthcare,Medical,Pharmaceutical,Banking,Insurance,Investment,Manufacturing,Logistics & Supply Chain,Construction,Energy,Media,Entertainment,Sports,Education,Travel & Hospitality,Food & Beverage,Non-Profit,Government,Agriculture,Automotive,Telecommunications`,
2675
- model,
2675
+ model: _conf.default_ai_model,
2676
2676
  metadata: { agent_id: db_doc._id, func: 'get_agent_industry' },
2677
2677
  account_profile_info,
2678
2678
  });
@@ -2752,7 +2752,7 @@ export const update_ai_agent_properties = async function (doc, app_id, uid, fiel
2752
2752
  }
2753
2753
 
2754
2754
  `,
2755
- model,
2755
+ model: _conf.default_ai_model,
2756
2756
  metadata: { agent_id: db_doc._id, func: 'get_agent_user_guide_fields' },
2757
2757
  account_profile_info,
2758
2758
  });
@@ -2808,7 +2808,7 @@ export const update_ai_agent_properties = async function (doc, app_id, uid, fiel
2808
2808
  ]
2809
2809
 
2810
2810
  `,
2811
- model,
2811
+ model: _conf.default_ai_model,
2812
2812
  metadata: { agent_id: db_doc._id, func: 'get_agent_user_guide_steps' },
2813
2813
  account_profile_info,
2814
2814
  });
@@ -3375,7 +3375,7 @@ export const create_conversation = async function (req, job_id, headers) {
3375
3375
  throw new Error('The user profile must include a defined email_account_id');
3376
3376
  }
3377
3377
  }
3378
-
3378
+ debugger;
3379
3379
  let { data: ai_credits } = await account_ms.get_account_ai_usage(account_profile_info.uid);
3380
3380
 
3381
3381
  if (ai_credits.credits.total - ai_credits.usage.total < -0.5) {
@@ -3633,7 +3633,7 @@ const update_conversation_mood_level = async function (uid, target_contacts = []
3633
3633
  const mood_level = await submit_chat_gpt_prompt({
3634
3634
  uid,
3635
3635
  prompt: `analyze the mood of the following prompt: ${prompt}. return -2: very negative,-1: negative 0:natural 1:positive 2: very positive.`,
3636
- model,
3636
+ model: _conf.default_ai_model,
3637
3637
  response_format: z.object({
3638
3638
  mood_level: z.number().describe('mood level of interaction: -2: very negative,-1: negative 0:natural 1:positive 2: very positive'),
3639
3639
  }),
@@ -3835,7 +3835,7 @@ const chat_email = async function (req, job_id, headers) {
3835
3835
 
3836
3836
  if (!last_email_item) {
3837
3837
  if (body.split(' ').length > 10) {
3838
- const subject_ret = await submit_chat_gpt_prompt({ uid, prompt: `create title for the prompt return 5 words result maximum text only without options : ${body}`, model: 'gpt-5-nano', metadata: { conversation_id: conversation_doc._id, func: 'chat_email' }, account_profile_info });
3838
+ const subject_ret = await submit_chat_gpt_prompt({ uid, prompt: `create title for the prompt return 5 words result maximum text only without options : ${body}`, model: _conf.default_ai_model, metadata: { conversation_id: conversation_doc._id, func: 'chat_email' }, account_profile_info });
3839
3839
  if (subject_ret.code < 0) {
3840
3840
  throw new Error('something wrong creating email subject');
3841
3841
  }
@@ -3933,7 +3933,7 @@ const chat_email = async function (req, job_id, headers) {
3933
3933
  const ai_chat_conversation = async function (req, job_id, headers) {
3934
3934
  const { uid, gtp_token, profile_id } = req;
3935
3935
  const account_profile_info = await get_active_account_profile_info(uid, profile_id);
3936
- let { prompt, conversation_doc, attachments = [], ai_agents, output_format = 'md', stream = true, with_context = true, model = 'gpt-5-nano' } = req;
3936
+ let { prompt, conversation_doc, attachments = [], ai_agents, output_format = 'md', stream = true, with_context = true, model = _conf.default_ai_model } = req;
3937
3937
 
3938
3938
  if (!_conf.ai_models[model]) {
3939
3939
  throw new Error('model not supported');
@@ -5146,7 +5146,7 @@ export const get_profile_avatar = async function (profile_picture, uid, prompt,
5146
5146
  const detect_real_person_in_image = async function (base64) {
5147
5147
  const ret = await submit_chat_gpt_prompt({
5148
5148
  uid,
5149
- model: 'gpt-5-nano',
5149
+ model: _conf.default_ai_model,
5150
5150
  prompt: [
5151
5151
  {
5152
5152
  role: 'user',
@@ -5527,7 +5527,7 @@ export const get_profile_picture = async function (uid, account_type = 'business
5527
5527
  const ret = await submit_chat_gpt_prompt({
5528
5528
  uid,
5529
5529
  prompt,
5530
- model: 'gpt-5-nano',
5530
+ model: _conf.default_ai_model,
5531
5531
  metadata: { func: 'get_profile_picture' },
5532
5532
  account_profile_info,
5533
5533
  tools: [{ type: 'web_search_preview' }],
@@ -5973,7 +5973,7 @@ export const create_mini_app = async function (req, job_id, headers) {
5973
5973
  let component_doc = createDoc(param);
5974
5974
  component_doc.studio_meta.miniApp = true;
5975
5975
  component_doc.studio_meta.account_profiles = [account_profile_obj._id];
5976
- const name = 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: { prog_id: component_doc._id, func: 'create_mini_app' } }, account_profile_info);
5976
+ const name = await submit_chat_gpt_prompt({ uid, prompt: `create title for the prompt return 5 words result maximum text only without options : ${prompt}`, model: _conf.default_ai_model, metadata: { prog_id: component_doc._id, func: 'create_mini_app' } }, account_profile_info);
5977
5977
  component_doc.properties.menuName = name.data;
5978
5978
  component_doc.properties.menuTitle = name.data;
5979
5979
  const data = await db_ms.save_app_couch_doc_native(account_profile_info.app_id, component_doc);
@@ -6352,7 +6352,7 @@ export const is_spam_email = async function (uid, email, subject, account_profil
6352
6352
  const is_spam_ret = await submit_chat_gpt_prompt({
6353
6353
  uid,
6354
6354
  prompt: `detect if the email: ${email} with a subject ${subject} is spam or promotional. return true or false`,
6355
- model: 'gpt-5-nano',
6355
+ model: _conf.default_ai_model,
6356
6356
  response_format: z.object({
6357
6357
  is_spam: z.boolean().describe('if business account or promotional email return true otherwise false'),
6358
6358
  }),
@@ -6390,7 +6390,7 @@ export const is_business_contact = async function (uid, email, name, subject, bo
6390
6390
  uid,
6391
6391
  prompt,
6392
6392
  // prompt: `Determine if the contact with email "${email}", subject "${subject}", name "${name}", or body "${body}" belongs to a business account. Return true if it is a business contact, false otherwise.`,
6393
- model: 'gpt-5-nano',
6393
+ model: _conf.default_ai_model,
6394
6394
  response_format: z.object({
6395
6395
  is_business: z.boolean().describe('true if this is a business account/contact, false otherwise'),
6396
6396
  }),
@@ -6410,7 +6410,7 @@ export const is_business_contact_has_person = async function (uid, email, name,
6410
6410
  uid,
6411
6411
  prompt: `detect if the email "${email}", subject "${subject}", name "${name}", or body "${body}" is has person. Return true if it is a has person , false otherwise.`,
6412
6412
 
6413
- model: 'gpt-5-nano',
6413
+ model: _conf.default_ai_model,
6414
6414
  response_format: z.object({
6415
6415
  business_has_person: z.boolean().describe('true if the email has person, false otherwise'),
6416
6416
  }),
@@ -6639,7 +6639,7 @@ export const get_name_from_email_addr = async function (uid, email, account_prof
6639
6639
  prompt: `
6640
6640
  extract name from the email address: "${email}" return clean name result.
6641
6641
  `,
6642
- model: 'gpt-5-nano',
6642
+ model: _conf.default_ai_model,
6643
6643
  response_format: z.object({
6644
6644
  name: z.string().describe('name from email'),
6645
6645
  }),
@@ -6824,7 +6824,7 @@ Category:`;
6824
6824
  const email_category_ret = await submit_chat_gpt_prompt({
6825
6825
  uid,
6826
6826
  prompt: prompt,
6827
- model: 'gpt-5-nano',
6827
+ model: _conf.default_ai_model,
6828
6828
  response_format: z.object({
6829
6829
  email_category: z.enum(email_categories),
6830
6830
  }),
@@ -7184,7 +7184,7 @@ Category:`;
7184
7184
  const prompt_category_ret = await submit_chat_gpt_prompt({
7185
7185
  uid,
7186
7186
  prompt: prompt,
7187
- model: 'gpt-5-nano',
7187
+ model: _conf.default_ai_model,
7188
7188
  response_format: z.object({
7189
7189
  prompt_category: z.enum(ai_prompt_categories),
7190
7190
  confidence_score: z.number().min(0).max(100),
@@ -7509,7 +7509,7 @@ Category:`;
7509
7509
  const message_category_ret = await submit_chat_gpt_prompt({
7510
7510
  uid,
7511
7511
  prompt: prompt,
7512
- model: 'gpt-5-nano',
7512
+ model: _conf.default_ai_model,
7513
7513
  response_format: z.object({
7514
7514
  message_category: z.enum(text_message_categories),
7515
7515
  confidence_score: z.number().min(0).max(100),
@@ -7851,7 +7851,7 @@ Category:`;
7851
7851
  const note_category_ret = await submit_chat_gpt_prompt({
7852
7852
  uid,
7853
7853
  prompt: prompt,
7854
- model: 'gpt-5-nano',
7854
+ model: _conf.default_ai_model,
7855
7855
  response_format: z.object({
7856
7856
  note_category: z.enum(note_categories),
7857
7857
  confidence_score: z.number().min(0).max(100),
@@ -8487,7 +8487,7 @@ export const get_business_info = async function (uid, name, email, account_profi
8487
8487
  - For other countries, use standard regional names
8488
8488
 
8489
8489
  Be as precise and accurate as possible.`,
8490
- model: 'gpt-5-nano',
8490
+ model: _conf.default_ai_model,
8491
8491
  response_format: z.object({
8492
8492
  business_name: z.string().describe('Official company name'),
8493
8493
  business_domain: z.string().describe('Domain name from email'),
@@ -10625,7 +10625,7 @@ export const get_person_info = async function (uid, name, email, account_profile
10625
10625
  const person_info_ret = await submit_chat_gpt_prompt({
10626
10626
  uid,
10627
10627
  prompt: context_prompt,
10628
- model: 'gpt-5-nano',
10628
+ model: _conf.default_ai_model,
10629
10629
  response_format: z.object({
10630
10630
  // Basic Information
10631
10631
  person_full_name: z.string().describe("Person's full name"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4971",
3
+ "version": "1.1.4973",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",