|
@@ -1,8 +1,11 @@
|
|
|
package cn.tycoding.langchat.core.tools;
|
|
|
|
|
|
import cn.tycoding.langchat.common.dto.DocR;
|
|
|
+import cn.tycoding.langchat.core.entity.AigcStructCol;
|
|
|
+import cn.tycoding.langchat.core.entity.AigcStructRow;
|
|
|
import cn.tycoding.langchat.core.service.AigcStructColService;
|
|
|
import cn.tycoding.langchat.core.service.AigcStructRowService;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import dev.langchain4j.agent.tool.Tool;
|
|
|
|
|
|
import java.util.List;
|
|
@@ -25,20 +28,22 @@ public class StructTools {
|
|
|
this.structRowService = structRowService;
|
|
|
}
|
|
|
|
|
|
- @Tool("Gets column name data in Excel")
|
|
|
+ @Tool("Gets column name data in Data")
|
|
|
List<String> getCols() {
|
|
|
- System.out.println("get col names ");
|
|
|
- return List.of("一级菜单", "二级菜单", "三级菜单");
|
|
|
+ List<AigcStructCol> list = structColService.list(Wrappers.<AigcStructCol>lambdaQuery()
|
|
|
+ .eq(AigcStructCol::getKnowledgeId, req.getKnowledgeId())
|
|
|
+ .eq(AigcStructCol::getDocsId, req.getDocsId())
|
|
|
+ );
|
|
|
+ return list.stream().map(AigcStructCol::getLabel).toList();
|
|
|
}
|
|
|
|
|
|
@Tool("Gets all the data for a column")
|
|
|
List<String> getColData(int col) {
|
|
|
- System.out.println("get col names " + col);
|
|
|
-
|
|
|
- if (col == 1) {
|
|
|
- return List.of("menu1", "menu2", "menu3");
|
|
|
- } else {
|
|
|
- return List.of("1.1", "2.1", "3.1");
|
|
|
- }
|
|
|
+ List<AigcStructRow> list = structRowService.list(Wrappers.<AigcStructRow>lambdaQuery()
|
|
|
+ .eq(AigcStructRow::getKnowledgeId, req.getKnowledgeId())
|
|
|
+ .eq(AigcStructRow::getDocsId, req.getDocsId())
|
|
|
+ .eq(AigcStructRow::getColIndex, col)
|
|
|
+ );
|
|
|
+ return list.stream().map(AigcStructRow::getValue).toList();
|
|
|
}
|
|
|
}
|