@xuda.io/ai_module 1.1.4723 → 1.1.4724

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 +583 -583
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -5591,7 +5591,7 @@ setTimeout(async () => {
5591
5591
  // account_profile_info,
5592
5592
  // );
5593
5593
 
5594
- // ret =await get_business_info(uid, 'docxsite', 'info@docxsite.com', account_profile_info);
5594
+ ret = await get_business_info(uid, 'Momo PI', 'moti411@gmail.com', account_profile_info);
5595
5595
  // ret = await get_person_info(uid, 'lidan ben shlush', 'dan@locksmith-star.com', account_profile_info);
5596
5596
  // debugger;
5597
5597
  console.log(ret);
@@ -7160,143 +7160,143 @@ const get_image_blob_from_downloaded_image = async function (url) {
7160
7160
  return images[0];
7161
7161
  };
7162
7162
 
7163
- // export const get_business_info = async function (uid, name, email, account_profile_info) {
7164
- // // Extract lists from your JSON categories array
7165
- // const categories = [
7166
- // {
7167
- // id: 'ind_technology',
7168
- // name: 'Technology',
7169
- // sub: ['Software Development', 'AI & Machine Learning', 'Cybersecurity', 'Cloud Computing', 'IT Services', 'SaaS & Platforms', 'Hardware & Electronics'],
7170
- // },
7171
- // {
7172
- // id: 'ind_marketing',
7173
- // name: 'Marketing & Advertising',
7174
- // sub: ['Digital Marketing', 'PPC & SEO', 'Content Creation', 'Branding', 'Social Media Management', 'Email Marketing', 'Market Research'],
7175
- // },
7176
- // {
7177
- // id: 'ind_sales',
7178
- // name: 'Sales',
7179
- // sub: ['B2B Sales', 'B2C Sales', 'Real Estate Sales', 'Account Management', 'Lead Generation', 'Inside Sales', 'Field Sales'],
7180
- // },
7181
- // {
7182
- // id: 'ind_finance',
7183
- // name: 'Finance & Accounting',
7184
- // sub: ['Banking', 'Investment', 'Financial Planning', 'Accounting', 'Bookkeeping', 'Insurance', 'FinTech'],
7185
- // },
7186
- // {
7187
- // id: 'ind_healthcare',
7188
- // name: 'Healthcare',
7189
- // sub: ['Medical Clinics', 'Hospitals', 'Pharma', 'Mental Health', 'Healthcare IT', 'Home Care', 'Medical Research'],
7190
- // },
7191
- // {
7192
- // id: 'ind_realestate',
7193
- // name: 'Real Estate',
7194
- // sub: ['Residential Real Estate', 'Commercial Real Estate', 'Property Management', 'Investment & BRRRR', 'Construction', 'Architecture', 'Interior Design'],
7195
- // },
7196
- // {
7197
- // id: 'ind_ecommerce',
7198
- // name: 'E-commerce',
7199
- // sub: ['Online Store', 'Dropshipping', 'Amazon FBA', 'Marketplace Selling', 'Retail', 'Inventory Management', 'Fulfillment & Logistics'],
7200
- // },
7201
- // {
7202
- // id: 'ind_education',
7203
- // name: 'Education',
7204
- // sub: ['Schools', 'Universities', 'Private Tutoring', 'Online Courses', 'EdTech', 'Training & Development'],
7205
- // },
7206
- // {
7207
- // id: 'ind_hospitality',
7208
- // name: 'Hospitality & Travel',
7209
- // sub: ['Hotels', 'Restaurants', 'Cafes & Bars', 'Travel Agencies', 'Tourism', 'Events & Catering', 'Transportation'],
7210
- // },
7211
- // {
7212
- // id: 'ind_professional',
7213
- // name: 'Professional Services',
7214
- // sub: ['Legal', 'Consulting', 'HR & Recruiting', 'Accounting Firms', 'Business Services', 'Management Consulting'],
7215
- // },
7216
- // {
7217
- // id: 'ind_manufacturing',
7218
- // name: 'Manufacturing',
7219
- // sub: ['Automotive', 'Industrial', 'Textile', 'Electronics', 'Food Production', 'Machinery', 'Chemicals'],
7220
- // },
7221
- // {
7222
- // id: 'ind_nonprofit',
7223
- // name: 'Nonprofit & Government',
7224
- // sub: ['NGOs', 'Municipality', 'Government Services', 'Public Health', 'Community Organizations', 'Education Programs'],
7225
- // },
7226
- // {
7227
- // id: 'ind_media',
7228
- // name: 'Media & Entertainment',
7229
- // sub: ['Film & Video', 'Music', 'Publishing', 'Gaming', 'News & Journalism', 'Influencers', 'Production Studios'],
7230
- // },
7231
- // {
7232
- // id: 'ind_logistics',
7233
- // name: 'Logistics & Transportation',
7234
- // sub: ['Shipping', 'Trucking', 'Last-Mile Delivery', 'Warehousing', 'Freight Forwarding', 'Route Optimization'],
7235
- // },
7236
- // {
7237
- // id: 'ind_energy',
7238
- // name: 'Energy & Utilities',
7239
- // sub: ['Solar', 'Oil & Gas', 'Electricity Providers', 'Water Utilities', 'Environmental Services', 'Renewable Energy'],
7240
- // },
7241
- // {
7242
- // id: 'ind_construction',
7243
- // name: 'Construction & Trades',
7244
- // sub: ['General Contracting', 'Roofing', 'Plumbing', 'HVAC', 'Electrical', 'Renovation', 'Engineering'],
7245
- // },
7246
- // {
7247
- // id: 'ind_food',
7248
- // name: 'Food & Beverage',
7249
- // sub: ['Restaurants', 'Catering', 'Food Manufacturing', 'Bakeries', 'Bars & Nightlife', 'Food Delivery'],
7250
- // },
7251
- // {
7252
- // id: 'ind_retail',
7253
- // name: 'Retail',
7254
- // sub: ['Physical Stores', 'Boutiques', 'Supermarkets', 'Consumer Goods', 'Fashion Retail', 'Home Goods'],
7255
- // },
7256
- // ];
7257
- // const categoryNames = categories.map((c) => c.name);
7258
- // const allSubCategories = categories.flatMap((c) => c.sub);
7163
+ export const get_business_info = async function (uid, name, email, account_profile_info) {
7164
+ // Extract lists from your JSON categories array
7165
+ const categories = [
7166
+ {
7167
+ id: 'ind_technology',
7168
+ name: 'Technology',
7169
+ sub: ['Software Development', 'AI & Machine Learning', 'Cybersecurity', 'Cloud Computing', 'IT Services', 'SaaS & Platforms', 'Hardware & Electronics'],
7170
+ },
7171
+ {
7172
+ id: 'ind_marketing',
7173
+ name: 'Marketing & Advertising',
7174
+ sub: ['Digital Marketing', 'PPC & SEO', 'Content Creation', 'Branding', 'Social Media Management', 'Email Marketing', 'Market Research'],
7175
+ },
7176
+ {
7177
+ id: 'ind_sales',
7178
+ name: 'Sales',
7179
+ sub: ['B2B Sales', 'B2C Sales', 'Real Estate Sales', 'Account Management', 'Lead Generation', 'Inside Sales', 'Field Sales'],
7180
+ },
7181
+ {
7182
+ id: 'ind_finance',
7183
+ name: 'Finance & Accounting',
7184
+ sub: ['Banking', 'Investment', 'Financial Planning', 'Accounting', 'Bookkeeping', 'Insurance', 'FinTech'],
7185
+ },
7186
+ {
7187
+ id: 'ind_healthcare',
7188
+ name: 'Healthcare',
7189
+ sub: ['Medical Clinics', 'Hospitals', 'Pharma', 'Mental Health', 'Healthcare IT', 'Home Care', 'Medical Research'],
7190
+ },
7191
+ {
7192
+ id: 'ind_realestate',
7193
+ name: 'Real Estate',
7194
+ sub: ['Residential Real Estate', 'Commercial Real Estate', 'Property Management', 'Investment & BRRRR', 'Construction', 'Architecture', 'Interior Design'],
7195
+ },
7196
+ {
7197
+ id: 'ind_ecommerce',
7198
+ name: 'E-commerce',
7199
+ sub: ['Online Store', 'Dropshipping', 'Amazon FBA', 'Marketplace Selling', 'Retail', 'Inventory Management', 'Fulfillment & Logistics'],
7200
+ },
7201
+ {
7202
+ id: 'ind_education',
7203
+ name: 'Education',
7204
+ sub: ['Schools', 'Universities', 'Private Tutoring', 'Online Courses', 'EdTech', 'Training & Development'],
7205
+ },
7206
+ {
7207
+ id: 'ind_hospitality',
7208
+ name: 'Hospitality & Travel',
7209
+ sub: ['Hotels', 'Restaurants', 'Cafes & Bars', 'Travel Agencies', 'Tourism', 'Events & Catering', 'Transportation'],
7210
+ },
7211
+ {
7212
+ id: 'ind_professional',
7213
+ name: 'Professional Services',
7214
+ sub: ['Legal', 'Consulting', 'HR & Recruiting', 'Accounting Firms', 'Business Services', 'Management Consulting'],
7215
+ },
7216
+ {
7217
+ id: 'ind_manufacturing',
7218
+ name: 'Manufacturing',
7219
+ sub: ['Automotive', 'Industrial', 'Textile', 'Electronics', 'Food Production', 'Machinery', 'Chemicals'],
7220
+ },
7221
+ {
7222
+ id: 'ind_nonprofit',
7223
+ name: 'Nonprofit & Government',
7224
+ sub: ['NGOs', 'Municipality', 'Government Services', 'Public Health', 'Community Organizations', 'Education Programs'],
7225
+ },
7226
+ {
7227
+ id: 'ind_media',
7228
+ name: 'Media & Entertainment',
7229
+ sub: ['Film & Video', 'Music', 'Publishing', 'Gaming', 'News & Journalism', 'Influencers', 'Production Studios'],
7230
+ },
7231
+ {
7232
+ id: 'ind_logistics',
7233
+ name: 'Logistics & Transportation',
7234
+ sub: ['Shipping', 'Trucking', 'Last-Mile Delivery', 'Warehousing', 'Freight Forwarding', 'Route Optimization'],
7235
+ },
7236
+ {
7237
+ id: 'ind_energy',
7238
+ name: 'Energy & Utilities',
7239
+ sub: ['Solar', 'Oil & Gas', 'Electricity Providers', 'Water Utilities', 'Environmental Services', 'Renewable Energy'],
7240
+ },
7241
+ {
7242
+ id: 'ind_construction',
7243
+ name: 'Construction & Trades',
7244
+ sub: ['General Contracting', 'Roofing', 'Plumbing', 'HVAC', 'Electrical', 'Renovation', 'Engineering'],
7245
+ },
7246
+ {
7247
+ id: 'ind_food',
7248
+ name: 'Food & Beverage',
7249
+ sub: ['Restaurants', 'Catering', 'Food Manufacturing', 'Bakeries', 'Bars & Nightlife', 'Food Delivery'],
7250
+ },
7251
+ {
7252
+ id: 'ind_retail',
7253
+ name: 'Retail',
7254
+ sub: ['Physical Stores', 'Boutiques', 'Supermarkets', 'Consumer Goods', 'Fashion Retail', 'Home Goods'],
7255
+ },
7256
+ ];
7257
+ const categoryNames = categories.map((c) => c.name);
7258
+ const allSubCategories = categories.flatMap((c) => c.sub);
7259
7259
 
7260
- // const business_info_ret = await submit_chat_gpt_prompt({
7261
- // uid,
7262
- // prompt: `Research the company: "${name}" (${email}).
7263
- // 1. get the company name.
7264
- // 2. get the domain name from the email.
7265
- // 2. Provide a professional one-sentence biography of the company.
7266
- // 3. Categorize them using the provided industry lists.
7267
- // 4. Identify their primary country as a 2-letter ISO code (e.g., 'US').`,
7268
- // model: 'gpt-5-nano',
7269
- // response_format: z.object({
7270
- // business_name: z.string().describe('the company name'),
7271
- // business_domain: z.string().describe('the email domain name'),
7272
- // business_bio: z.string().describe('A concise, professional one-sentence summary of what the business does'),
7273
- // business_size: z.enum(['unknown', 'small', 'medium', 'large', 'enterprise']),
7274
- // business_category: z.enum(categoryNames),
7275
- // business_sub_category: z.enum(allSubCategories),
7276
- // business_country: z.string().length(2).describe("2-letter ISO country code (e.g., 'US')"),
7277
- // }),
7278
- // metadata: { func: 'get_business_info' },
7279
- // account_profile_info,
7280
- // tools: [{ type: 'web_search_preview' }],
7281
- // });
7260
+ const business_info_ret = await submit_chat_gpt_prompt({
7261
+ uid,
7262
+ prompt: `Research the company: "${name}" (${email}).
7263
+ 1. get the company name.
7264
+ 2. get the domain name from the email.
7265
+ 2. Provide a professional one-sentence biography of the company.
7266
+ 3. Categorize them using the provided industry lists.
7267
+ 4. Identify their primary country as a 2-letter ISO code (e.g., 'US').`,
7268
+ model: 'gpt-5-nano',
7269
+ response_format: z.object({
7270
+ business_name: z.string().describe('the company name'),
7271
+ business_domain: z.string().describe('the email domain name'),
7272
+ business_bio: z.string().describe('A concise, professional one-sentence summary of what the business does'),
7273
+ business_size: z.enum(['unknown', 'small', 'medium', 'large', 'enterprise']),
7274
+ business_category: z.enum(categoryNames),
7275
+ business_sub_category: z.enum(allSubCategories),
7276
+ business_country: z.string().length(2).describe("2-letter ISO country code (e.g., 'US')"),
7277
+ }),
7278
+ metadata: { func: 'get_business_info' },
7279
+ account_profile_info,
7280
+ tools: [{ type: 'web_search_preview' }],
7281
+ });
7282
7282
 
7283
- // try {
7284
- // if (business_info_ret.code > -1) {
7285
- // const data = typeof business_info_ret.data === 'string' ? JSON.parse(business_info_ret.data) : business_info_ret.data;
7283
+ try {
7284
+ if (business_info_ret.code > -1) {
7285
+ const data = typeof business_info_ret.data === 'string' ? JSON.parse(business_info_ret.data) : business_info_ret.data;
7286
7286
 
7287
- // // Standardize country to uppercase
7288
- // if (data.business_country) data.business_country = data.business_country.toUpperCase();
7287
+ // Standardize country to uppercase
7288
+ if (data.business_country) data.business_country = data.business_country.toUpperCase();
7289
7289
 
7290
- // // Logic to attach the ID for your database
7291
- // const matched = categories.find((c) => c.name === data.business_category);
7292
- // data.business_category_id = matched ? matched.id : null;
7290
+ // Logic to attach the ID for your database
7291
+ const matched = categories.find((c) => c.name === data.business_category);
7292
+ data.business_category_id = matched ? matched.id : null;
7293
7293
 
7294
- // return data;
7295
- // }
7296
- // } catch (error) {
7297
- // console.error('Error in get_business_info:', error);
7298
- // }
7299
- // };
7294
+ return data;
7295
+ }
7296
+ } catch (error) {
7297
+ console.error('Error in get_business_info:', error);
7298
+ }
7299
+ };
7300
7300
 
7301
7301
  const get_chat_picture_cache = async function (uid, docType, key) {
7302
7302
  if (!key || typeof key !== 'string') return null;
@@ -8700,499 +8700,499 @@ Category:`;
8700
8700
  }
8701
8701
  };
8702
8702
 
8703
- export const get_business_info = async function (uid, name, email, account_profile_info) {
8704
- // ========== HELPER FUNCTIONS ==========
8703
+ // export const get_business_info = async function (uid, name, email, account_profile_info) {
8704
+ // // ========== HELPER FUNCTIONS ==========
8705
8705
 
8706
- function validatePhoneNumber(phone) {
8707
- if (!phone || phone.toLowerCase() === 'not available' || phone.trim() === '') {
8708
- return 'Not available';
8709
- }
8706
+ // function validatePhoneNumber(phone) {
8707
+ // if (!phone || phone.toLowerCase() === 'not available' || phone.trim() === '') {
8708
+ // return 'Not available';
8709
+ // }
8710
8710
 
8711
- const cleaned = phone.replace(/[^\d\+\(\)\-\s]/g, '');
8712
- const digitCount = (cleaned.match(/\d/g) || []).length;
8711
+ // const cleaned = phone.replace(/[^\d\+\(\)\-\s]/g, '');
8712
+ // const digitCount = (cleaned.match(/\d/g) || []).length;
8713
8713
 
8714
- // Require at least 7 digits for a valid phone number
8715
- if (digitCount < 7) {
8716
- return 'Not available';
8717
- }
8714
+ // // Require at least 7 digits for a valid phone number
8715
+ // if (digitCount < 7) {
8716
+ // return 'Not available';
8717
+ // }
8718
8718
 
8719
- return cleaned.trim();
8720
- }
8719
+ // return cleaned.trim();
8720
+ // }
8721
8721
 
8722
- function validateWebsite(website) {
8723
- if (!website || website.toLowerCase() === 'not available' || website.trim() === '') {
8724
- return 'Not available';
8725
- }
8722
+ // function validateWebsite(website) {
8723
+ // if (!website || website.toLowerCase() === 'not available' || website.trim() === '') {
8724
+ // return 'Not available';
8725
+ // }
8726
8726
 
8727
- const trimmed = website.trim();
8727
+ // const trimmed = website.trim();
8728
8728
 
8729
- // Ensure URL has proper protocol
8730
- if (!trimmed.startsWith('http://') && !trimmed.startsWith('https://')) {
8731
- // Check if it looks like a domain
8732
- if (trimmed.includes('.') && !trimmed.includes(' ')) {
8733
- return `https://${trimmed.replace(/^www\./, '')}`;
8734
- }
8735
- return 'Not available';
8736
- }
8729
+ // // Ensure URL has proper protocol
8730
+ // if (!trimmed.startsWith('http://') && !trimmed.startsWith('https://')) {
8731
+ // // Check if it looks like a domain
8732
+ // if (trimmed.includes('.') && !trimmed.includes(' ')) {
8733
+ // return `https://${trimmed.replace(/^www\./, '')}`;
8734
+ // }
8735
+ // return 'Not available';
8736
+ // }
8737
8737
 
8738
- return trimmed;
8739
- }
8738
+ // return trimmed;
8739
+ // }
8740
8740
 
