@xuda.io/ai_module 1.1.3997 → 1.1.3998

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 (3) hide show
  1. package/index.mjs +0 -58
  2. package/old.mjs +58 -0
  3. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4749,64 +4749,6 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4749
4749
  break;
4750
4750
  }
4751
4751
 
4752
- // case 'web_search': {
4753
- // tools.push(
4754
- // tool({
4755
- // name: name || val.type,
4756
- // description: description || val.type,
4757
- // parameters: z.object({
4758
- // query: z.string().describe('The search query text.'),
4759
- // numResults: z.number().int().describe('Number of top search results to return.').default(3),
4760
- // }),
4761
- // async execute(e, RunContext) {
4762
- // const { query, numResults } = e;
4763
- // try {
4764
- // const searchUrl = `https://api.duckduckgo.com/?q=${encodeURIComponent(query)}&format=json&no_redirect=1`;
4765
- // const response = await fetch(searchUrl);
4766
- // const data = await response.json();
4767
-
4768
- // // Simplify results
4769
- // const results = (data.RelatedTopics || []).slice(0, numResults).map((item) => ({
4770
- // title: item.Text,
4771
- // url: item.FirstURL,
4772
- // }));
4773
-
4774
- // return JSON.stringify(results, null, 2);
4775
- // } catch (err) {
4776
- // return 'unknown';
4777
- // }
4778
- // },
4779
- // }),
4780
- // );
4781
- // break;
4782
- // }
4783
-
4784
- // case 'image_generate': {
4785
- // tools.push(
4786
- // tool({
4787
- // name,
4788
- // description,
4789
- // parameters: z.object({
4790
- // prompt: z.string().describe('The prompt for the image.'),
4791
- // numGenerations: z.number().int().describe('Number generations to image create.').default(3),
4792
- // }),
4793
- // async execute(e, RunContext) {
4794
- // const { prompt, numGenerations = val?.image_generations } = e;
4795
- // try {
4796
- // const base64 = await create_image(prompt, undefined, undefined, numGenerations);
4797
- // // console.log(base64);
4798
-
4799
- // // return `<img src="data:image/jpg;base64,${base64}">`;
4800
- // return `![Generated Image](data:image/jpeg;base64,${base64})`;
4801
- // } catch (err) {
4802
- // return 'unknown';
4803
- // }
4804
- // },
4805
- // }),
4806
- // );
4807
- // break;
4808
- // }
4809
-
4810
4752
  case 'image_generate': {
4811
4753
  tools.push(
4812
4754
  tool({
package/old.mjs CHANGED
@@ -1630,3 +1630,61 @@ async function testTool(app_id, uid) {
1630
1630
  // }
1631
1631
  // // }, 500);
1632
1632
  // };
1633
+
1634
+ // case 'web_search': {
1635
+ // tools.push(
1636
+ // tool({
1637
+ // name: name || val.type,
1638
+ // description: description || val.type,
1639
+ // parameters: z.object({
1640
+ // query: z.string().describe('The search query text.'),
1641
+ // numResults: z.number().int().describe('Number of top search results to return.').default(3),
1642
+ // }),
1643
+ // async execute(e, RunContext) {
1644
+ // const { query, numResults } = e;
1645
+ // try {
1646
+ // const searchUrl = `https://api.duckduckgo.com/?q=${encodeURIComponent(query)}&format=json&no_redirect=1`;
1647
+ // const response = await fetch(searchUrl);
1648
+ // const data = await response.json();
1649
+
1650
+ // // Simplify results
1651
+ // const results = (data.RelatedTopics || []).slice(0, numResults).map((item) => ({
1652
+ // title: item.Text,
1653
+ // url: item.FirstURL,
1654
+ // }));
1655
+
1656
+ // return JSON.stringify(results, null, 2);
1657
+ // } catch (err) {
1658
+ // return 'unknown';
1659
+ // }
1660
+ // },
1661
+ // }),
1662
+ // );
1663
+ // break;
1664
+ // }
1665
+
1666
+ // case 'image_generate': {
1667
+ // tools.push(
1668
+ // tool({
1669
+ // name,
1670
+ // description,
1671
+ // parameters: z.object({
1672
+ // prompt: z.string().describe('The prompt for the image.'),
1673
+ // numGenerations: z.number().int().describe('Number generations to image create.').default(3),
1674
+ // }),
1675
+ // async execute(e, RunContext) {
1676
+ // const { prompt, numGenerations = val?.image_generations } = e;
1677
+ // try {
1678
+ // const base64 = await create_image(prompt, undefined, undefined, numGenerations);
1679
+ // // console.log(base64);
1680
+
1681
+ // // return `<img src="data:image/jpg;base64,${base64}">`;
1682
+ // return `![Generated Image](data:image/jpeg;base64,${base64})`;
1683
+ // } catch (err) {
1684
+ // return 'unknown';
1685
+ // }
1686
+ // },
1687
+ // }),
1688
+ // );
1689
+ // break;
1690
+ // }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.3997",
3
+ "version": "1.1.3998",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",