抽象统一定位方法,支持多种地理要素

This commit is contained in:
2026-04-03 13:45:37 +08:00
parent d610a09c14
commit c484aad1d3
6 changed files with 252 additions and 48 deletions
@@ -56,11 +56,11 @@ describe("parseContentWithToolCalls", () => {
it("parses a complete tool_call block", () => {
const content =
'分析完成。\n<tool_call>{"tool":"locate_nodes","params":{"ids":["J1","J2"]}}</tool_call>\n以上是结果。';
'分析完成。\n<tool_call>{"tool":"locate_junctions","params":{"ids":["J1","J2"]}}</tool_call>\n以上是结果。';
const result = parseContentWithToolCalls(content);
expect(result.toolCalls).toHaveLength(1);
expect(result.toolCalls[0].tool).toBe("locate_nodes");
expect(result.toolCalls[0].tool).toBe("locate_junctions");
expect(result.toolCalls[0].params).toEqual({ ids: ["J1", "J2"] });
expect(result.segments).toHaveLength(3);
@@ -70,7 +70,7 @@ describe("parseContentWithToolCalls", () => {
});
expect(result.segments[1]).toMatchObject({
type: "tool_call",
toolCall: { tool: "locate_nodes" },
toolCall: { tool: "locate_junctions" },
});
expect(result.segments[2]).toEqual({
type: "text",