8741
- function cleanStreetAddress(street) {
8742
- if (!street || street.toLowerCase() === 'not available' || street.trim() === '') {
8743
- return 'Not available';
8744
- }
8741
+ // function cleanStreetAddress(street) {
8742
+ // if (!street || street.toLowerCase() === 'not available' || street.trim() === '') {
8743
+ // return 'Not available';
8744
+ // }
8745
8745
 
8746
- return street
8747
- .replace(/\s+/g, ' ')
8748
- .replace(/,\s*$/g, '') // Remove trailing commas
8749
- .trim();
8750
- }
8746
+ // return street
8747
+ // .replace(/\s+/g, ' ')
8748
+ // .replace(/,\s*$/g, '') // Remove trailing commas
8749
+ // .trim();
8750
+ // }
8751
8751
 
8752
- function cleanText(text) {
8753
- if (!text || text.toLowerCase() === 'not available' || text.trim() === '') {
8754
- return 'Not available';
8755
- }
8752
+ // function cleanText(text) {
8753
+ // if (!text || text.toLowerCase() === 'not available' || text.trim() === '') {
8754
+ // return 'Not available';
8755
+ // }
8756
8756
 
8757
- return text.replace(/\s+/g, ' ').trim();
8758
- }
8757
+ // return text.replace(/\s+/g, ' ').trim();
8758
+ // }
8759
8759
 
