@xuda.io/ai_module 1.1.5244 → 1.1.5246

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 +274 -277
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1640,313 +1640,309 @@ const get_studio_doc = async function (req) {
1640
1640
  };
1641
1641
 
1642
1642
  export const get_ai_agent_info = async function (uid, job_id, headers, doc, from_marketplace) {
1643
- try {
1644
- const account_profile_info = await get_active_account_profile_info(uid);
1643
+ const account_profile_info = await get_active_account_profile_info(uid);
1645
1644
 
1646
- const get_contact_border = function (doc) {
1647
- const disable_color = `#1a3557`;
1648
- let ret;
1645
+ const get_contact_border = function (doc) {
1646
+ const disable_color = `#1a3557`;
1647
+ let ret;
1649
1648
 
1650
- // system ai agent
1649
+ // system ai agent
1651
1650
 
1652
- // shared ai agent
1651
+ // shared ai agent
1653
1652
 
1654
- // user's ai agent
1653
+ // user's ai agent
1655
1654
 
1656
- return ret;
1657
- };
1655
+ return ret;
1656
+ };
1658
1657
 
1659
- const get_background = function () {
1660
- let ret;
1661
- let agent_category_color = '';
1662
- let agent_industry_color = '';
1658
+ const get_background = function () {
1659
+ let ret;
1660
+ let agent_category_color = '';
1661
+ let agent_industry_color = '';
1663
1662
 
1664
- // Agent Categories (from your list)
1665
- switch (doc?.studio_meta?.agent_category?.[0]) {
1666
- case 'Personal Productivity': {
1667
- agent_category_color = '#3498db';
1668
- break;
1669
- }
1670
- case 'Business & Operations': {
1671
- agent_category_color = '#9b59b6';
1672
- break;
1673
- }
1674
- case 'Sales & Marketing': {
1675
- agent_category_color = '#e74c3c';
1676
- break;
1677
- }
1678
- case 'Customer Support & Service': {
1679
- agent_category_color = '#f39c12';
1680
- break;
1681
- }
1682
- case 'Developer & Technical': {
1683
- agent_category_color = '#1abc9c';
1684
- break;
1685
- }
1686
- case 'Data & Analytics': {
1687
- agent_category_color = '#34495e';
1688
- break;
1689
- }
1690
- case 'E-commerce': {
1691
- agent_category_color = '#e67e22';
1692
- break;
1693
- }
1694
- case 'Creative & Content': {
1695
- agent_category_color = '#b73775ff';
1696
- break;
1697
- }
1698
- case 'Research & Analysis': {
1699
- agent_category_color = '#00cec9';
1700
- break;
1701
- }
1702
- case 'Industry-Specific': {
1703
- agent_category_color = '#00b894';
1704
- break;
1705
- }
1706
- case 'Automation & Integration': {
1707
- agent_category_color = '#6c5ce7';
1708
- break;
1709
- }
1710
- case 'Security & Risk': {
1711
- agent_category_color = '#c23516d9';
1712
- break;
1713
- }
1714
- case 'Infrastructure & Cloud': {
1715
- agent_category_color = '#0984e3';
1716
- break;
1717
- }
1718
- default: {
1719
- agent_category_color = '#60496e8c';
1720
- break;
1721
- }
1663
+ // Agent Categories (from your list)
1664
+ switch (doc?.studio_meta?.agent_category?.[0]) {
1665
+ case 'Personal Productivity': {
1666
+ agent_category_color = '#3498db';
1667
+ break;
1668
+ }
1669
+ case 'Business & Operations': {
1670
+ agent_category_color = '#9b59b6';
1671
+ break;
1672
+ }
1673
+ case 'Sales & Marketing': {
1674
+ agent_category_color = '#e74c3c';
1675
+ break;
1676
+ }
1677
+ case 'Customer Support & Service': {
1678
+ agent_category_color = '#f39c12';
1679
+ break;
1680
+ }
1681
+ case 'Developer & Technical': {
1682
+ agent_category_color = '#1abc9c';
1683
+ break;
1684
+ }
1685
+ case 'Data & Analytics': {
1686
+ agent_category_color = '#34495e';
1687
+ break;
1688
+ }
1689
+ case 'E-commerce': {
1690
+ agent_category_color = '#e67e22';
1691
+ break;
1692
+ }
1693
+ case 'Creative & Content': {
1694
+ agent_category_color = '#b73775ff';
1695
+ break;
1696
+ }
1697
+ case 'Research & Analysis': {
1698
+ agent_category_color = '#00cec9';
1699
+ break;
1700
+ }
1701
+ case 'Industry-Specific': {
1702
+ agent_category_color = '#00b894';
1703
+ break;
1704
+ }
1705
+ case 'Automation & Integration': {
1706
+ agent_category_color = '#6c5ce7';
1707
+ break;
1708
+ }
1709
+ case 'Security & Risk': {
1710
+ agent_category_color = '#c23516d9';
1711
+ break;
1712
+ }
1713
+ case 'Infrastructure & Cloud': {
1714
+ agent_category_color = '#0984e3';
1715
+ break;
1722
1716
  }
1717
+ default: {
1718
+ agent_category_color = '#60496e8c';
1719
+ break;
1720
+ }
1721
+ }
1723
1722
 
1724
- // Common Industries List
1725
- switch (doc?.studio_meta?.agent_industry) {
1726
- // Technology
1727
- case 'Artificial Intelligence': {
1728
- agent_industry_color = '#ff6b6b';
1729
- break;
1730
- }
1731
- case 'SaaS': {
1732
- agent_industry_color = '#4ecdc4';
1733
- break;
1734
- }
1735
- case 'Fintech': {
1736
- agent_industry_color = '#45b7d1';
1737
- break;
1738
- }
1739
- case 'Healthtech': {
1740
- agent_industry_color = '#96ceb4';
1741
- break;
1742
- }
1743
- case 'Edtech': {
1744
- agent_industry_color = '#ffeaa7';
1745
- break;
1746
- }
1747
- case 'Blockchain/Crypto': {
1748
- agent_industry_color = '#fdcb6e';
1749
- break;
1750
- }
1751
- case 'Cybersecurity': {
1752
- agent_industry_color = '#e17055';
1753
- break;
1754
- }
1755
- case 'Gaming': {
1756
- agent_industry_color = '#a29bfe';
1757
- break;
1758
- }
1723
+ // Common Industries List
1724
+ switch (doc?.studio_meta?.agent_industry) {
1725
+ // Technology
1726
+ case 'Artificial Intelligence': {
1727
+ agent_industry_color = '#ff6b6b';
1728
+ break;
1729
+ }
1730
+ case 'SaaS': {
1731
+ agent_industry_color = '#4ecdc4';
1732
+ break;
1733
+ }
1734
+ case 'Fintech': {
1735
+ agent_industry_color = '#45b7d1';
1736
+ break;
1737
+ }
1738
+ case 'Healthtech': {
1739
+ agent_industry_color = '#96ceb4';
1740
+ break;
1741
+ }
1742
+ case 'Edtech': {
1743
+ agent_industry_color = '#ffeaa7';
1744
+ break;
1745
+ }
1746
+ case 'Blockchain/Crypto': {
1747
+ agent_industry_color = '#fdcb6e';
1748
+ break;
1749
+ }
1750
+ case 'Cybersecurity': {
1751
+ agent_industry_color = '#e17055';
1752
+ break;
1753
+ }
1754
+ case 'Gaming': {
1755
+ agent_industry_color = '#a29bfe';
1756
+ break;
1757
+ }
1759
1758
 
1760
- // Business Services
1761
- case 'Consulting': {
1762
- agent_industry_color = '#636e72';
1763
- break;
1764
- }
1765
- case 'Marketing & Advertising': {
1766
- agent_industry_color = '#fd79a8';
1767
- break;
1768
- }
1769
- case 'Human Resources': {
1770
- agent_industry_color = '#00b894';
1771
- break;
1772
- }
1773
- case 'Legal Services': {
1774
- agent_industry_color = '#6c5ce7';
1775
- break;
1776
- }
1777
- case 'Real Estate': {
1778
- agent_industry_color = '#e17055';
1779
- break;
1780
- }
1759
+ // Business Services
1760
+ case 'Consulting': {
1761
+ agent_industry_color = '#636e72';
1762
+ break;
1763
+ }
1764
+ case 'Marketing & Advertising': {
1765
+ agent_industry_color = '#fd79a8';
1766
+ break;
1767
+ }
1768
+ case 'Human Resources': {
1769
+ agent_industry_color = '#00b894';
1770
+ break;
1771
+ }
1772
+ case 'Legal Services': {
1773
+ agent_industry_color = '#6c5ce7';
1774
+ break;
1775
+ }
1776
+ case 'Real Estate': {
1777
+ agent_industry_color = '#e17055';
1778
+ break;
1779
+ }
1781
1780
 
1782
- // E-commerce & Retail
1783
- case 'E-commerce': {
1784
- agent_industry_color = '#fdcb6e';
1785
- break;
1786
- }
1787
- case 'Retail': {
1788
- agent_industry_color = '#fab1a0';
1789
- break;
1790
- }
1791
- case 'Fashion & Apparel': {
1792
- agent_industry_color = '#e84393';
1793
- break;
1794
- }
1795
- case 'Consumer Goods': {
1796
- agent_industry_color = '#ffeaa7';
1797
- break;
1798
- }
1781
+ // E-commerce & Retail
1782
+ case 'E-commerce': {
1783
+ agent_industry_color = '#fdcb6e';
1784
+ break;
1785
+ }
1786
+ case 'Retail': {
1787
+ agent_industry_color = '#fab1a0';
1788
+ break;
1789
+ }
1790
+ case 'Fashion & Apparel': {
1791
+ agent_industry_color = '#e84393';
1792
+ break;
1793
+ }
1794
+ case 'Consumer Goods': {
1795
+ agent_industry_color = '#ffeaa7';
1796
+ break;
1797
+ }
1799
1798
 
1800
- // Healthcare
1801
- case 'Healthcare': {
1802
- agent_industry_color = '#74b9ff';
1803
- break;
1804
- }
1805
- case 'Medical': {
1806
- agent_industry_color = '#0984e3';
1807
- break;
1808
- }
1809
- case 'Pharmaceutical': {
1810
- agent_industry_color = '#6c5ce7';
1811
- break;
1812
- }
1799
+ // Healthcare
1800
+ case 'Healthcare': {
1801
+ agent_industry_color = '#74b9ff';
1802
+ break;
1803
+ }
1804
+ case 'Medical': {
1805
+ agent_industry_color = '#0984e3';
1806
+ break;
1807
+ }
1808
+ case 'Pharmaceutical': {
1809
+ agent_industry_color = '#6c5ce7';
1810
+ break;
1811
+ }
1813
1812
 
1814
- // Finance
1815
- case 'Banking': {
1816
- agent_industry_color = '#2d3436';
1817
- break;
1818
- }
1819
- case 'Insurance': {
1820
- agent_industry_color = '#00cec9';
1821
- break;
1822
- }
1823
- case 'Investment': {
1824
- agent_industry_color = '#00b894';
1825
- break;
1826
- }
1813
+ // Finance
1814
+ case 'Banking': {
1815
+ agent_industry_color = '#2d3436';
1816
+ break;
1817
+ }
1818
+ case 'Insurance': {
1819
+ agent_industry_color = '#00cec9';
1820
+ break;
1821
+ }
1822
+ case 'Investment': {
1823
+ agent_industry_color = '#00b894';
1824
+ break;
1825
+ }
1827
1826
 
1828
- // Manufacturing & Industrial
1829
- case 'Manufacturing': {
1830
- agent_industry_color = '#636e72';
1831
- break;
1832
- }
1833
- case 'Logistics & Supply Chain': {
1834
- agent_industry_color = '#fd79a8';
1835
- break;
1836
- }
1837
- case 'Construction': {
1838
- agent_industry_color = '#fdcb6e';
1839
- break;
1840
- }
1841
- case 'Energy': {
1842
- agent_industry_color = '#ffeaa7';
1843
- break;
1844
- }
1827
+ // Manufacturing & Industrial
1828
+ case 'Manufacturing': {
1829
+ agent_industry_color = '#636e72';
1830
+ break;
1831
+ }
1832
+ case 'Logistics & Supply Chain': {
1833
+ agent_industry_color = '#fd79a8';
1834
+ break;
1835
+ }
1836
+ case 'Construction': {
1837
+ agent_industry_color = '#fdcb6e';
1838
+ break;
1839
+ }
1840
+ case 'Energy': {
1841
+ agent_industry_color = '#ffeaa7';
1842
+ break;
1843
+ }
1845
1844
 
1846
- // Media & Entertainment
1847
- case 'Media': {
1848
- agent_industry_color = '#e84393';
1849
- break;
1850
- }
1851
- case 'Entertainment': {
1852
- agent_industry_color = '#a29bfe';
1853
- break;
1854
- }
1855
- case 'Sports': {
1856
- agent_industry_color = '#00b894';
1857
- break;
1858
- }
1845
+ // Media & Entertainment
1846
+ case 'Media': {
1847
+ agent_industry_color = '#e84393';
1848
+ break;
1849
+ }
1850
+ case 'Entertainment': {
1851
+ agent_industry_color = '#a29bfe';
1852
+ break;
1853
+ }
1854
+ case 'Sports': {
1855
+ agent_industry_color = '#00b894';
1856
+ break;
1857
+ }
1859
1858
 
1860
- // Other Common Industries
1861
- case 'Education': {
1862
- agent_industry_color = '#0984e3';
1863
- break;
1864
- }
1865
- case 'Travel & Hospitality': {
1866
- agent_industry_color = '#00cec9';
1867
- break;
1868
- }
1869
- case 'Food & Beverage': {
1870
- agent_industry_color = '#e17055';
1871
- break;
1872
- }
1873
- case 'Non-Profit': {
1874
- agent_industry_color = '#2d3436';
1875
- break;
1876
- }
1877
- case 'Government': {
1878
- agent_industry_color = '#636e72';
1879
- break;
1880
- }
1881
- case 'Agriculture': {
1882
- agent_industry_color = '#55efc4';
1883
- break;
1884
- }
1885
- case 'Automotive': {
1886
- agent_industry_color = '#dfe6e9';
1887
- break;
1888
- }
1889
- case 'Telecommunications': {
1890
- agent_industry_color = '#74b9ff';
1891
- break;
1892
- }
1859
+ // Other Common Industries
1860
+ case 'Education': {
1861
+ agent_industry_color = '#0984e3';
1862
+ break;
1863
+ }
1864
+ case 'Travel & Hospitality': {
1865
+ agent_industry_color = '#00cec9';
1866
+ break;
1867
+ }
1868
+ case 'Food & Beverage': {
1869
+ agent_industry_color = '#e17055';
1870
+ break;
1871
+ }
1872
+ case 'Non-Profit': {
1873
+ agent_industry_color = '#2d3436';
1874
+ break;
1875
+ }
1876
+ case 'Government': {
1877
+ agent_industry_color = '#636e72';
1878
+ break;
1879
+ }
1880
+ case 'Agriculture': {
1881
+ agent_industry_color = '#55efc4';
1882
+ break;
1883
+ }
1884
+ case 'Automotive': {
1885
+ agent_industry_color = '#dfe6e9';
1886
+ break;
1887
+ }
1888
+ case 'Telecommunications': {
1889
+ agent_industry_color = '#74b9ff';
1890
+ break;
1891
+ }
1893
1892
 
1894
- default: {
1895
- agent_industry_color = '#71C4FF44';
1896
- break;
1897
- }
1893
+ default: {
1894
+ agent_industry_color = '#71C4FF44';
1895
+ break;
1898
1896
  }
1897
+ }
1899
1898
 
1900
- ret = `linear-gradient(145deg, ${agent_category_color} 0%, ${agent_industry_color} 100%)`;
1901
- return ret;
1902
- };
1899
+ ret = `linear-gradient(145deg, ${agent_category_color} 0%, ${agent_industry_color} 100%)`;
1900
+ return ret;
1901
+ };
1903
1902
 
1904
- const agent_conversation_count = async function (agent_id) {
1905
- const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_counts', {
1906
- reduce: true,
1907
- group_level: 1,
1903
+ const agent_conversation_count = async function (agent_id) {
1904
+ const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_counts', {
1905
+ reduce: true,
1906
+ group_level: 1,
1908
1907
 
1909
- startkey: [agent_id, ''],
1910
- endkey: [agent_id, 'zzzzzz'],
1911
- });
1908
+ startkey: [agent_id, ''],
1909
+ endkey: [agent_id, 'zzzzzz'],
1910
+ });
1912
1911
 
1913
- return counts_ret?.rows?.[0]?.value || 0;
1914
- };
1912
+ return counts_ret?.rows?.[0]?.value || 0;
1913
+ };
1915
1914
 
