@langgraph-js/sdk 1.7.5 → 1.7.6
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/tool/ToolUI.d.ts +4 -1
- package/dist/tool/ToolUI.js +1 -1
- package/package.json +1 -1
- package/src/tool/ToolUI.ts +6 -2
package/dist/tool/ToolUI.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { RenderMessage } from "../LangGraphClient.js";
|
|
2
2
|
import { LangGraphClient } from "../LangGraphClient.js";
|
|
3
|
+
export type DeepPartial<T> = {
|
|
4
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
5
|
+
};
|
|
3
6
|
export declare class ToolRenderData<I, D> {
|
|
4
7
|
message: RenderMessage;
|
|
5
8
|
client: LangGraphClient;
|
|
@@ -10,6 +13,6 @@ export declare class ToolRenderData<I, D> {
|
|
|
10
13
|
getJSONOutput(): D;
|
|
11
14
|
/** 如果解析失败,则返回 null */
|
|
12
15
|
getJSONOutputSafe(): D | null;
|
|
13
|
-
getInputRepaired(): I
|
|
16
|
+
getInputRepaired(): DeepPartial<I>;
|
|
14
17
|
response(data: D): void;
|
|
15
18
|
}
|
package/dist/tool/ToolUI.js
CHANGED
package/package.json
CHANGED
package/src/tool/ToolUI.ts
CHANGED
|
@@ -3,6 +3,10 @@ import { RenderMessage } from "../LangGraphClient.js";
|
|
|
3
3
|
import { LangGraphClient } from "../LangGraphClient.js";
|
|
4
4
|
import { getMessageContent } from "../ui-store/createChatStore.js";
|
|
5
5
|
import { jsonrepair } from "jsonrepair";
|
|
6
|
+
|
|
7
|
+
export type DeepPartial<T> = {
|
|
8
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
9
|
+
};
|
|
6
10
|
export class ToolRenderData<I, D> {
|
|
7
11
|
constructor(
|
|
8
12
|
public message: RenderMessage,
|
|
@@ -38,11 +42,11 @@ export class ToolRenderData<I, D> {
|
|
|
38
42
|
return null;
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
|
-
getInputRepaired(): I
|
|
45
|
+
getInputRepaired(): DeepPartial<I> {
|
|
42
46
|
try {
|
|
43
47
|
return JSON.parse(jsonrepair(this.message.tool_input || ""));
|
|
44
48
|
} catch (e) {
|
|
45
|
-
return
|
|
49
|
+
return {};
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
52
|
response(data: D) {
|