8760
- function cleanZipCode(zip, country) {
8761
- if (!zip || zip.toLowerCase() === 'not available' || zip.trim() === '') {
8762
- return 'Not available';
8763
- }
8764
-
8765
- const cleaned = zip.trim();
8766
-
8767
- // Country-specific formatting
8768
- switch (country) {
8769
- case 'US':
8770
- // US ZIP: 5 digits or 5-4 format
8771
- return cleaned.replace(/\D/g, '').replace(/^(\d{5})(\d{4})$/, '$1-$2');
8772
- case 'CA':
8773
- // Canada: A1A 1A1 format
8774
- return cleaned.toUpperCase().replace(/\s+/g, '');
8775
- case 'UK':
8776
- // UK: various formats, preserve as is but uppercase
8777
- return cleaned.toUpperCase();
8778
- case 'AU':
8779
- // Australia: 4 digits
8780
- return cleaned.replace(/\D/g, '');
8781
- default:
8782
- return cleaned;
8783
- }
8784
- }
8760
+ // function cleanZipCode(zip, country) {
8761
+ // if (!zip || zip.toLowerCase() === 'not available' || zip.trim() === '') {
8762
+ // return 'Not available';
8763
+ // }
8785
8764
 
8786
- function cleanStateProvince(state, country) {
8787
- if (!state || state.toLowerCase() === 'not available' || state.trim() === '') {
8788
- return 'Not available';
8789
- }
8790
-
8791
- const cleaned = state.trim();
8792
-
8793
- // Standardize US state abbreviations
8794
- if (country === 'US') {
8795
- const stateMap = {
8796
- alabama: 'AL',
8797
- alaska: 'AK',
8798
- arizona: 'AZ',
8799
- arkansas: 'AR',
8800
- california: 'CA',
8801
- colorado: 'CO',
8802
- connecticut: 'CT',
8803
- delaware: 'DE',
8804
- florida: 'FL',
8805
- georgia: 'GA',
8806
- hawaii: 'HI',
8807
- idaho: 'ID',
8808
- illinois: 'IL',
8809
- indiana: 'IN',
8810
- iowa: 'IA',
8811
- kansas: 'KS',
8812
- kentucky: 'KY',
8813
- louisiana: 'LA',
8814
- maine: 'ME',
8815
- maryland: 'MD',
8816
- massachusetts: 'MA',
8817
- michigan: 'MI',
8818
- minnesota: 'MN',
8819
- mississippi: 'MS',
8820
- missouri: 'MO',
8821
- montana: 'MT',
8822
- nebraska: 'NE',
8823
- nevada: 'NV',
8824
- 'new hampshire': 'NH',
8825
- 'new jersey': 'NJ',
8826
- 'new mexico': 'NM',
8827
- 'new york': 'NY',
8828
- 'north carolina': 'NC',
8829
- 'north dakota': 'ND',
8830
- ohio: 'OH',
8831
- oklahoma: 'OK',
8832
- oregon: 'OR',
8833
- pennsylvania: 'PA',
8834
- 'rhode island': 'RI',
8835
- 'south carolina': 'SC',
8836
- 'south dakota': 'SD',
8837
- tennessee: 'TN',
8838
- texas: 'TX',
8839
- utah: 'UT',
8840
- vermont: 'VT',
8841
- virginia: 'VA',
8842
- washington: 'WA',
8843
- 'west virginia': 'WV',
8844
- wisconsin: 'WI',
8845
- wyoming: 'WY',
8846
- 'district of columbia': 'DC',
8847
- };
8765
+ // const cleaned = zip.trim();
8766
+
8767
+ // // Country-specific formatting
8768
+ // switch (country) {
8769
+ // case 'US':
8770
+ // // US ZIP: 5 digits or 5-4 format
8771
+ // return cleaned.replace(/\D/g, '').replace(/^(\d{5})(\d{4})$/, '$1-$2');
8772
+ // case 'CA':
8773
+ // // Canada: A1A 1A1 format
8774
+ // return cleaned.toUpperCase().replace(/\s+/g, '');
8775
+ // case 'UK':
8776
+ // // UK: various formats, preserve as is but uppercase
8777
+ // return cleaned.toUpperCase();
8778
+ // case 'AU':
8779
+ // // Australia: 4 digits
8780
+ // return cleaned.replace(/\D/g, '');
8781
+ // default:
8782
+ // return cleaned;
8783
+ // }
8784
+ // }
8848
8785
 
8849
- const lowerState = cleaned.toLowerCase();
8850
- if (stateMap[lowerState]) {
8851
- return stateMap[lowerState];
8852
- }
8786
+ // function cleanStateProvince(state, country) {
8787
+ // if (!state || state.toLowerCase() === 'not available' || state.trim() === '') {
8788
+ // return 'Not available';
8789
+ // }
8853
8790
 
8854
- // If already 2-letter code, uppercase it
8855
- if (/^[A-Z]{2}$/i.test(cleaned)) {
8856
- return cleaned.toUpperCase();
8857
- }
8858
- }
8791
+ // const cleaned = state.trim();
8792
+
8793
+ // // Standardize US state abbreviations
8794
+ // if (country === 'US') {
8795
+ // const stateMap = {
8796
+ // alabama: 'AL',
8797
+ // alaska: 'AK',
8798
+ // arizona: 'AZ',
8799
+ // arkansas: 'AR',
8800
+ // california: 'CA',
8801
+ // colorado: 'CO',
8802
+ // connecticut: 'CT',
8803
+ // delaware: 'DE',
8804
+ // florida: 'FL',
8805
+ // georgia: 'GA',
8806
+ // hawaii: 'HI',
8807
+ // idaho: 'ID',
8808
+ // illinois: 'IL',
8809
+ // indiana: 'IN',
8810
+ // iowa: 'IA',
8811
+ // kansas: 'KS',
8812
+ // kentucky: 'KY',
8813
+ // louisiana: 'LA',
8814
+ // maine: 'ME',
8815
+ // maryland: 'MD',
8816
+ // massachusetts: 'MA',
8817
+ // michigan: 'MI',
8818
+ // minnesota: 'MN',
8819
+ // mississippi: 'MS',
8820
+ // missouri: 'MO',
8821
+ // montana: 'MT',
8822
+ // nebraska: 'NE',
8823
+ // nevada: 'NV',
8824
+ // 'new hampshire': 'NH',
8825
+ // 'new jersey': 'NJ',
8826
+ // 'new mexico': 'NM',
8827
+ // 'new york': 'NY',
8828
+ // 'north carolina': 'NC',
8829
+ // 'north dakota': 'ND',
8830
+ // ohio: 'OH',
8831
+ // oklahoma: 'OK',
8832
+ // oregon: 'OR',
8833
+ // pennsylvania: 'PA',
8834
+ // 'rhode island': 'RI',
8835
+ // 'south carolina': 'SC',
8836
+ // 'south dakota': 'SD',
8837
+ // tennessee: 'TN',
8838
+ // texas: 'TX',
8839
+ // utah: 'UT',
8840
+ // vermont: 'VT',
8841
+ // virginia: 'VA',
8842
+ // washington: 'WA',
8843
+ // 'west virginia': 'WV',
8844
+ // wisconsin: 'WI',
8845
+ // wyoming: 'WY',
8846
+ // 'district of columbia': 'DC',
8847
+ // };
8859
8848
 
8860
- return cleaned;
8861
- }
8849
+ // const lowerState = cleaned.toLowerCase();
8850
+ // if (stateMap[lowerState]) {
8851
+ // return stateMap[lowerState];
8852
+ // }
8862
8853
 
