Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ JoyAgent-JDGenie是一个通用的多智能体框架,对于用户需要定制
docker build -t genie:latest .

4. 启动dockerfile
#加上-p 8188:8188 可在部署使用服务地址调用client从而调用工具
docker run -d -p 3000:3000 -p 8080:8080 -p 1601:1601 --name genie-app genie:latest

5. 浏览器输入 localhost:3000 访问genie
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import com.jd.genie.agent.tool.ToolCollection;
import com.jd.genie.model.dto.FileInformation;
import com.jd.genie.model.req.AgentRequest;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.*;
import lombok.extern.slf4j.Slf4j;

import java.util.List;
Expand All @@ -24,6 +21,7 @@ public class AgentContext {
String query;
String task;
Printer printer;
@ToString.Exclude
ToolCollection toolCollection;
String dateInfo;
List<File> productFiles;
Expand Down
7 changes: 5 additions & 2 deletions genie-backend/src/main/java/com/jd/genie/agent/llm/LLM.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public CompletableFuture<String> ask(
// 处理非流式请求
if (!stream) {
params.put("stream", false);

params.put("enable_thinking",false);
// 调用 API
CompletableFuture<String> future = callOpenAI(params);

Expand Down Expand Up @@ -466,6 +466,7 @@ public CompletableFuture<ToolCallResponse> askTool(
log.info("{} call llm request {}", context.getRequestId(), JSONObject.toJSONString(params));
if (!stream) {
params.put("stream", false);
params.put("enable_thinking",false);
// 调用 API
CompletableFuture<String> future = callOpenAI(params, timeout);
return future.thenApply(responseJson -> {
Expand Down Expand Up @@ -718,7 +719,9 @@ public void onResponse(Call call, Response response) {
currentToolCall.function = toolCall.function;
}
if (Objects.nonNull(toolCall.function.arguments)) {
currentToolCall.function.arguments += toolCall.function.arguments;
if (!currentToolCall.function.arguments.equals(toolCall.function.arguments)) {
currentToolCall.function.arguments += toolCall.function.arguments;
}
}
}
openToolCallsMap.put(toolCall.index, currentToolCall);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.jd.genie.agent.dto.tool.McpToolInfo;
import com.jd.genie.agent.tool.mcp.McpTool;
import lombok.Data;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

Expand All @@ -19,6 +20,7 @@
public class ToolCollection {
private Map<String, BaseTool> toolMap;
private Map<String, McpToolInfo> mcpToolMap;
@ToString.Exclude
private AgentContext agentContext;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class CodeInterpreterTool implements BaseTool {

@Override
public String getName() {
return "code_interpreter";
return "code_interpreter_tool";
}

@Override
Expand Down
11 changes: 11 additions & 0 deletions genie-backend/src/main/java/com/jd/genie/config/GenieConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,5 +252,16 @@ public void setStructParseToolSystemPrompt(String str) {
@Value("${autobots.autoagent.tool.task_complete_desc:当前task完成,请将当前task标记为 completed}")
private String taskCompleteDesc;

@Value("${server.ip:127.0.0.1}")
private String serverIp;
public String getServerIp() {
return serverIp;
}

@Value("${server.port:8080}")
private Integer serverPort;
public Integer getServerPort() {
return serverPort;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public SseEmitter AutoAgent(@RequestBody AgentRequest request) throws Unsupporte
Printer printer = new SSEPrinter(emitter, request, request.getAgentType());
AgentContext agentContext = AgentContext.builder()
.requestId(request.getRequestId())
.sessionId(request.getRequestId())
.sessionId(request.getSessionId())
.printer(printer)
.query(request.getQuery())
.task("")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
@AllArgsConstructor
public class AgentRequest {
private String requestId;
private String sessionId;
private String erp;
private String query;
private Integer agentType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public void onResponse(Call call, Response response) {
private Request buildHttpRequest(AgentRequest autoReq) {
String reqId = autoReq.getRequestId();
autoReq.setRequestId(autoReq.getRequestId());
String url = "http://127.0.0.1:8080/AutoAgent";
String url = "http://" + genieConfig.getServerIp() + ":" + genieConfig.getServerPort() + "/AutoAgent";
RequestBody body = RequestBody.create(
MediaType.parse("application/json"),
JSONObject.toJSONString(autoReq)
Expand Down Expand Up @@ -158,6 +158,7 @@ private GptProcessResult buildDefaultAutobotsResult(AgentRequest autoReq, String
private AgentRequest buildAgentRequest(GptQueryReq req) {
AgentRequest request = new AgentRequest();
request.setRequestId(req.getTraceId());
request.setSessionId(req.getSessionId());
request.setErp(req.getUser());
request.setQuery(req.getQuery());
request.setAgentType(req.getDeepThink() == 0 ? 5: 3);
Expand Down
1 change: 1 addition & 0 deletions genie-backend/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ spring:
encoding: UTF-8
server:
port: 8080
ip: 127.0.0.1
logging:
level:
root: INFO
Expand Down
4 changes: 2 additions & 2 deletions genie-tool/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ dependencies = [
"fastapi>=0.115.14",
"greenlet>=3.2.3",
"json-repair>=0.47.6",
"litellm>=1.74.0.post1",
"litellm>=1.75.8",
"loguru>=0.7.3",
"matplotlib>=3.10.3",
"openai>=1.93.0",
"openai>=1.99.9",
"openpyxl>=3.1.5",
"pandas>=2.3.0",
"pydantic>=2.11.7",
Expand Down
3 changes: 3 additions & 0 deletions ui/src/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,7 @@ ol {

.lottie{
height: 80px !important;
}
code, kbd, samp, pre{
color:wheat !important;
}