Local branch had diverged from origin/master (sibling commits on the same base). Rewrote local history linearly on top of origin/master, folding in all local content: exa/hot-platform discovery hunters, leaks ledger, nightly sweep orchestrator, updated .gitignore and skill docs, plus the latest hunt output and vault state. Remote-only files (vault keys, channel scripts) were restored rather than dropped, so the resulting tree is a full union of both sides.
1 line
11 KiB
JSON
1 line
11 KiB
JSON
{"repo": "acefun29/jswarm", "files": {"jswarm-examples/src/main/java/com/jswarm/examples/langchain4j/LangChain4jExample.java": {"d37259a034bc0cd60e86aaa553b4d4402681550c": {"t": 1785745677.9572814, "n": 3231, "h": "15de1511e9bc5463", "c": "// LangChain4j 适配器最小 Quickstart:JAgent / Swarm / SwarmRunner\npackage com.jswarm.examples.langchain4j;\n\nimport com.jswarm.adapter.lc4j.JAgent;\nimport com.jswarm.adapter.lc4j.run.SwarmRunner;\nimport com.jswarm.core.Swarm;\nimport com.jswarm.core.SwarmContext;\nimport com.jswarm.examples.shared.OrderService;\nimport dev.langchain4j.agent.tool.Tool;\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\n\npublic final class LangChain4jExample {\n\n private LangChain4jExample() {\n }\n\n public static void main(String[] args) {\n String apiKey = resolveApiKey();\n if (apiKey == null) {\n System.err.println(\"请设置环境变量 DEEPSEEK_API_KEY 后重试。\");\n return;\n }\n\n ChatModel model = OpenAiChatModel.builder()\n .baseUrl(\"https://api.deepseek.com\")\n .apiKey(apiKey)\n .modelName(\"deepseek-chat\")\n .build();\n\n Swarm swarm = createSwarm(model);\n SwarmContext ctx = new SwarmContext();\n ctx.put(\"user_name\", \"张三\");\n\n String message = args.length > 0 ? args[0] : \"帮我查一下订单 ORD-001\";\n String reply = SwarmRunner.create(swarm).run(message, ctx);\n System.out.println(reply);\n }\n\n public static Swarm createSwarm(ChatModel model) {\n OrderTools tools = new OrderTools(new OrderService());\n\n JAgent router = JAgent.builder(\"router\", \"路由专员\")\n .description(\"分析用户意图并分发\")\n .instructions(\"\"\"\n 你是客服路由专员。用户 {user_name}。\n 产品咨询、报价 → handoff 给 sales。\n 技术问题 → handoff 给 tech。\n 订单查询 → delegate 给 tech。\n \"\"\")\n .model(model)\n .build();\n\n JAgent sales = JAgent.builder(\"sales\", \"销售专员\")\n .description(\"处理产品咨询与报价\")\n .instructions(\"你是销售专员。用户 {user_name}。回答产品与价格问题。\")\n .model(model)\n .build();\n\n JAgent tech = JAgent.builder(\"tech\", \"技术支持\")\n .description(\"技术问题与订单查询\")\n .instructions(\"你是技术支持。用户 {user_name}。可使用 lookupOrder 查询订单。\")\n .model(model)\n .tools(tools)\n .build();\n\n return Swarm.create(\"智能客服\")\n .agent(router)\n .agent(sales)\n .agent(tech)\n .entry(\"router\")\n .handoff(\"router\", \"sales\", \"tech\")\n .delegate(\"router\", \"tech\")\n .build();\n }\n\n private static String resolveApiKey() {\n String apiKey = System.getenv(\"DEEPSEEK_API_KEY\");\n if (apiKey == null || apiKey.isBlank()) {\n apiKey = System.getProperty(\"deepseek.api.key\");\n }\n if (apiKey == null || apiKey.isBlank()) {\n return null;\n }\n return apiKey;\n }\n\n public static final class OrderTools {\n private final OrderService orderService;\n\n public OrderTools(OrderService orderService) {\n this.orderService = orderService;\n }\n\n @Tool(\"查询订单状态\")\n public String lookupOrder(String orderId) {\n return orderService.lookupOrder(orderId);\n }\n }\n}\n"}, "e713d5230ea032b4083caff56338a56e7c8eddfb": {"t": 1785755676.7235384, "n": 3231, "h": "15de1511e9bc5463", "c": "// LangChain4j 适配器最小 Quickstart:JAgent / Swarm / SwarmRunner\npackage com.jswarm.examples.langchain4j;\n\nimport com.jswarm.adapter.lc4j.JAgent;\nimport com.jswarm.adapter.lc4j.run.SwarmRunner;\nimport com.jswarm.core.Swarm;\nimport com.jswarm.core.SwarmContext;\nimport com.jswarm.examples.shared.OrderService;\nimport dev.langchain4j.agent.tool.Tool;\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\n\npublic final class LangChain4jExample {\n\n private LangChain4jExample() {\n }\n\n public static void main(String[] args) {\n String apiKey = resolveApiKey();\n if (apiKey == null) {\n System.err.println(\"请设置环境变量 DEEPSEEK_API_KEY 后重试。\");\n return;\n }\n\n ChatModel model = OpenAiChatModel.builder()\n .baseUrl(\"https://api.deepseek.com\")\n .apiKey(apiKey)\n .modelName(\"deepseek-chat\")\n .build();\n\n Swarm swarm = createSwarm(model);\n SwarmContext ctx = new SwarmContext();\n ctx.put(\"user_name\", \"张三\");\n\n String message = args.length > 0 ? args[0] : \"帮我查一下订单 ORD-001\";\n String reply = SwarmRunner.create(swarm).run(message, ctx);\n System.out.println(reply);\n }\n\n public static Swarm createSwarm(ChatModel model) {\n OrderTools tools = new OrderTools(new OrderService());\n\n JAgent router = JAgent.builder(\"router\", \"路由专员\")\n .description(\"分析用户意图并分发\")\n .instructions(\"\"\"\n 你是客服路由专员。用户 {user_name}。\n 产品咨询、报价 → handoff 给 sales。\n 技术问题 → handoff 给 tech。\n 订单查询 → delegate 给 tech。\n \"\"\")\n .model(model)\n .build();\n\n JAgent sales = JAgent.builder(\"sales\", \"销售专员\")\n .description(\"处理产品咨询与报价\")\n .instructions(\"你是销售专员。用户 {user_name}。回答产品与价格问题。\")\n .model(model)\n .build();\n\n JAgent tech = JAgent.builder(\"tech\", \"技术支持\")\n .description(\"技术问题与订单查询\")\n .instructions(\"你是技术支持。用户 {user_name}。可使用 lookupOrder 查询订单。\")\n .model(model)\n .tools(tools)\n .build();\n\n return Swarm.create(\"智能客服\")\n .agent(router)\n .agent(sales)\n .agent(tech)\n .entry(\"router\")\n .handoff(\"router\", \"sales\", \"tech\")\n .delegate(\"router\", \"tech\")\n .build();\n }\n\n private static String resolveApiKey() {\n String apiKey = System.getenv(\"DEEPSEEK_API_KEY\");\n if (apiKey == null || apiKey.isBlank()) {\n apiKey = System.getProperty(\"deepseek.api.key\");\n }\n if (apiKey == null || apiKey.isBlank()) {\n return null;\n }\n return apiKey;\n }\n\n public static final class OrderTools {\n private final OrderService orderService;\n\n public OrderTools(OrderService orderService) {\n this.orderService = orderService;\n }\n\n @Tool(\"查询订单状态\")\n public String lookupOrder(String orderId) {\n return orderService.lookupOrder(orderId);\n }\n }\n}\n"}, "08dd7d438e3bda22dd63bd0693dcee9e9d804a11": {"t": 1786067434.7518551, "n": 3231, "h": "15de1511e9bc5463", "c": "// LangChain4j 适配器最小 Quickstart:JAgent / Swarm / SwarmRunner\npackage com.jswarm.examples.langchain4j;\n\nimport com.jswarm.adapter.lc4j.JAgent;\nimport com.jswarm.adapter.lc4j.run.SwarmRunner;\nimport com.jswarm.core.Swarm;\nimport com.jswarm.core.SwarmContext;\nimport com.jswarm.examples.shared.OrderService;\nimport dev.langchain4j.agent.tool.Tool;\nimport dev.langchain4j.model.chat.ChatModel;\nimport dev.langchain4j.model.openai.OpenAiChatModel;\n\npublic final class LangChain4jExample {\n\n private LangChain4jExample() {\n }\n\n public static void main(String[] args) {\n String apiKey = resolveApiKey();\n if (apiKey == null) {\n System.err.println(\"请设置环境变量 DEEPSEEK_API_KEY 后重试。\");\n return;\n }\n\n ChatModel model = OpenAiChatModel.builder()\n .baseUrl(\"https://api.deepseek.com\")\n .apiKey(apiKey)\n .modelName(\"deepseek-chat\")\n .build();\n\n Swarm swarm = createSwarm(model);\n SwarmContext ctx = new SwarmContext();\n ctx.put(\"user_name\", \"张三\");\n\n String message = args.length > 0 ? args[0] : \"帮我查一下订单 ORD-001\";\n String reply = SwarmRunner.create(swarm).run(message, ctx);\n System.out.println(reply);\n }\n\n public static Swarm createSwarm(ChatModel model) {\n OrderTools tools = new OrderTools(new OrderService());\n\n JAgent router = JAgent.builder(\"router\", \"路由专员\")\n .description(\"分析用户意图并分发\")\n .instructions(\"\"\"\n 你是客服路由专员。用户 {user_name}。\n 产品咨询、报价 → handoff 给 sales。\n 技术问题 → handoff 给 tech。\n 订单查询 → delegate 给 tech。\n \"\"\")\n .model(model)\n .build();\n\n JAgent sales = JAgent.builder(\"sales\", \"销售专员\")\n .description(\"处理产品咨询与报价\")\n .instructions(\"你是销售专员。用户 {user_name}。回答产品与价格问题。\")\n .model(model)\n .build();\n\n JAgent tech = JAgent.builder(\"tech\", \"技术支持\")\n .description(\"技术问题与订单查询\")\n .instructions(\"你是技术支持。用户 {user_name}。可使用 lookupOrder 查询订单。\")\n .model(model)\n .tools(tools)\n .build();\n\n return Swarm.create(\"智能客服\")\n .agent(router)\n .agent(sales)\n .agent(tech)\n .entry(\"router\")\n .handoff(\"router\", \"sales\", \"tech\")\n .delegate(\"router\", \"tech\")\n .build();\n }\n\n private static String resolveApiKey() {\n String apiKey = System.getenv(\"DEEPSEEK_API_KEY\");\n if (apiKey == null || apiKey.isBlank()) {\n apiKey = System.getProperty(\"deepseek.api.key\");\n }\n if (apiKey == null || apiKey.isBlank()) {\n return null;\n }\n return apiKey;\n }\n\n public static final class OrderTools {\n private final OrderService orderService;\n\n public OrderTools(OrderService orderService) {\n this.orderService = orderService;\n }\n\n @Tool(\"查询订单状态\")\n public String lookupOrder(String orderId) {\n return orderService.lookupOrder(orderId);\n }\n }\n}\n"}}}} |