8863
- function cleanCountry(country) {
8864
- if (!country || country.toLowerCase() === 'not available' || country.trim() === '') {
8865
- return 'Not available';
8866
- }
8854
+ // // If already 2-letter code, uppercase it
8855
+ // if (/^[A-Z]{2}$/i.test(cleaned)) {
8856
+ // return cleaned.toUpperCase();
8857
+ // }
8858
+ // }
8867
8859
 
8868
- // Convert 2-letter codes to full country names for display
8869
- const countryMap = {
8870
- US: 'United States',
8871
- CA: 'Canada',
8872
- UK: 'United Kingdom',
8873
- GB: 'United Kingdom',
8874
- AU: 'Australia',
8875
- DE: 'Germany',
8876
- FR: 'France',
8877
- JP: 'Japan',
8878
- CN: 'China',
8879
- IN: 'India',
8880
- BR: 'Brazil',
8881
- MX: 'Mexico',
8882
- };
8860
+ // return cleaned;
8861
+ // }
8883
8862
 
8884
- const upperCountry = country.toUpperCase();
8885
- return countryMap[upperCountry] || upperCountry;
8886
- }
8863
+ // function cleanCountry(country) {
8864
+ // if (!country || country.toLowerCase() === 'not available' || country.trim() === '') {
8865
+ // return 'Not available';
8866
+ // }
8887
8867
 
