@xuda.io/ai_module 1.1.3992 → 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.
- package/index.mjs +24 -27
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4716,33 +4716,30 @@ const ai_chat_conversation = async function (req, job_id, headers) {
|
|
|
4716
4716
|
}
|
|
4717
4717
|
}
|
|
4718
4718
|
try {
|
|
4719
|
-
register_tool(
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
const
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
},
|
|
4744
|
-
}),
|
|
4745
|
-
);
|
|
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
|
+
});
|
|
4746
4743
|
} catch (error) {
|
|
4747
4744
|
debugger;
|
|
4748
4745
|
}
|