@axiom-lattice/core 1.0.35 → 1.0.39
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/dist/index.js +55 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -354,6 +354,7 @@ import z from "zod";
|
|
|
354
354
|
import {
|
|
355
355
|
tool
|
|
356
356
|
} from "@langchain/core/tools";
|
|
357
|
+
import { interrupt } from "@langchain/langgraph";
|
|
357
358
|
var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
358
359
|
/**
|
|
359
360
|
* 获取ToolLatticeManager单例实例
|
|
@@ -381,6 +382,24 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
381
382
|
const result = await executor(input, exe_config);
|
|
382
383
|
return result;
|
|
383
384
|
};
|
|
385
|
+
if (config.needUserApprove) {
|
|
386
|
+
toolExecutor = async (input, exe_config) => {
|
|
387
|
+
const contents = [
|
|
388
|
+
"```confirm",
|
|
389
|
+
JSON.stringify({
|
|
390
|
+
message: "try to " + config.name + ",please confirm the action"
|
|
391
|
+
}),
|
|
392
|
+
"```"
|
|
393
|
+
].join("\n");
|
|
394
|
+
const feedback = await interrupt(contents);
|
|
395
|
+
if (feedback.data.action === "yes") {
|
|
396
|
+
const result = await executor(input, exe_config);
|
|
397
|
+
return result;
|
|
398
|
+
} else {
|
|
399
|
+
return "user denied the action";
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
}
|
|
384
403
|
const toolLattice = {
|
|
385
404
|
key,
|
|
386
405
|
config,
|