8888
- function formatFullAddress(data) {
8889
- const parts = [];
8868
+ // // Convert 2-letter codes to full country names for display
8869
+ // const countryMap = {
8870
+ // US: 'United States',
8871
+ // CA: 'Canada',
8872
+ // UK: 'United Kingdom',
8873
+ // GB: 'United Kingdom',
8874
+ // AU: 'Australia',
8875
+ // DE: 'Germany',
8876
+ // FR: 'France',
8877
+ // JP: 'Japan',
8878
+ // CN: 'China',
8879
+ // IN: 'India',
8880
+ // BR: 'Brazil',
8881
+ // MX: 'Mexico',
8882
+ // };
8890
8883
 
8891
- if (data.business_address_street && data.business_address_street !== 'Not available') {
8892
- parts.push(data.business_address_street);
8893
- }
8884
+ // const upperCountry = country.toUpperCase();
8885
+ // return countryMap[upperCountry] || upperCountry;
8886
+ // }
8894
8887
 
8895
- const cityStateZip = [];
8896
- if (data.business_address_city && data.business_address_city !== 'Not available') {
8897
- cityStateZip.push(data.business_address_city);
8898
- }
8888
+ // function formatFullAddress(data) {
8889
+ // const parts = [];
8899
8890
 
8900
- if (data.business_address_state && data.business_address_state !== 'Not available') {
8901
- cityStateZip.push(data.business_address_state);
8902
- }
8891
+ // if (data.business_address_street && data.business_address_street !== 'Not available') {
8892
+ // parts.push(data.business_address_street);
8893
+ // }
8903
8894
 
8904
- if (data.business_address_zip && data.business_address_zip !== 'Not available') {
8905
- cityStateZip.push(data.business_address_zip);
8906
- }
8895
+ // const cityStateZip = [];
8896
+ // if (data.business_address_city && data.business_address_city !== 'Not available') {
8897
+ // cityStateZip.push(data.business_address_city);
8898
+ // }
8907
8899
 
8908
- if (cityStateZip.length > 0) {
8909
- parts.push(cityStateZip.join(', '));
8910
- }
8900
+ // if (data.business_address_state && data.business_address_state !== 'Not available') {
8901
+ // cityStateZip.push(data.business_address_state);
8902
+ // }
8911
8903
 
8912
- if (data.business_address_country && data.business_address_country !== 'Not available') {
8913
- parts.push(data.business_address_country);
8914
- }
8904
+ // if (data.business_address_zip && data.business_address_zip !== 'Not available') {
8905
+ // cityStateZip.push(data.business_address_zip);
8906
+ // }
8915
8907
 
8916
- return parts.length > 0 ? parts.join(', ') : 'Not available';
8917
- }
8908
+ // if (cityStateZip.length > 0) {
8909
+ // parts.push(cityStateZip.join(', '));
8910
+ // }
8918
8911
 
8919
- function getRegionFromState(state, country) {
8920
- if (country !== 'US' || state === 'Not available') return null;
8912
+ // if (data.business_address_country && data.business_address_country !== 'Not available') {
8913
+ // parts.push(data.business_address_country);
8914
+ // }
8921
8915
 
8922
- const regions = {
8923
- Northeast: ['CT', 'ME', 'MA', 'NH', 'RI', 'VT', 'NJ', 'NY', 'PA'],
8924
- Midwest: ['IL', 'IN', 'MI', 'OH', 'WI', 'IA', 'KS', 'MN', 'MO', 'NE', 'ND', 'SD'],
8925
- South: ['DE', 'FL', 'GA', 'MD', 'NC', 'SC', 'VA', 'DC', 'WV', 'AL', 'KY', 'MS', 'TN', 'AR', 'LA', 'OK', 'TX'],
8926
- West: ['AZ', 'CO', 'ID', 'MT', 'NV', 'NM', 'UT', 'WY', 'AK', 'CA', 'HI', 'OR', 'WA'],
8927
- };
8916
+ // return parts.length > 0 ? parts.join(', ') : 'Not available';
8917
+ // }
8928
8918
 
8929
- for (const [region, states] of Object.entries(regions)) {
8930
- if (states.includes(state)) {
8931
- return region;
8932
- }
8933
- }
8919
+ // function getRegionFromState(state, country) {
8920
+ // if (country !== 'US' || state === 'Not available') return null;
8934
8921
 
8935
- return null;
8936
- }
8922
+ // const regions = {
8923
+ // Northeast: ['CT', 'ME', 'MA', 'NH', 'RI', 'VT', 'NJ', 'NY', 'PA'],
8924
+ // Midwest: ['IL', 'IN', 'MI', 'OH', 'WI', 'IA', 'KS', 'MN', 'MO', 'NE', 'ND', 'SD'],
8925
+ // South: ['DE', 'FL', 'GA', 'MD', 'NC', 'SC', 'VA', 'DC', 'WV', 'AL', 'KY', 'MS', 'TN', 'AR', 'LA', 'OK', 'TX'],
8926
+ // West: ['AZ', 'CO', 'ID', 'MT', 'NV', 'NM', 'UT', 'WY', 'AK', 'CA', 'HI', 'OR', 'WA'],
8927
+ // };
8937
8928
 
8938
- function getDefaultBusinessInfo(name, email, error = null) {
8939
- const domain = email.includes('@') ? email.split('@')[1] : '';
8929
+ // for (const [region, states] of Object.entries(regions)) {
8930
+ // if (states.includes(state)) {
8931
+ // return region;
8932
+ // }
8933
+ // }
8940
8934
 
8941
- return {
8942
- business_name: name,
8943
- business_domain: domain,
8944
- business_bio: 'Information not available',
8945
- business_size: 'unknown',
8946
- business_category: 'Professional Services',
8947
- business_sub_category: 'Business Services',
8948
- business_country: 'US',
8949
- business_phone: 'Not available',
8950
- business_website: 'Not available',
8951
-
8952
- // Address components
8953
- business_address_street: 'Not available',
8954
- business_address_city: 'Not available',
8955
- business_address_state: 'Not available',
8956
- business_address_zip: 'Not available',
8957
- business_address_country: 'Not available',
8958
- business_address_full: 'Not available',
8935
+ // return null;
8936
+ // }
8959
8937
 
8960
- // Structured objects
8961
- business_category_id: null,
8962
- business_address: {
8963
- street: 'Not available',
8964
- city: 'Not available',
8965
- state: 'Not available',
8966
- zip: 'Not available',
8967
- country: 'Not available',
8968
- full: 'Not available',
8969
- coordinates: null,
8970
- timezone: null,
8971
- },
8972
- business_location: {
8973
- region: null,
8974
- metro_area: null,
8975
- is_headquarters: null,
8976
- },
8977
- error: error || 'API call failed',
8978
- };
8979
- }
8938
+ // function getDefaultBusinessInfo(name, email, error = null) {
8939
+ // const domain = email.includes('@') ? email.split('@')[1] : '';
8980
8940
 
