@xuda.io/ai_module 1.1.4381 → 1.1.4383

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 +1 -134
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -6870,6 +6870,7 @@ export const get_profile_picture = async function (uid, account_type = 'business
6870
6870
  });
6871
6871
 
6872
6872
  imageBase64 = await normalizeBase64To1024(image_response.data[0].b64_json);
6873
+ record_chat_usage(uid, image_response.usage.input_tokens, image_response.usage.output_tokens, 'profile image', prompt, model, { url }, account_profile_info);
6873
6874
  }
6874
6875
  const outputBuffer = Buffer.from(imageBase64, 'base64');
6875
6876
  const outputPath = tempOutputPath;
@@ -6887,7 +6888,6 @@ export const get_profile_picture = async function (uid, account_type = 'business
6887
6888
 
6888
6889
  let drive_ret = await drive_module.upload_drive_file_user({ uid, path: '/Profile Images' }, job_id, headers, file_obj);
6889
6890
  drive_ret.profile_picture_source = profile_picture_source;
6890
- record_chat_usage(uid, image_response.usage.input_tokens, image_response.usage.output_tokens, 'profile image', prompt, model, { url }, account_profile_info);
6891
6891
 
6892
6892
  return drive_ret;
6893
6893
  } catch (err) {
@@ -7008,139 +7008,6 @@ const get_image_blob_from_downloaded_image = async function (url) {
7008
7008
  return images[0];
7009
7009
  };
7010
7010
 
7011
- // export const get_business_info = async function (uid, name, email, account_profile_info) {
7012
- // // 1. Prepare the valid values from your categories list
7013
- // const categories = [
7014
- // {
7015
- // id: 'ind_technology',
7016
- // name: 'Technology',
7017
- // sub: ['Software Development', 'AI & Machine Learning', 'Cybersecurity', 'Cloud Computing', 'IT Services', 'SaaS & Platforms', 'Hardware & Electronics'],
7018
- // },
7019
- // {
7020
- // id: 'ind_marketing',
7021
- // name: 'Marketing & Advertising',
7022
- // sub: ['Digital Marketing', 'PPC & SEO', 'Content Creation', 'Branding', 'Social Media Management', 'Email Marketing', 'Market Research'],
7023
- // },
7024
- // {
7025
- // id: 'ind_sales',
7026
- // name: 'Sales',
7027
- // sub: ['B2B Sales', 'B2C Sales', 'Real Estate Sales', 'Account Management', 'Lead Generation', 'Inside Sales', 'Field Sales'],
7028
- // },
7029
- // {
7030
- // id: 'ind_finance',
7031
- // name: 'Finance & Accounting',
7032
- // sub: ['Banking', 'Investment', 'Financial Planning', 'Accounting', 'Bookkeeping', 'Insurance', 'FinTech'],
7033
- // },
7034
- // {
7035
- // id: 'ind_healthcare',
7036
- // name: 'Healthcare',
7037
- // sub: ['Medical Clinics', 'Hospitals', 'Pharma', 'Mental Health', 'Healthcare IT', 'Home Care', 'Medical Research'],
7038
- // },
7039
- // {
7040
- // id: 'ind_realestate',
7041
- // name: 'Real Estate',
7042
- // sub: ['Residential Real Estate', 'Commercial Real Estate', 'Property Management', 'Investment & BRRRR', 'Construction', 'Architecture', 'Interior Design'],
7043
- // },
7044
- // {
7045
- // id: 'ind_ecommerce',
7046
- // name: 'E-commerce',
7047
- // sub: ['Online Store', 'Dropshipping', 'Amazon FBA', 'Marketplace Selling', 'Retail', 'Inventory Management', 'Fulfillment & Logistics'],
7048
- // },
7049
- // {
7050
- // id: 'ind_education',
7051
- // name: 'Education',
7052
- // sub: ['Schools', 'Universities', 'Private Tutoring', 'Online Courses', 'EdTech', 'Training & Development'],
7053
- // },
7054
- // {
7055
- // id: 'ind_hospitality',
7056
- // name: 'Hospitality & Travel',
7057
- // sub: ['Hotels', 'Restaurants', 'Cafes & Bars', 'Travel Agencies', 'Tourism', 'Events & Catering', 'Transportation'],
7058
- // },
7059
- // {
7060
- // id: 'ind_professional',
7061
- // name: 'Professional Services',
7062
- // sub: ['Legal', 'Consulting', 'HR & Recruiting', 'Accounting Firms', 'Business Services', 'Management Consulting'],
7063
- // },
7064
- // {
7065
- // id: 'ind_manufacturing',
7066
- // name: 'Manufacturing',
7067
- // sub: ['Automotive', 'Industrial', 'Textile', 'Electronics', 'Food Production', 'Machinery', 'Chemicals'],
7068
- // },
7069
- // {
7070
- // id: 'ind_nonprofit',
7071
- // name: 'Nonprofit & Government',
7072
- // sub: ['NGOs', 'Municipality', 'Government Services', 'Public Health', 'Community Organizations', 'Education Programs'],
7073
- // },
7074
- // {
7075
- // id: 'ind_media',
7076
- // name: 'Media & Entertainment',
7077
- // sub: ['Film & Video', 'Music', 'Publishing', 'Gaming', 'News & Journalism', 'Influencers', 'Production Studios'],
7078
- // },
7079
- // {
7080
- // id: 'ind_logistics',
7081
- // name: 'Logistics & Transportation',
7082
- // sub: ['Shipping', 'Trucking', 'Last-Mile Delivery', 'Warehousing', 'Freight Forwarding', 'Route Optimization'],
7083
- // },
7084
- // {
7085
- // id: 'ind_energy',
7086
- // name: 'Energy & Utilities',
7087
- // sub: ['Solar', 'Oil & Gas', 'Electricity Providers', 'Water Utilities', 'Environmental Services', 'Renewable Energy'],
7088
- // },
7089
- // {
7090
- // id: 'ind_construction',
7091
- // name: 'Construction & Trades',
7092
- // sub: ['General Contracting', 'Roofing', 'Plumbing', 'HVAC', 'Electrical', 'Renovation', 'Engineering'],
7093
- // },
7094
- // {
7095
- // id: 'ind_food',
7096
- // name: 'Food & Beverage',
7097
- // sub: ['Restaurants', 'Catering', 'Food Manufacturing', 'Bakeries', 'Bars & Nightlife', 'Food Delivery'],
7098
- // },
7099
- // {
7100
- // id: 'ind_retail',
7101
- // name: 'Retail',
7102
- // sub: ['Physical Stores', 'Boutiques', 'Supermarkets', 'Consumer Goods', 'Fashion Retail', 'Home Goods'],
7103
- // },
7104
- // ];
7105
- // // Prepare enums for the model
7106
- // const categoryNames = categories.map((c) => c.name);
7107
- // const allSubCategories = categories.flatMap((c) => c.sub);
7108
-
7109
- // const business_info_ret = await submit_chat_gpt_prompt({
7110
- // uid,
7111
- // prompt: `Research the company: "${name}" (${email}).
7112
- // Tasks:
7113
- // 1. Identify the company size.
7114
- // 2. Select the most accurate Industry Category and Sub-Category from the provided lists.
7115
- // 3. Identify the primary country and return its ISO 3166-1 alpha-2 code (e.g., 'US', 'GB', 'IL').`,
7116
- // model: 'gpt-5-nano',
7117
- // response_format: z.object({
7118
- // business_size: z.enum(['unknown', 'small', 'medium', 'large', 'enterprise']),
7119
- // business_category: z.enum(categoryNames),
7120
- // business_sub_category: z.enum(allSubCategories),
7121
- // business_country: z.string().length(2).describe("The 2-letter ISO country code, e.g., 'US'"),
7122
- // }),
7123
- // metadata: { func: 'get_business_info' },
7124
- // account_profile_info,
7125
- // tools: [{ type: 'web_search_preview' }],
7126
- // });
7127
-
7128
- // try {
7129
- // if (business_info_ret.code > -1) {
7130
- // const data = typeof business_info_ret.data === 'string' ? JSON.parse(business_info_ret.data) : business_info_ret.data;
7131
-
7132
- // // Ensure the country code is always uppercase
7133
- // if (data.business_country) {
7134
- // data.business_country = data.business_country.toUpperCase();
7135
- // }
7136
-
7137
- // return data;
7138
- // }
7139
- // } catch (error) {
7140
- // console.error('Error processing business info:', error);
7141
- // }
7142
- // };
7143
-
7144
7011
  export const get_business_info = async function (uid, name, email, account_profile_info) {
7145
7012
  // Extract lists from your JSON categories array
7146
7013
  const categories = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4381",
3
+ "version": "1.1.4383",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",