|
|
|
@ -1,14 +1,18 @@
|
|
|
|
|
package com.supervision.demo;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.supervision.police.domain.ModelCase;
|
|
|
|
|
import com.supervision.police.service.ModelCaseService;
|
|
|
|
|
import com.supervision.police.vo.dify.DifyChatReqVO;
|
|
|
|
|
import com.supervision.utils.DifyApiUtil;
|
|
|
|
|
import com.supervision.utils.Document;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
@SpringBootTest
|
|
|
|
|
public class DifyTest {
|
|
|
|
|
@Autowired
|
|
|
|
@ -24,6 +28,22 @@ public class DifyTest {
|
|
|
|
|
difyApiUtil.deleteDataset("65c3a191-2433-4f79-9fd2-5c4dfaf4264d");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ModelCaseService modelCaseService;
|
|
|
|
|
@Test
|
|
|
|
|
public void removeCaseDataSet(){
|
|
|
|
|
List<ModelCase> list = modelCaseService.list();
|
|
|
|
|
for (ModelCase modelCase : list) {
|
|
|
|
|
String knowledgeBaseId = modelCase.getKnowledgeBaseId();
|
|
|
|
|
if (StrUtil.isEmpty(knowledgeBaseId)){
|
|
|
|
|
log.info("案件:{} 未创建知识库,不进行删除...",modelCase.getCaseName());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
log.info("案件:{} 开始删除知识库,知识库id:{}...",modelCase.getCaseName(),knowledgeBaseId);
|
|
|
|
|
difyApiUtil.deleteDataset(knowledgeBaseId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@Test
|
|
|
|
|
public void testCreateDocumentByFile() {
|
|
|
|
|
System.out.println(difyApiUtil.createDocumentByFile("d6c3e9fa-05a3-4d10-b482-d2797d7eee25", "1823953980884635650"));
|
|
|
|
|