8981
- // Extract lists from your JSON categories array
8982
- const categories = [
8983
- {
8984
- id: 'ind_technology',
8985
- name: 'Technology',
8986
- sub: ['Software Development', 'AI & Machine Learning', 'Cybersecurity', 'Cloud Computing', 'IT Services', 'SaaS & Platforms', 'Hardware & Electronics'],
8987
- },
8988
- {
8989
- id: 'ind_marketing',
8990
- name: 'Marketing & Advertising',
8991
- sub: ['Digital Marketing', 'PPC & SEO', 'Content Creation', 'Branding', 'Social Media Management', 'Email Marketing', 'Market Research'],
8992
- },
8993
- {
8994
- id: 'ind_sales',
8995
- name: 'Sales',
8996
- sub: ['B2B Sales', 'B2C Sales', 'Real Estate Sales', 'Account Management', 'Lead Generation', 'Inside Sales', 'Field Sales'],
8997
- },
8998
- {
8999
- id: 'ind_finance',
9000
- name: 'Finance & Accounting',
9001
- sub: ['Banking', 'Investment', 'Financial Planning', 'Accounting', 'Bookkeeping', 'Insurance', 'FinTech'],
9002
- },
9003
- {
9004
- id: 'ind_healthcare',
9005
- name: 'Healthcare',
9006
- sub: ['Medical Clinics', 'Hospitals', 'Pharma', 'Mental Health', 'Healthcare IT', 'Home Care', 'Medical Research'],
9007
- },
9008
- {
9009
- id: 'ind_realestate',
9010
- name: 'Real Estate',
9011
- sub: ['Residential Real Estate', 'Commercial Real Estate', 'Property Management', 'Investment & BRRRR', 'Construction', 'Architecture', 'Interior Design'],
9012
- },
9013
- {
9014
- id: 'ind_ecommerce',
9015
- name: 'E-commerce',
9016
- sub: ['Online Store', 'Dropshipping', 'Amazon FBA', 'Marketplace Selling', 'Retail', 'Inventory Management', 'Fulfillment & Logistics'],
9017
- },
9018
- {
9019
- id: 'ind_education',
9020
- name: 'Education',
9021
- sub: ['Schools', 'Universities', 'Private Tutoring', 'Online Courses', 'EdTech', 'Training & Development'],
9022
- },
9023
- {
9024
- id: 'ind_hospitality',
9025
- name: 'Hospitality & Travel',
9026
- sub: ['Hotels', 'Restaurants', 'Cafes & Bars', 'Travel Agencies', 'Tourism', 'Events & Catering', 'Transportation'],
9027
- },
9028
- {
9029
- id: 'ind_professional',
9030
- name: 'Professional Services',
9031
- sub: ['Legal', 'Consulting', 'HR & Recruiting', 'Accounting Firms', 'Business Services', 'Management Consulting'],
9032
- },
9033
- {
9034
- id: 'ind_manufacturing',
9035
- name: 'Manufacturing',
9036
- sub: ['Automotive', 'Industrial', 'Textile', 'Electronics', 'Food Production', 'Machinery', 'Chemicals'],
9037
- },
9038
- {
9039
- id: 'ind_nonprofit',
9040
- name: 'Nonprofit & Government',
9041
- sub: ['NGOs', 'Municipality', 'Government Services', 'Public Health', 'Community Organizations', 'Education Programs'],
9042
- },
9043
- {
9044
- id: 'ind_media',
9045
- name: 'Media & Entertainment',
9046
- sub: ['Film & Video', 'Music', 'Publishing', 'Gaming', 'News & Journalism', 'Influencers', 'Production Studios'],
9047
- },
9048
- {
9049
- id: 'ind_logistics',
9050
- name: 'Logistics & Transportation',
9051
- sub: ['Shipping', 'Trucking', 'Last-Mile Delivery', 'Warehousing', 'Freight Forwarding', 'Route Optimization'],
9052
- },
9053
- {
9054
- id: 'ind_energy',
9055
- name: 'Energy & Utilities',
9056
- sub: ['Solar', 'Oil & Gas', 'Electricity Providers', 'Water Utilities', 'Environmental Services', 'Renewable Energy'],
9057
- },
9058
- {
9059
- id: 'ind_construction',
9060
- name: 'Construction & Trades',
9061
- sub: ['General Contracting', 'Roofing', 'Plumbing', 'HVAC', 'Electrical', 'Renovation', 'Engineering'],
9062
- },
9063
- {
9064
- id: 'ind_food',
9065
- name: 'Food & Beverage',
9066
- sub: ['Restaurants', 'Catering', 'Food Manufacturing', 'Bakeries', 'Bars & Nightlife', 'Food Delivery'],
9067
- },
9068
- {
9069
- id: 'ind_retail',
9070
- name: 'Retail',
9071
- sub: ['Physical Stores', 'Boutiques', 'Supermarkets', 'Consumer Goods', 'Fashion Retail', 'Home Goods'],
9072
- },
9073
- ];
9074
- const categoryNames = categories.map((c) => c.name);
9075
- const allSubCategories = categories.flatMap((c) => c.sub);
8941
+ // return {
8942
+ // business_name: name,
8943
+ // business_domain: domain,
8944
+ // business_bio: 'Information not available',
8945
+ // business_size: 'unknown',
8946
+ // business_category: 'Professional Services',
8947
+ // business_sub_category: 'Business Services',
8948
+ // business_country: 'US',
8949
+ // business_phone: 'Not available',
8950
+ // business_website: 'Not available',
8951
+
8952
+ // // Address components
8953
+ // business_address_street: 'Not available',
8954
+ // business_address_city: 'Not available',
8955
+ // business_address_state: 'Not available',
8956
+ // business_address_zip: 'Not available',
8957
+ // business_address_country: 'Not available',
8958
+ // business_address_full: 'Not available',
8959
+
8960
+ // // Structured objects
8961
+ // business_category_id: null,
8962
+ // business_address: {
8963
+ // street: 'Not available',
8964
+ // city: 'Not available',
8965
+ // state: 'Not available',
8966
+ // zip: 'Not available',
8967
+ // country: 'Not available',
8968
+ // full: 'Not available',
8969
+ // coordinates: null,
8970
+ // timezone: null,
8971
+ // },
8972
+ // business_location: {
8973
+ // region: null,
8974
+ // metro_area: null,
8975
+ // is_headquarters: null,
8976
+ // },
8977
+ // error: error || 'API call failed',
8978
+ // };
8979
+ // }
9076
8980
 
