refactor(knowledge): 优化接口结构,统一到一个路径下,为合并做准备
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
package com.lanyuanxiaoyao.service.ai.knowledge.controller;
|
package com.lanyuanxiaoyao.service.ai.knowledge.controller.knowledge;
|
||||||
|
|
||||||
import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisResponse;
|
import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisResponse;
|
||||||
import com.lanyuanxiaoyao.service.ai.knowledge.service.GroupService;
|
import com.lanyuanxiaoyao.service.ai.knowledge.service.knowledge.GroupService;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
* @version 20250528
|
* @version 20250528
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("group")
|
@RequestMapping("knowledge/group")
|
||||||
public class GroupController {
|
public class GroupController {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(GroupController.class);
|
private static final Logger logger = LoggerFactory.getLogger(GroupController.class);
|
||||||
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.lanyuanxiaoyao.service.ai.knowledge.controller;
|
package com.lanyuanxiaoyao.service.ai.knowledge.controller.knowledge;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisMapResponse;
|
import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisMapResponse;
|
||||||
import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisResponse;
|
import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisResponse;
|
||||||
import com.lanyuanxiaoyao.service.ai.knowledge.entity.vo.SegmentVO;
|
import com.lanyuanxiaoyao.service.ai.knowledge.entity.vo.SegmentVO;
|
||||||
import com.lanyuanxiaoyao.service.ai.knowledge.service.EmbeddingService;
|
import com.lanyuanxiaoyao.service.ai.knowledge.service.EmbeddingService;
|
||||||
import com.lanyuanxiaoyao.service.ai.knowledge.service.KnowledgeBaseService;
|
import com.lanyuanxiaoyao.service.ai.knowledge.service.knowledge.KnowledgeBaseService;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import org.eclipse.collections.api.factory.Lists;
|
import org.eclipse.collections.api.factory.Lists;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.lanyuanxiaoyao.service.ai.knowledge.controller;
|
package com.lanyuanxiaoyao.service.ai.knowledge.controller.knowledge;
|
||||||
|
|
||||||
import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisResponse;
|
import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisResponse;
|
||||||
import com.lanyuanxiaoyao.service.ai.knowledge.service.SegmentService;
|
import com.lanyuanxiaoyao.service.ai.knowledge.service.knowledge.SegmentService;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
* @version 20250528
|
* @version 20250528
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("segment")
|
@RequestMapping("knowledge/segment")
|
||||||
public class SegmentController {
|
public class SegmentController {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SegmentController.class);
|
private static final Logger logger = LoggerFactory.getLogger(SegmentController.class);
|
||||||
|
|
||||||
@@ -7,6 +7,8 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import com.lanyuanxiaoyao.service.ai.knowledge.entity.EmbeddingContext;
|
import com.lanyuanxiaoyao.service.ai.knowledge.entity.EmbeddingContext;
|
||||||
import com.lanyuanxiaoyao.service.ai.knowledge.entity.Knowledge;
|
import com.lanyuanxiaoyao.service.ai.knowledge.entity.Knowledge;
|
||||||
import com.lanyuanxiaoyao.service.ai.knowledge.entity.vo.DataFileVO;
|
import com.lanyuanxiaoyao.service.ai.knowledge.entity.vo.DataFileVO;
|
||||||
|
import com.lanyuanxiaoyao.service.ai.knowledge.service.knowledge.GroupService;
|
||||||
|
import com.lanyuanxiaoyao.service.ai.knowledge.service.knowledge.KnowledgeBaseService;
|
||||||
import com.yomahub.liteflow.core.FlowExecutor;
|
import com.yomahub.liteflow.core.FlowExecutor;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.lanyuanxiaoyao.service.ai.knowledge.service;
|
package com.lanyuanxiaoyao.service.ai.knowledge.service.knowledge;
|
||||||
|
|
||||||
import club.kingon.sql.builder.SqlBuilder;
|
import club.kingon.sql.builder.SqlBuilder;
|
||||||
import club.kingon.sql.builder.entry.Alias;
|
import club.kingon.sql.builder.entry.Alias;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.lanyuanxiaoyao.service.ai.knowledge.service;
|
package com.lanyuanxiaoyao.service.ai.knowledge.service.knowledge;
|
||||||
|
|
||||||
import club.kingon.sql.builder.SqlBuilder;
|
import club.kingon.sql.builder.SqlBuilder;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
@@ -15,7 +15,6 @@ import java.util.concurrent.ExecutionException;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import org.eclipse.collections.api.factory.Lists;
|
import org.eclipse.collections.api.factory.Lists;
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
import org.eclipse.collections.api.list.ImmutableList;
|
||||||
import org.noear.solon.ai.reranking.RerankingModel;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.ai.document.Document;
|
import org.springframework.ai.document.Document;
|
||||||
@@ -50,14 +49,12 @@ public class KnowledgeBaseService {
|
|||||||
private final EmbeddingModel model;
|
private final EmbeddingModel model;
|
||||||
private final QdrantClient client;
|
private final QdrantClient client;
|
||||||
private final GroupService groupService;
|
private final GroupService groupService;
|
||||||
private final RerankingModel rerankingModel;
|
|
||||||
|
|
||||||
public KnowledgeBaseService(JdbcTemplate template, EmbeddingModel model, VectorStore vectorStore, GroupService groupService, RerankingModel rerankingModel) {
|
public KnowledgeBaseService(JdbcTemplate template, EmbeddingModel model, VectorStore vectorStore, GroupService groupService) {
|
||||||
this.template = template;
|
this.template = template;
|
||||||
this.model = model;
|
this.model = model;
|
||||||
this.client = (QdrantClient) vectorStore.getNativeClient().orElseThrow();
|
this.client = (QdrantClient) vectorStore.getNativeClient().orElseThrow();
|
||||||
this.groupService = groupService;
|
this.groupService = groupService;
|
||||||
this.rerankingModel = rerankingModel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Knowledge get(Long id) {
|
public Knowledge get(Long id) {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.lanyuanxiaoyao.service.ai.knowledge.service;
|
package com.lanyuanxiaoyao.service.ai.knowledge.service.knowledge;
|
||||||
|
|
||||||
import com.lanyuanxiaoyao.service.ai.knowledge.entity.Knowledge;
|
import com.lanyuanxiaoyao.service.ai.knowledge.entity.Knowledge;
|
||||||
import com.lanyuanxiaoyao.service.ai.knowledge.entity.vo.SegmentVO;
|
import com.lanyuanxiaoyao.service.ai.knowledge.entity.vo.SegmentVO;
|
||||||
@@ -38,7 +38,7 @@ const DataDetail: React.FC = () => {
|
|||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
type: 'crud',
|
type: 'crud',
|
||||||
api: `${commonInfo.baseAiKnowledgeUrl}/group/list?knowledge_id=${knowledge_id}`,
|
api: `${commonInfo.baseAiKnowledgeUrl}/knowledge/group/list?knowledge_id=${knowledge_id}`,
|
||||||
...crudCommonOptions(),
|
...crudCommonOptions(),
|
||||||
headerToolbar: [
|
headerToolbar: [
|
||||||
'reload',
|
'reload',
|
||||||
@@ -146,7 +146,7 @@ const DataDetail: React.FC = () => {
|
|||||||
level: 'link',
|
level: 'link',
|
||||||
size: 'sm',
|
size: 'sm',
|
||||||
actionType: 'ajax',
|
actionType: 'ajax',
|
||||||
api: `get:${commonInfo.baseAiKnowledgeUrl}/group/delete?id=\${id}`,
|
api: `get:${commonInfo.baseAiKnowledgeUrl}/knowledge/group/delete?id=\${id}`,
|
||||||
confirmText: '确认删除',
|
confirmText: '确认删除',
|
||||||
confirmTitle: '删除',
|
confirmTitle: '删除',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ const DataDetail: React.FC = () => {
|
|||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
type: 'crud',
|
type: 'crud',
|
||||||
api: `${commonInfo.baseAiKnowledgeUrl}/segment/list?knowledge_id=${knowledge_id}&group_id=${group_id}`,
|
api: `${commonInfo.baseAiKnowledgeUrl}/knowledge/segment/list?knowledge_id=${knowledge_id}&group_id=${group_id}`,
|
||||||
...crudCommonOptions(),
|
...crudCommonOptions(),
|
||||||
headerToolbar: [
|
headerToolbar: [
|
||||||
'reload',
|
'reload',
|
||||||
|
|||||||
Reference in New Issue
Block a user