mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-01-03 20:35:29 +08:00
【合并v3.8.2版本代码】 Merge remote-tracking branch 'origin/springboot3' into springboot3_sas
# Conflicts: # jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java # jeecg-boot/jeecg-module-system/jeecg-system-api/jeecg-system-cloud-api/src/main/java/org/jeecg/common/system/api/fallback/SysBaseAPIFallback.java # jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/SysRoleIndexController.java # jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/ThirdAppController.java # jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysBaseApiImpl.java # jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/banner.txt
This commit is contained in:
@ -836,7 +836,7 @@ public class AiragChatServiceImpl implements IAiragChatService {
|
||||
closeSSE(emitter, eventData);
|
||||
//update-end---author:chenrui ---date:20250425 for:[QQYUN-12203]AI 聊天,超时或者服务器报错,给个友好提示------------
|
||||
} else {
|
||||
errMsg = "调用大模型接口失败:" + errMsg;
|
||||
errMsg = "调用大模型接口失败,详情请查看后台日志。";
|
||||
EventData eventData = new EventData(requestId, null, EventData.EVENT_FLOW_ERROR, chatConversation.getId(), topicId);
|
||||
eventData.setData(EventFlowData.builder().success(false).message(errMsg).build());
|
||||
closeSSE(emitter, eventData);
|
||||
|
||||
@ -1,82 +1,82 @@
|
||||
package org.jeecg.modules.airag.test;
|
||||
|
||||
import dev.langchain4j.data.document.Document;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.tika.parser.AutoDetectParser;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.airag.llm.document.TikaDocumentParser;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.wildfly.common.Assert;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @Description: 文件解析测试
|
||||
* @Author: chenrui
|
||||
* @Date: 2025/2/11 16:11
|
||||
*/
|
||||
@Slf4j
|
||||
public class TestFileParse {
|
||||
|
||||
@Test
|
||||
public void testParseTxt() {
|
||||
readFile("test.txt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParsePdf() {
|
||||
readFile("test.pdf");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseMd() {
|
||||
readFile("test.md");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseDoc() {
|
||||
readFile("test.docx");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseDoc2003() {
|
||||
readFile("test.doc");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseExcel() {
|
||||
readFile("test.xlsx");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseExcel2003() {
|
||||
readFile("test.xls");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParsePPT() {
|
||||
readFile("test.pptx");
|
||||
}
|
||||
@Test
|
||||
public void testParsePPT2003() {
|
||||
readFile("test.ppt");
|
||||
}
|
||||
|
||||
private static void readFile(String filePath) {
|
||||
try {
|
||||
ClassPathResource resource = new ClassPathResource(filePath);
|
||||
File file = resource.getFile();
|
||||
TikaDocumentParser parser = new TikaDocumentParser(AutoDetectParser::new, null, null, null);
|
||||
Document document = parser.parse(file);
|
||||
Assert.assertNotNull(document);
|
||||
System.out.println(filePath + "----" + document.text());
|
||||
Assert.assertTrue(oConvertUtils.isNotEmpty(document));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//package org.jeecg.modules.airag.test;
|
||||
//
|
||||
//import dev.langchain4j.data.document.Document;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.apache.tika.parser.AutoDetectParser;
|
||||
//import org.jeecg.common.util.oConvertUtils;
|
||||
//import org.jeecg.modules.airag.llm.document.TikaDocumentParser;
|
||||
//import org.junit.jupiter.api.Test;
|
||||
//import org.springframework.core.io.ClassPathResource;
|
||||
//import org.wildfly.common.Assert;
|
||||
//
|
||||
//import java.io.File;
|
||||
//import java.io.IOException;
|
||||
//
|
||||
///**
|
||||
// * @Description: 文件解析测试
|
||||
// * @Author: chenrui
|
||||
// * @Date: 2025/2/11 16:11
|
||||
// */
|
||||
//@Slf4j
|
||||
//public class TestFileParse {
|
||||
//
|
||||
// @Test
|
||||
// public void testParseTxt() {
|
||||
// readFile("test.txt");
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testParsePdf() {
|
||||
// readFile("test.pdf");
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testParseMd() {
|
||||
// readFile("test.md");
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testParseDoc() {
|
||||
// readFile("test.docx");
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testParseDoc2003() {
|
||||
// readFile("test.doc");
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testParseExcel() {
|
||||
// readFile("test.xlsx");
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testParseExcel2003() {
|
||||
// readFile("test.xls");
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testParsePPT() {
|
||||
// readFile("test.pptx");
|
||||
// }
|
||||
// @Test
|
||||
// public void testParsePPT2003() {
|
||||
// readFile("test.ppt");
|
||||
// }
|
||||
//
|
||||
// private static void readFile(String filePath) {
|
||||
// try {
|
||||
// ClassPathResource resource = new ClassPathResource(filePath);
|
||||
// File file = resource.getFile();
|
||||
// TikaDocumentParser parser = new TikaDocumentParser(AutoDetectParser::new, null, null, null);
|
||||
// Document document = parser.parse(file);
|
||||
// Assert.assertNotNull(document);
|
||||
// System.out.println(filePath + "----" + document.text());
|
||||
// Assert.assertTrue(oConvertUtils.isNotEmpty(document));
|
||||
// } catch (IOException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
||||
@ -1,54 +1,54 @@
|
||||
package org.jeecg.modules.airag.test;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @Description: 流程测试
|
||||
* @Author: chenrui
|
||||
* @Date: 2025/2/11 16:11
|
||||
*/
|
||||
@Slf4j
|
||||
public class TestFlows {
|
||||
|
||||
@Test
|
||||
public void testRunFlow(){
|
||||
String id = "1889499701976358913";
|
||||
// String id = "1889571074002247682"; //switch
|
||||
// String id = "1889608218175463425"; //脚本
|
||||
String token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3Mzk1NDY0NDIsInVzZXJuYW1lIjoiamVlY2cifQ.CFIV79PUYmOAiqBKT3yjwihHWwf954DvS-4oKERmJVU";
|
||||
String request = request(id,token);
|
||||
System.out.println(request);
|
||||
}
|
||||
|
||||
private String request(String id,String token) {
|
||||
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("http://localhost:7008/airag/airagFlow/flow/run/" + id + "?field1=%25E5%2593%2588%25E5%2593%2588&field2=%25E4%25B8%25AD%25E5%259B%25BD")
|
||||
.get()
|
||||
.addHeader("X-Access-Token", token)
|
||||
.addHeader("Accept", "*/*")
|
||||
.addHeader("Accept-Encoding", "gzip, deflate, br")
|
||||
.addHeader("User-Agent", "PostmanRuntime-ApipostRuntime/1.1.0")
|
||||
.addHeader("Connection", "keep-alive")
|
||||
.addHeader("Cookie", "JSESSIONID=442C48D3D1D0B2878A597AB6EBF2A07E")
|
||||
.build();
|
||||
|
||||
try {
|
||||
Response response = client.newCall(request).execute();
|
||||
return response.body().string();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO author: chenrui for:完善用例,使用java方式调用 date:2025/2/14
|
||||
|
||||
}
|
||||
//package org.jeecg.modules.airag.test;
|
||||
//
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import okhttp3.OkHttpClient;
|
||||
//import okhttp3.Request;
|
||||
//import okhttp3.Response;
|
||||
//import org.junit.jupiter.api.Test;
|
||||
//
|
||||
//import java.io.IOException;
|
||||
//
|
||||
///**
|
||||
// * @Description: 流程测试
|
||||
// * @Author: chenrui
|
||||
// * @Date: 2025/2/11 16:11
|
||||
// */
|
||||
//@Slf4j
|
||||
//public class TestFlows {
|
||||
//
|
||||
// @Test
|
||||
// public void testRunFlow(){
|
||||
// String id = "1889499701976358913";
|
||||
//// String id = "1889571074002247682"; //switch
|
||||
//// String id = "1889608218175463425"; //脚本
|
||||
// String token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3Mzk1NDY0NDIsInVzZXJuYW1lIjoiamVlY2cifQ.CFIV79PUYmOAiqBKT3yjwihHWwf954DvS-4oKERmJVU";
|
||||
// String request = request(id,token);
|
||||
// System.out.println(request);
|
||||
// }
|
||||
//
|
||||
// private String request(String id,String token) {
|
||||
//
|
||||
// OkHttpClient client = new OkHttpClient();
|
||||
//
|
||||
// Request request = new Request.Builder()
|
||||
// .url("http://localhost:7008/airag/airagFlow/flow/run/" + id + "?field1=%25E5%2593%2588%25E5%2593%2588&field2=%25E4%25B8%25AD%25E5%259B%25BD")
|
||||
// .get()
|
||||
// .addHeader("X-Access-Token", token)
|
||||
// .addHeader("Accept", "*/*")
|
||||
// .addHeader("Accept-Encoding", "gzip, deflate, br")
|
||||
// .addHeader("User-Agent", "PostmanRuntime-ApipostRuntime/1.1.0")
|
||||
// .addHeader("Connection", "keep-alive")
|
||||
// .addHeader("Cookie", "JSESSIONID=442C48D3D1D0B2878A597AB6EBF2A07E")
|
||||
// .build();
|
||||
//
|
||||
// try {
|
||||
// Response response = client.newCall(request).execute();
|
||||
// return response.body().string();
|
||||
// } catch (IOException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // TODO author: chenrui for:完善用例,使用java方式调用 date:2025/2/14
|
||||
//
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user