1916
- delete doc.agentConfig;
1915
+ delete doc.agentConfig;
1917
1916
 
1918
- if (doc.stat === 1) {
1919
- doc.archived = true;
1920
- }
1917
+ if (doc.stat === 1) {
1918
+ doc.archived = true;
1919
+ }
1921
1920
 
1922
- if (doc?.studio_meta?.createdByUid) {
1923
- doc.user_contact = await get_user_card({ uid, uid_query: doc.studio_meta.createdByUid });
1924
- }
1925
- if (!from_marketplace) {
1926
- doc.interactions = 0;
1927
- doc.chats = await agent_conversation_count(doc._id);
1921
+ if (doc?.studio_meta?.createdByUid) {
1922
+ doc.user_contact = await get_user_card({ uid, uid_query: doc.studio_meta.createdByUid });
1923
+ }
1924
+ if (!from_marketplace) {
1925
+ doc.interactions = 0;
1926
+ doc.chats = await agent_conversation_count(doc._id);
1928
1927
 
1929
- // const chats_ret = await get_ai_chats({ uid, reference_id: doc._id }, job_id, headers);
1928
+ // const chats_ret = await get_ai_chats({ uid, reference_id: doc._id }, job_id, headers);
1930
1929
 
1931
- // for (let chat of chats_ret?.data?.docs || []) {
1932
- // doc.chats++;
1933
- // if (chat.interactions) doc.interactions += chat.interactions;
1934
- // }
1935
- }
1936
- doc.border = get_contact_border(doc);
1937
- doc.card_background = get_background(doc);
1938
- doc.icon_pattern = 'ai-agent-pattern.png';
1930
+ // for (let chat of chats_ret?.data?.docs || []) {
1931
+ // doc.chats++;
1932
+ // if (chat.interactions) doc.interactions += chat.interactions;
1933
+ // }
1934
+ }
1935
+ doc.border = get_contact_border(doc);
1936
+ doc.card_background = get_background(doc);
1937
+ doc.icon_pattern = 'ai-agent-pattern.png';
1939
1938
 