9077
- const business_info_ret = await submit_chat_gpt_prompt({
9078
- uid,
9079
- prompt: `Research the company: "${name}" (${email}).
9080
-
9081
- REQUIRED INFORMATION:
9082
- 1. Company name (official name)
9083
- 2. Email domain name
9084
- 3. Professional one-sentence biography
9085
- 4. Industry category and sub-category
9086
- 5. Primary country (2-letter ISO code)
9087
- 6. Telephone number
9088
- 7. Website URL
9089
- 8. COMPLETE ADDRESS DETAILS:
9090
- - Full street address (street number, street name, suite/apt if applicable)
9091
- - City
9092
- - State/Province (use abbreviation where standard)
9093
- - Zip/Postal code
9094
- - Country
9095
-
9096
- ADDRESS FORMATTING EXAMPLES:
9097
- - Full street: "1600 Amphitheatre Parkway"
9098
- - City: "Mountain View"
9099
- - State: "CA"
9100
- - Zip: "94043"
9101
- - Country: "US"
9102
- - Full address: "1600 Amphitheatre Parkway, Mountain View, CA 94043, USA"
9103
-
9104
- INSTRUCTIONS:
9105
- - Use web search to find accurate information
9106
- - If not found online, infer from typical patterns
9107
- - For unknown info, use "Not available"
9108
- - For US states, use 2-letter abbreviations (CA, NY, TX, etc.)
9109
- - For other countries, use standard regional names
9110
-
9111
- Be as precise and accurate as possible.`,
9112
- model: 'gpt-4o-mini',
9113
- response_format: z.object({
9114
- business_name: z.string().describe('Official company name'),
9115
- business_domain: z.string().describe('Domain name from email'),
9116
- business_bio: z.string().describe('One-sentence professional summary'),
9117
- business_size: z.enum(['unknown', 'small', 'medium', 'large', 'enterprise']),
9118
- business_category: z.enum(categoryNames),
9119
- business_sub_category: z.enum(allSubCategories),
9120
- business_country: z.string().length(2).describe('2-letter ISO country code'),
9121
- business_phone: z.string().describe("Telephone number or 'Not available'"),
9122
- business_website: z.string().describe("Website URL or 'Not available'"),
9123
-
9124
- // Complete address components
9125
- business_address_street: z.string().describe('Full street address (number, street, suite)'),
9126
- business_address_city: z.string().describe('City name'),
9127
- business_address_state: z.string().describe('State/Province (abbreviation if standard)'),
9128
- business_address_zip: z.string().describe('Zip/Postal code'),
9129
- business_address_country: z.string().describe('Country name'),
9130
- business_address_full: z.string().describe('Complete formatted address'),
9131
- }),
9132
- metadata: {
9133
- func: 'get_business_info',
9134
- company_name: name,
9135
- company_email: email,
9136
- },
9137
- account_profile_info,
9138
- tools: [{ type: 'web_search_preview' }],
9139
- });
8981
+ // // Extract lists from your JSON categories array
8982
+ // const categories = [
8983
+ // {
8984
+ // id: 'ind_technology',
8985
+ // name: 'Technology',
8986
+ // sub: ['Software Development', 'AI & Machine Learning', 'Cybersecurity', 'Cloud Computing', 'IT Services', 'SaaS & Platforms', 'Hardware & Electronics'],
8987
+ // },
8988
+ // {
8989
+ // id: 'ind_marketing',
8990
+ // name: 'Marketing & Advertising',
8991
+ // sub: ['Digital Marketing', 'PPC & SEO', 'Content Creation', 'Branding', 'Social Media Management', 'Email Marketing', 'Market Research'],
8992
+ // },
8993
+ // {
8994
+ // id: 'ind_sales',
8995
+ // name: 'Sales',
8996
+ // sub: ['B2B Sales', 'B2C Sales', 'Real Estate Sales', 'Account Management', 'Lead Generation', 'Inside Sales', 'Field Sales'],
8997
+ // },
8998
+ // {
8999
+ // id: 'ind_finance',
9000
+ // name: 'Finance & Accounting',
9001
+ // sub: ['Banking', 'Investment', 'Financial Planning', 'Accounting', 'Bookkeeping', 'Insurance', 'FinTech'],
9002
+ // },
9003
+ // {
9004
+ // id: 'ind_healthcare',
9005
+ // name: 'Healthcare',
9006
+ // sub: ['Medical Clinics', 'Hospitals', 'Pharma', 'Mental Health', 'Healthcare IT', 'Home Care', 'Medical Research'],
9007
+ // },
9008
+ // {
9009
+ // id: 'ind_realestate',
9010
+ // name: 'Real Estate',
9011
+ // sub: ['Residential Real Estate', 'Commercial Real Estate', 'Property Management', 'Investment & BRRRR', 'Construction', 'Architecture', 'Interior Design'],
9012
+ // },
9013
+ // {
9014
+ // id: 'ind_ecommerce',
9015
+ // name: 'E-commerce',
9016
+ // sub: ['Online Store', 'Dropshipping', 'Amazon FBA', 'Marketplace Selling', 'Retail', 'Inventory Management', 'Fulfillment & Logistics'],
9017
+ // },
9018
+ // {
9019
+ // id: 'ind_education',
9020
+ // name: 'Education',
9021
+ // sub: ['Schools', 'Universities', 'Private Tutoring', 'Online Courses', 'EdTech', 'Training & Development'],
9022
+ // },
9023
+ // {
9024
+ // id: 'ind_hospitality',
9025
+ // name: 'Hospitality & Travel',
9026
+ // sub: ['Hotels', 'Restaurants', 'Cafes & Bars', 'Travel Agencies', 'Tourism', 'Events & Catering', 'Transportation'],
9027
+ // },
9028
+ // {
9029
+ // id: 'ind_professional',
9030
+ // name: 'Professional Services',
9031
+ // sub: ['Legal', 'Consulting', 'HR & Recruiting', 'Accounting Firms', 'Business Services', 'Management Consulting'],
9032
+ // },
9033
+ // {
9034
+ // id: 'ind_manufacturing',
9035
+ // name: 'Manufacturing',
9036
+ // sub: ['Automotive', 'Industrial', 'Textile', 'Electronics', 'Food Production', 'Machinery', 'Chemicals'],
9037
+ // },
9038
+ // {
9039
+ // id: 'ind_nonprofit',
9040
+ // name: 'Nonprofit & Government',
9041
+ // sub: ['NGOs', 'Municipality', 'Government Services', 'Public Health', 'Community Organizations', 'Education Programs'],
9042
+ // },
9043
+ // {
9044
+ // id: 'ind_media',
9045
+ // name: 'Media & Entertainment',
9046
+ // sub: ['Film & Video', 'Music', 'Publishing', 'Gaming', 'News & Journalism', 'Influencers', 'Production Studios'],
9047
+ // },
9048
+ // {
9049
+ // id: 'ind_logistics',
9050
+ // name: 'Logistics & Transportation',
9051
+ // sub: ['Shipping', 'Trucking', 'Last-Mile Delivery', 'Warehousing', 'Freight Forwarding', 'Route Optimization'],
9052
+ // },
9053
+ // {
9054
+ // id: 'ind_energy',
9055
+ // name: 'Energy & Utilities',
9056
+ // sub: ['Solar', 'Oil & Gas', 'Electricity Providers', 'Water Utilities', 'Environmental Services', 'Renewable Energy'],
9057
+ // },
9058
+ // {
9059
+ // id: 'ind_construction',
9060
+ // name: 'Construction & Trades',
9061
+ // sub: ['General Contracting', 'Roofing', 'Plumbing', 'HVAC', 'Electrical', 'Renovation', 'Engineering'],
9062
+ // },
9063
+ // {
9064
+ // id: 'ind_food',
9065
+ // name: 'Food & Beverage',
9066
+ // sub: ['Restaurants', 'Catering', 'Food Manufacturing', 'Bakeries', 'Bars & Nightlife', 'Food Delivery'],
9067
+ // },
9068
+ // {
9069
+ // id: 'ind_retail',
9070
+ // name: 'Retail',
9071
+ // sub: ['Physical Stores', 'Boutiques', 'Supermarkets', 'Consumer Goods', 'Fashion Retail', 'Home Goods'],
9072
+ // },
9073
+ // ];
9074
+ // const categoryNames = categories.map((c) => c.name);
9075
+ // const allSubCategories = categories.flatMap((c) => c.sub);
9140
9076
 
