diff --git a/.gitignore b/.gitignore index 42eae94a..c121daee 100644 --- a/.gitignore +++ b/.gitignore @@ -202,4 +202,5 @@ cython_debug/ 江西城市生命线-可交互原型/frontend/node_modules/* THAI-Platform/* urbanLifelineWeb/packages/wechat_demo/* -urbanLifelineWeb/packages/workcase_wechat/unpackage/* \ No newline at end of file +urbanLifelineWeb/packages/workcase_wechat/unpackage/* +docs/AI训练资料 \ No newline at end of file diff --git a/difyPlugin/.vscode/launch.json b/difyPlugin/.vscode/launch.json new file mode 100644 index 00000000..3ef0a12c --- /dev/null +++ b/difyPlugin/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "DifyPlugin: FastAPI", + "type": "debugpy", + "request": "launch", + "program": "run.py", + "cwd": "${workspaceFolder}", + "python": "F:\\Environment\\conda\\envs\\difyPlugin\\python.exe", + "env": { + "PYTHONPATH": "${workspaceFolder}/difyPlugin" + }, + "jinja": true + } + ] +} \ No newline at end of file diff --git a/difyPlugin/.vscode/settings.json b/difyPlugin/.vscode/settings.json new file mode 100644 index 00000000..e69de29b diff --git a/urbanLifelineServ/.vscode/launch.json b/urbanLifelineServ/.vscode/launch.json index 2fee27d0..0fc9038e 100644 --- a/urbanLifelineServ/.vscode/launch.json +++ b/urbanLifelineServ/.vscode/launch.json @@ -1,20 +1,6 @@ { "version": "0.2.0", "configurations": [ - { - "type": "java", - "name": "URLQRCodeParseTest", - "request": "launch", - "mainClass": "org.xyzh.workcase.test.URLQRCodeParseTest", - "projectName": "workcase" - }, - { - "type": "java", - "name": "QRCodeTest", - "request": "launch", - "mainClass": "org.xyzh.workcase.test.QRCodeTest", - "projectName": "workcase" - }, { "type": "java", "name": "AesEncryptUtil", diff --git a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/client/DifyApiClient.java b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/client/DifyApiClient.java index bd5c419c..53c84a69 100644 --- a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/client/DifyApiClient.java +++ b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/client/DifyApiClient.java @@ -284,9 +284,8 @@ public class DifyApiClient { dataMap.put("process_rule", defaultProcessRule); } - // 默认设置文档形式和语言 - dataMap.put("doc_form", "text_model"); - dataMap.put("doc_language", "Chinese"); + // 只保留官方支持的参数 + // doc_form 和 doc_language 不是请求参数,移除 String dataJson = JSON.toJSONString(dataMap); logger.info("上传文档到知识库: datasetId={}, file={}, data={}", datasetId, originalFilename, dataJson); diff --git a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/service/impl/AgentChatServiceImpl.java b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/service/impl/AgentChatServiceImpl.java index 925fb3c9..2e0e3880 100644 --- a/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/service/impl/AgentChatServiceImpl.java +++ b/urbanLifelineServ/ai/src/main/java/org/xyzh/ai/service/impl/AgentChatServiceImpl.java @@ -300,6 +300,7 @@ public class AgentChatServiceImpl implements AgentChatService { sessionData.put("apiKey", agent.getApiKey()); sessionData.put("outer", agent.getIsOuter()); sessionData.put("service", prepareData.getService()); + sessionData.put("isGuest", "guest".equals(loginDomain.getUser().getStatus())); String cacheKey = CHAT_SESSION_PREFIX + sessionId; redisService.set(cacheKey, sessionData, SESSION_TTL, TimeUnit.SECONDS); @@ -335,6 +336,7 @@ public class AgentChatServiceImpl implements AgentChatService { String apiKey = (String) sessionData.get("apiKey"); String service = (String) sessionData.get("service"); Boolean outer = (Boolean) sessionData.get("outer"); + Boolean isGuest = (Boolean) sessionData.get("isGuest"); @SuppressWarnings("unchecked") List filesData = (List) sessionData.get("filesData"); @@ -375,7 +377,7 @@ public class AgentChatServiceImpl implements AgentChatService { if(outer && NonUtils.isNotEmpty(service)){ TbKnowledge filter = new TbKnowledge(); filter.setService(service); - filter.setCategory("external"); + filter.setCategory(isGuest?"external":"internal"); ResultDomain knowledgeRD = knowledgeService.listKnowledges(filter); List datasets = new ArrayList<>(); if(knowledgeRD.getSuccess()){ diff --git a/urbanLifelineServ/ai/src/main/resources/application-dev.yml b/urbanLifelineServ/ai/src/main/resources/application-dev.yml index da48f901..310d49ba 100644 --- a/urbanLifelineServ/ai/src/main/resources/application-dev.yml +++ b/urbanLifelineServ/ai/src/main/resources/application-dev.yml @@ -29,7 +29,12 @@ security: spring: application: name: ai-service - + # 文件上传配置 + servlet: + multipart: + enabled: true + max-file-size: 500MB + max-request-size: 500MB # ================== Spring Cloud Nacos ================== cloud: nacos: @@ -72,6 +77,7 @@ dubbo: name: urban-lifeline-agent qos-enable: false protocol: + payload: 110100480 name: dubbo port: -1 registry: diff --git a/urbanLifelineServ/ai/src/main/resources/application.yml b/urbanLifelineServ/ai/src/main/resources/application.yml index dc0f506e..35253da8 100644 --- a/urbanLifelineServ/ai/src/main/resources/application.yml +++ b/urbanLifelineServ/ai/src/main/resources/application.yml @@ -72,6 +72,7 @@ dubbo: name: urban-lifeline-agent qos-enable: false protocol: + payload: 110100480 name: dubbo port: -1 registry: diff --git a/urbanLifelineServ/file/src/main/resources/application.yml b/urbanLifelineServ/file/src/main/resources/application.yml index d6036770..0570b2ea 100644 --- a/urbanLifelineServ/file/src/main/resources/application.yml +++ b/urbanLifelineServ/file/src/main/resources/application.yml @@ -29,7 +29,6 @@ security: spring: application: name: file-service - # ================== Spring Cloud Nacos ================== cloud: nacos: @@ -57,8 +56,8 @@ spring: servlet: multipart: enabled: true - max-file-size: 100MB - max-request-size: 100MB + max-file-size: 500MB + max-request-size: 500MB # ================== SpringDoc ================== springdoc: @@ -79,6 +78,7 @@ dubbo: name: urban-lifeline-file qos-enable: false protocol: + payload: 110100480 name: dubbo port: -1 registry: diff --git a/urbanLifelineServ/workcase/src/main/resources/application-dev.yml b/urbanLifelineServ/workcase/src/main/resources/application-dev.yml index f10a3546..930a8654 100644 --- a/urbanLifelineServ/workcase/src/main/resources/application-dev.yml +++ b/urbanLifelineServ/workcase/src/main/resources/application-dev.yml @@ -32,7 +32,12 @@ security: spring: application: name: workcase-service - + # 文件上传配置 + servlet: + multipart: + enabled: true + max-file-size: 500MB + max-request-size: 500MB # ================== Spring Cloud Nacos ================== cloud: nacos: @@ -75,6 +80,7 @@ dubbo: name: urban-lifeline-workcase qos-enable: false protocol: + payload: 110100480 name: dubbo port: -1 registry: