@xuda.io/ai_module 1.1.3991 → 1.1.3993

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 +27 -32
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4627,11 +4627,9 @@ const ai_chat_conversation = async function (req, job_id, headers) {
4627
4627
  let tools = [];
4628
4628
  let tool_resources = {};
4629
4629
 
4630
- const register_tool=function(opt){
4631
- tools.push(
4632
- tool(opt)
4633
- }
4634
-
4630
+ const register_tool = function (opt) {
4631
+ tools.push(tool(opt));
4632
+ };
4635
4633
 
4636
4634
  for (const [key, val] of Object.entries(ai_agent_doc?.agentConfig?.agent_tools || [])) {
4637
4635
  const { name, description } = val;
@@ -4718,33 +4716,30 @@ tools.push(
4718
4716
  }
4719
4717
  }
4720
4718
  try {
4721
- register_tool()
4722
- tools.push(
4723
- tool({
4724
- name: method_name.replace(/_/g, ' ').replace(/\b(\w)/g, (_, char) => char.toUpperCase()),
4725
- description: method_prop.description,
4726
- parameters: z.object(inputSchema),
4727
- async execute(e, RunContext) {
4728
- const params = e;
4729
- try {
4730
- const response = await fetch(`http://localhost:3007/cpi/${method_name}`, {
4731
- method: 'POST',
4732
- headers: {
4733
- Accept: 'application/json',
4734
- 'Content-Type': 'application/json',
4735
- },
4736
- body: JSON.stringify({ ...params, ...{ gtp_token } }),
4737
- });
4738
- const ret = await response.json();
4739
- return {
4740
- content: [{ type: 'text', text: JSON.stringify(ret || '', null, 2) }],
4741
- };
4742
- } catch (err) {
4743
- return 'unknown';
4744
- }
4745
- },
4746
- }),
4747
- );
4719
+ register_tool({
4720
+ name: method_name.replace(/_/g, ' ').replace(/\b(\w)/g, (_, char) => char.toUpperCase()),
4721
+ description: method_prop.description,
4722
+ parameters: z.object(inputSchema),
4723
+ async execute(e, RunContext) {
4724
+ const params = e;
4725
+ try {
4726
+ const response = await fetch(`http://localhost:3007/cpi/${method_name}`, {
4727
+ method: 'POST',
4728
+ headers: {
4729
+ Accept: 'application/json',
4730
+ 'Content-Type': 'application/json',
4731
+ },
4732
+ body: JSON.stringify({ ...params, ...{ gtp_token } }),
4733
+ });
4734
+ const ret = await response.json();
4735
+ return {
4736
+ content: [{ type: 'text', text: JSON.stringify(ret || '', null, 2) }],
4737
+ };
4738
+ } catch (err) {
4739
+ return 'unknown';
4740
+ }
4741
+ },
4742
+ });
4748
4743
  } catch (error) {
4749
4744
  debugger;
4750
4745
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.3991",
3
+ "version": "1.1.3993",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",