9141
- try {
9142
- if (business_info_ret.code > -1) {
9143
- const data = typeof business_info_ret.data === 'string' ? JSON.parse(business_info_ret.data) : business_info_ret.data;
9077
+ // const business_info_ret = await submit_chat_gpt_prompt({
9078
+ // uid,
9079
+ // prompt: `Research the company: "${name}" (${email}).
9144
9080
 
9145
- // Standardize country codes to uppercase
9146
- if (data.business_country) data.business_country = data.business_country.toUpperCase();
9147
- if (data.business_address_country) {
9148
- data.business_address_country = data.business_address_country.toUpperCase();
9149
- }
9081
+ // REQUIRED INFORMATION:
9082
+ // 1. Company name (official name)
9083
+ // 2. Email domain name
9084
+ // 3. Professional one-sentence biography
9085
+ // 4. Industry category and sub-category
9086
+ // 5. Primary country (2-letter ISO code)
9087
+ // 6. Telephone number
9088
+ // 7. Website URL
9089
+ // 8. COMPLETE ADDRESS DETAILS:
9090
+ // - Full street address (street number, street name, suite/apt if applicable)
9091
+ // - City
9092
+ // - State/Province (use abbreviation where standard)
9093
+ // - Zip/Postal code
9094
+ // - Country
9095
+
9096
+ // ADDRESS FORMATTING EXAMPLES:
9097
+ // - Full street: "1600 Amphitheatre Parkway"
9098
+ // - City: "Mountain View"
9099
+ // - State: "CA"
9100
+ // - Zip: "94043"
9101
+ // - Country: "US"
9102
+ // - Full address: "1600 Amphitheatre Parkway, Mountain View, CA 94043, USA"
9103
+
9104
+ // INSTRUCTIONS:
9105
+ // - Use web search to find accurate information
9106
+ // - If not found online, infer from typical patterns
9107
+ // - For unknown info, use "Not available"
9108
+ // - For US states, use 2-letter abbreviations (CA, NY, TX, etc.)
9109
+ // - For other countries, use standard regional names
9110
+
9111
+ // Be as precise and accurate as possible.`,
9112
+ // model: 'gpt-4o-mini',
9113
+ // response_format: z.object({
9114
+ // business_name: z.string().describe('Official company name'),
9115
+ // business_domain: z.string().describe('Domain name from email'),
9116
+ // business_bio: z.string().describe('One-sentence professional summary'),
9117
+ // business_size: z.enum(['unknown', 'small', 'medium', 'large', 'enterprise']),
9118
+ // business_category: z.enum(categoryNames),
9119
+ // business_sub_category: z.enum(allSubCategories),
9120
+ // business_country: z.string().length(2).describe('2-letter ISO country code'),
9121
+ // business_phone: z.string().describe("Telephone number or 'Not available'"),
9122
+ // business_website: z.string().describe("Website URL or 'Not available'"),
9123
+
9124
+ // // Complete address components
9125
+ // business_address_street: z.string().describe('Full street address (number, street, suite)'),
9126
+ // business_address_city: z.string().describe('City name'),
9127
+ // business_address_state: z.string().describe('State/Province (abbreviation if standard)'),
9128
+ // business_address_zip: z.string().describe('Zip/Postal code'),
9129
+ // business_address_country: z.string().describe('Country name'),
9130
+ // business_address_full: z.string().describe('Complete formatted address'),
9131
+ // }),
9132
+ // metadata: {
9133
+ // func: 'get_business_info',
9134
+ // company_name: name,
9135
+ // company_email: email,
9136
+ // },
9137
+ // account_profile_info,
9138
+ // tools: [{ type: 'web_search_preview' }],
9139
+ // });
9150
9140
 
9151
- // Logic to attach the ID for your database
9152
- const matched = categories.find((c) => c.name === data.business_category);
9153
- data.business_category_id = matched ? matched.id : null;
9141
+ // try {
9142
+ // if (business_info_ret.code > -1) {
9143
+ // const data = typeof business_info_ret.data === 'string' ? JSON.parse(business_info_ret.data) : business_info_ret.data;
9154
9144
 
9155
- // Validate and clean all contact information
9156
- data.business_phone = validatePhoneNumber(data.business_phone);
9157
- data.business_website = validateWebsite(data.business_website);
9158
-
9159
- // Clean and standardize all address components
9160
- data.business_address_street = cleanStreetAddress(data.business_address_street);
9161
- data.business_address_city = cleanText(data.business_address_city);
9162
- data.business_address_zip = cleanZipCode(data.business_address_zip, data.business_country);
9163
- data.business_address_state = cleanStateProvince(data.business_address_state, data.business_country);
9164
- data.business_address_country = cleanCountry(data.business_address_country || data.business_country);
9165
- data.business_address_full = formatFullAddress(data);
9166
-
9167
- // Create a comprehensive structured address object
9168
- data.business_address = {
9169
- street: data.business_address_street,
9170
- city: data.business_address_city,
9171
- state: data.business_address_state,
9172
- zip: data.business_address_zip,
9173
- country: data.business_address_country,
9174
- full: data.business_address_full,
9175
- coordinates: null, // Can be populated later with geocoding
9176
- timezone: null, // Can be populated later
9177
- };
9145
+ // // Standardize country codes to uppercase
9146
+ // if (data.business_country) data.business_country = data.business_country.toUpperCase();
9147
+ // if (data.business_address_country) {
9148
+ // data.business_address_country = data.business_address_country.toUpperCase();
9149
+ // }
9178
9150
 
9179
- // Generate additional useful fields
9180
- data.business_location = {
9181
- region: getRegionFromState(data.business_address_state, data.business_country),
9182
- metro_area: null, // Can be populated later
9183
- is_headquarters: null, // Can be determined from address pattern
9184
- };
9151
+ // // Logic to attach the ID for your database
9152
+ // const matched = categories.find((c) => c.name === data.business_category);
9153
+ // data.business_category_id = matched ? matched.id : null;
9185
9154
 
9186
- return data;
9187
- } else {
9188
- console.error('Business info API call failed:', business_info_ret);
9189
- return getDefaultBusinessInfo(name, email);
9190
- }
9191
- } catch (error) {
9192
- console.error('Error in get_business_info:', error);
9193
- return getDefaultBusinessInfo(name, email, error.message);
9194
- }
9195
- };
9155
+ // // Validate and clean all contact information
9156
+ // data.business_phone = validatePhoneNumber(data.business_phone);
9157
+ // data.business_website = validateWebsite(data.business_website);
9158
+
9159
+ // // Clean and standardize all address components
9160
+ // data.business_address_street = cleanStreetAddress(data.business_address_street);
9161
+ // data.business_address_city = cleanText(data.business_address_city);
9162
+ // data.business_address_zip = cleanZipCode(data.business_address_zip, data.business_country);
9163
+ // data.business_address_state = cleanStateProvince(data.business_address_state, data.business_country);
9164
+ // data.business_address_country = cleanCountry(data.business_address_country || data.business_country);
9165
+ // data.business_address_full = formatFullAddress(data);
9166
+
9167
+ // // Create a comprehensive structured address object
9168
+ // data.business_address = {
9169
+ // street: data.business_address_street,
9170
+ // city: data.business_address_city,
9171
+ // state: data.business_address_state,
9172
+ // zip: data.business_address_zip,
9173
+ // country: data.business_address_country,
9174
+ // full: data.business_address_full,
9175
+ // coordinates: null, // Can be populated later with geocoding
9176
+ // timezone: null, // Can be populated later
9177
+ // };
9178
+
9179
+ // // Generate additional useful fields
9180
+ // data.business_location = {
9181
+ // region: getRegionFromState(data.business_address_state, data.business_country),
9182
+ // metro_area: null, // Can be populated later
9183
+ // is_headquarters: null, // Can be determined from address pattern
9184
+ // };
9185
+
9186
+ // return data;
9187
+ // } else {
9188
+ // console.error('Business info API call failed:', business_info_ret);
9189
+ // return getDefaultBusinessInfo(name, email);
9190
+ // }
9191
+ // } catch (error) {
9192
+ // console.error('Error in get_business_info:', error);
9193
+ // return getDefaultBusinessInfo(name, email, error.message);
9194
+ // }
9195
+ // };
9196
9196
 
9197
9197
  export const get_person_info = async function (uid, name, email, account_profile_info, email_context = '') {
9198
9198
  // ========== HELPER FUNCTIONS ==========
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4723",
3
+ "version": "1.1.4724",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",