1940
- if (!from_marketplace) {
1941
- if (doc?.reference_doc?.studio_meta?.shared_from_uid) {
1942
- const shared_from_uid_ret = await get_account_name({ uid_query: doc.reference_doc.studio_meta.shared_from_uid });
1943
- doc.icon_pattern = shared_from_uid_ret.data.profile_avatar;
1944
- }
1939
+ if (!from_marketplace) {
1940
+ if (doc?.reference_doc?.studio_meta?.shared_from_uid) {
1941
+ const shared_from_uid_ret = await get_account_name({ uid_query: doc.reference_doc.studio_meta.shared_from_uid });
1942
+ doc.icon_pattern = shared_from_uid_ret.data.profile_avatar;
1945
1943
  }
1946
- return doc;
1947
- } catch (err) {
1948
- return {};
1949
1944
  }
1945
+ return doc;
1950
1946
  };
1951
1947
 
1952
1948
  const get_user_ai_agents = async function (uid) {
@@ -4207,6 +4203,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4207
4203
  };
4208
4204
 
4209
4205
  const render_output_suggestions = async function (response_conversation_item_id) {
4206
+ debugger;
4210
4207
  console.log('prompt_suggestions', prompt_suggestions);
4211
4208
  const agentIds = prompt_suggestions.map((agent) => agent.agent_id);
4212
4209
  const ret = await get_chat_suggestions({ uid, ai_agents, conversation_item_id: response_conversation_item_id, exclude_agents: agentIds });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.5244",
3
+ "version": "1.1.5246",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",