update:格式调整

This commit is contained in:
rainv123
2025-11-05 09:13:44 +08:00
parent 0008ca6335
commit a82cf6e300
18 changed files with 733 additions and 1003 deletions
@@ -378,8 +378,9 @@ public class ConfigServiceImpl implements ConfigService {
boolean isCache) {
Map<String, String> selectedModule = new HashMap<>();
String[] modelTypes = { "VAD", "ASR", "TTS", "Memory", "Intent", "LLM", "VLLM","RAG" };
String[] modelIds = { vadModelId, asrModelId, ttsModelId, memModelId, intentModelId, llmModelId, vllmModelId, ragModelId };
String[] modelTypes = { "VAD", "ASR", "TTS", "Memory", "Intent", "LLM", "VLLM", "RAG" };
String[] modelIds = { vadModelId, asrModelId, ttsModelId, memModelId, intentModelId, llmModelId, vllmModelId,
ragModelId };
String intentLLMModelId = null;
String memLocalShortLLMModelId = null;
@@ -25,7 +25,6 @@ import xiaozhi.modules.knowledge.dto.KnowledgeBaseDTO;
import xiaozhi.modules.knowledge.service.KnowledgeBaseService;
import java.util.Map;
@AllArgsConstructor
@RestController
@RequestMapping("/api/v1")
@@ -47,7 +46,8 @@ public class KnowledgeBaseController {
KnowledgeBaseDTO knowledgeBaseDTO = new KnowledgeBaseDTO();
knowledgeBaseDTO.setName(name);
knowledgeBaseDTO.setDatasetId(id);
PageData<KnowledgeBaseDTO> pageData = knowledgeBaseService.getPageList(knowledgeBaseDTO, String.valueOf(page), String.valueOf(page_size));
PageData<KnowledgeBaseDTO> pageData = knowledgeBaseService.getPageList(knowledgeBaseDTO, String.valueOf(page),
String.valueOf(page_size));
return new Result<PageData<KnowledgeBaseDTO>>().ok(pageData);
}
@@ -114,7 +114,8 @@ public class KnowledgeFilesController {
List<String> importantKeywords = (List<String>) requestBody.get("important_keywords");
List<String> questions = (List<String>) requestBody.get("questions");
Map<String, Object> result = knowledgeFilesService.addChunk(datasetId, documentId, content, importantKeywords, questions);
Map<String, Object> result = knowledgeFilesService.addChunk(datasetId, documentId, content, importantKeywords,
questions);
return new Result<Map<String, Object>>().ok(result);
}
@@ -127,7 +128,8 @@ public class KnowledgeFilesController {
@RequestParam(required = false, defaultValue = "1") Integer page,
@RequestParam(required = false, defaultValue = "1024") Integer page_size,
@RequestParam(required = false) String id) {
Map<String, Object> result = knowledgeFilesService.listChunks(datasetId, documentId, keywords, page, page_size, id);
Map<String, Object> result = knowledgeFilesService.listChunks(datasetId, documentId, keywords, page, page_size,
id);
return new Result<Map<String, Object>>().ok(result);
}
@@ -166,8 +168,7 @@ public class KnowledgeFilesController {
Map<String, Object> result = knowledgeFilesService.retrievalTest(
question, datasetIds, documentIds, page, pageSize, similarityThreshold,
vectorSimilarityWeight, topK, rerankId, keyword, highlight, crossLanguages, metadataCondition
);
vectorSimilarityWeight, topK, rerankId, keyword, highlight, crossLanguages, metadataCondition);
return new Result<Map<String, Object>>().ok(result);
} catch (Exception e) {
@@ -181,7 +182,8 @@ public class KnowledgeFilesController {
private Map<String, Object> parseJsonMap(String jsonString) {
try {
ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.readValue(jsonString, new TypeReference<Map<String, Object>>() {});
return objectMapper.readValue(jsonString, new TypeReference<Map<String, Object>>() {
});
} catch (Exception e) {
throw new RuntimeException("解析JSON字符串失败: " + jsonString, e);
}
@@ -55,7 +55,6 @@ public interface KnowledgeFilesService {
*/
void deleteByDocumentId(String documentId, String datasetId);
/**
* 获取RAG配置信息
*
@@ -37,15 +37,14 @@ import xiaozhi.modules.model.service.ModelConfigService;
@Service
@AllArgsConstructor
@Slf4j
public class KnowledgeBaseServiceImpl extends BaseServiceImpl<KnowledgeBaseDao, KnowledgeBaseEntity> implements KnowledgeBaseService {
public class KnowledgeBaseServiceImpl extends BaseServiceImpl<KnowledgeBaseDao, KnowledgeBaseEntity>
implements KnowledgeBaseService {
private final KnowledgeBaseDao knowledgeBaseDao;
private final ModelConfigService modelConfigService;
private final ModelConfigDao modelConfigDao;
private RestTemplate restTemplate = new RestTemplate();
@Override
public PageData<KnowledgeBaseDTO> getPageList(KnowledgeBaseDTO knowledgeBaseDTO, String page, String limit) {
long curPage = Long.parseLong(page);
@@ -72,7 +71,8 @@ public class KnowledgeBaseServiceImpl extends BaseServiceImpl<KnowledgeBaseDao,
if (pageData != null && pageData.getList() != null) {
for (KnowledgeBaseDTO knowledgeBase : pageData.getList()) {
try {
Integer documentCount = getDocumentCountFromRAGFlow(knowledgeBase.getDatasetId(), knowledgeBase.getRagModelId());
Integer documentCount = getDocumentCountFromRAGFlow(knowledgeBase.getDatasetId(),
knowledgeBase.getRagModelId());
knowledgeBase.setDocumentCount(documentCount);
} catch (Exception e) {
log.warn("获取知识库 {} 的文档数量失败: {}", knowledgeBase.getDatasetId(), e.getMessage());
@@ -111,8 +111,7 @@ public class KnowledgeBaseServiceImpl extends BaseServiceImpl<KnowledgeBaseDao,
datasetId = createDatasetInRAGFlow(
knowledgeBaseDTO.getName(),
knowledgeBaseDTO.getDescription(),
ragConfig
);
ragConfig);
} catch (Exception e) {
// 如果RAG API调用失败,直接抛出异常,无需回滚(因为还没有插入本地数据库)
throw e;
@@ -120,8 +119,7 @@ public class KnowledgeBaseServiceImpl extends BaseServiceImpl<KnowledgeBaseDao,
// 验证数据集ID是否已存在
KnowledgeBaseEntity existingEntity = knowledgeBaseDao.selectOne(
new QueryWrapper<KnowledgeBaseEntity>().eq("dataset_id", datasetId)
);
new QueryWrapper<KnowledgeBaseEntity>().eq("dataset_id", datasetId));
if (existingEntity != null) {
// 如果datasetId已存在,删除RAGFlow中的数据集并抛出异常
try {
@@ -158,8 +156,7 @@ public class KnowledgeBaseServiceImpl extends BaseServiceImpl<KnowledgeBaseDao,
KnowledgeBaseEntity conflictEntity = knowledgeBaseDao.selectOne(
new QueryWrapper<KnowledgeBaseEntity>()
.eq("dataset_id", knowledgeBaseDTO.getDatasetId())
.ne("id", knowledgeBaseDTO.getId())
);
.ne("id", knowledgeBaseDTO.getId()));
if (conflictEntity != null) {
throw new RenException(ErrorCode.DB_RECORD_EXISTS);
}
@@ -176,8 +173,7 @@ public class KnowledgeBaseServiceImpl extends BaseServiceImpl<KnowledgeBaseDao,
knowledgeBaseDTO.getDatasetId(),
knowledgeBaseDTO.getName(),
knowledgeBaseDTO.getDescription(),
ragConfig
);
ragConfig);
} catch (Exception e) {
// 如果RAG API调用失败,回滚本地数据库操作
knowledgeBaseDao.updateById(existingEntity);
@@ -240,8 +236,7 @@ public class KnowledgeBaseServiceImpl extends BaseServiceImpl<KnowledgeBaseDao,
}
KnowledgeBaseEntity entity = knowledgeBaseDao.selectOne(
new QueryWrapper<KnowledgeBaseEntity>().eq("dataset_id", datasetId)
);
new QueryWrapper<KnowledgeBaseEntity>().eq("dataset_id", datasetId));
if (entity == null) {
throw new RenException(ErrorCode.Knowledge_Base_RECORD_NOT_EXISTS);
@@ -260,8 +255,7 @@ public class KnowledgeBaseServiceImpl extends BaseServiceImpl<KnowledgeBaseDao,
log.info("删除datasetId: {}", datasetId);
KnowledgeBaseEntity entity = knowledgeBaseDao.selectOne(
new QueryWrapper<KnowledgeBaseEntity>().eq("dataset_id", datasetId)
);
new QueryWrapper<KnowledgeBaseEntity>().eq("dataset_id", datasetId));
if (entity == null) {
log.warn("记录不存在,datasetId: {}", datasetId);
@@ -454,11 +448,13 @@ public class KnowledgeBaseServiceImpl extends BaseServiceImpl<KnowledgeBaseDao,
} catch (HttpClientErrorException e) {
log.error("RAGFlow API调用失败 - HTTP错误: {}, 状态码: {}, 响应内容: {}",
e.getMessage(), e.getStatusCode(), e.getResponseBodyAsString(), e);
throw new RenException(ErrorCode.RAG_API_CREATE_FAILED, "创建RAGFlow数据集失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
throw new RenException(ErrorCode.RAG_API_CREATE_FAILED,
"创建RAGFlow数据集失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
} catch (HttpServerErrorException e) {
log.error("RAGFlow API调用失败 - 服务器错误: {}, 状态码: {}, 响应内容: {}",
e.getMessage(), e.getStatusCode(), e.getResponseBodyAsString(), e);
throw new RenException(ErrorCode.RAG_API_CREATE_FAILED, "创建RAGFlow数据集失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
throw new RenException(ErrorCode.RAG_API_CREATE_FAILED,
"创建RAGFlow数据集失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
} catch (ResourceAccessException e) {
log.error("RAGFlow API调用失败 - 网络连接错误: {}", e.getMessage(), e);
throw new RenException(ErrorCode.RAG_API_CREATE_FAILED, "创建RAGFlow数据集失败: 网络连接错误 - " + e.getMessage());
@@ -472,7 +468,8 @@ public class KnowledgeBaseServiceImpl extends BaseServiceImpl<KnowledgeBaseDao,
/**
* 调用RAGFlow API更新数据集
*/
private void updateDatasetInRAGFlow(String datasetId, String name, String description, Map<String, Object> ragConfig) {
private void updateDatasetInRAGFlow(String datasetId, String name, String description,
Map<String, Object> ragConfig) {
try {
String baseUrl = (String) ragConfig.get("base_url");
String apiKey = (String) ragConfig.get("api_key");
@@ -517,11 +514,13 @@ public class KnowledgeBaseServiceImpl extends BaseServiceImpl<KnowledgeBaseDao,
} catch (HttpClientErrorException e) {
log.error("RAGFlow API调用失败 - HTTP错误: {}, 状态码: {}, 响应内容: {}",
e.getMessage(), e.getStatusCode(), e.getResponseBodyAsString(), e);
throw new RenException(ErrorCode.RAG_API_UPDATE_FAILED, "更新RAGFlow数据集失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
throw new RenException(ErrorCode.RAG_API_UPDATE_FAILED,
"更新RAGFlow数据集失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
} catch (HttpServerErrorException e) {
log.error("RAGFlow API调用失败 - 服务器错误: {}, 状态码: {}, 响应内容: {}",
e.getMessage(), e.getStatusCode(), e.getResponseBodyAsString(), e);
throw new RenException(ErrorCode.RAG_API_UPDATE_FAILED, "更新RAGFlow数据集失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
throw new RenException(ErrorCode.RAG_API_UPDATE_FAILED,
"更新RAGFlow数据集失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
} catch (ResourceAccessException e) {
log.error("RAGFlow API调用失败 - 网络连接错误: {}", e.getMessage(), e);
throw new RenException(ErrorCode.RAG_API_UPDATE_FAILED, "更新RAGFlow数据集失败: 网络连接错误 - " + e.getMessage());
@@ -560,7 +559,8 @@ public class KnowledgeBaseServiceImpl extends BaseServiceImpl<KnowledgeBaseDao,
// 发送DELETE请求
log.info("发送DELETE请求到RAGFlow API...");
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.DELETE, requestEntity, String.class);
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.DELETE, requestEntity,
String.class);
log.info("RAGFlow API响应状态码: {}", response.getStatusCode());
log.debug("RAGFlow API响应内容: {}", response.getBody());
@@ -575,11 +575,13 @@ public class KnowledgeBaseServiceImpl extends BaseServiceImpl<KnowledgeBaseDao,
} catch (HttpClientErrorException e) {
log.error("RAGFlow API调用失败 - HTTP错误: {}, 状态码: {}, 响应内容: {}",
e.getMessage(), e.getStatusCode(), e.getResponseBodyAsString(), e);
throw new RenException(ErrorCode.RAG_API_DELETE_FAILED, "删除RAGFlow数据集失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
throw new RenException(ErrorCode.RAG_API_DELETE_FAILED,
"删除RAGFlow数据集失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
} catch (HttpServerErrorException e) {
log.error("RAGFlow API调用失败 - 服务器错误: {}, 状态码: {}, 响应内容: {}",
e.getMessage(), e.getStatusCode(), e.getResponseBodyAsString(), e);
throw new RenException(ErrorCode.RAG_API_DELETE_FAILED, "删除RAGFlow数据集失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
throw new RenException(ErrorCode.RAG_API_DELETE_FAILED,
"删除RAGFlow数据集失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
} catch (ResourceAccessException e) {
log.error("RAGFlow API调用失败 - 网络连接错误: {}", e.getMessage(), e);
throw new RenException(ErrorCode.RAG_API_DELETE_FAILED, "删除RAGFlow数据集失败: 网络连接错误 - " + e.getMessage());
@@ -683,7 +685,4 @@ public class KnowledgeBaseServiceImpl extends BaseServiceImpl<KnowledgeBaseDao,
return 0;
}
}
@@ -157,7 +157,7 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
Object documentsObj = null;
// 支持多种可能的文档列表字段名
String[] possibleDocumentFields = {"docs", "documents", "items", "list", "data"};
String[] possibleDocumentFields = { "docs", "documents", "items", "list", "data" };
for (String fieldName : possibleDocumentFields) {
if (dataMap.containsKey(fieldName) && dataMap.get(fieldName) instanceof List) {
@@ -194,7 +194,7 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
// 解析总数 - 支持多种可能的字段名
Object totalObj = null;
String[] possibleTotalFields = {"total", "totalCount", "total_count", "count"};
String[] possibleTotalFields = { "total", "totalCount", "total_count", "count" };
for (String fieldName : possibleTotalFields) {
if (dataMap.containsKey(fieldName)) {
@@ -234,7 +234,8 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
*/
private KnowledgeFilesDTO convertRAGDocumentToDTO(Map<String, Object> docMap) {
try {
if (docMap == null) return null;
if (docMap == null)
return null;
KnowledgeFilesDTO dto = new KnowledgeFilesDTO();
@@ -275,7 +276,8 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
dto.setMetaFields((Map<String, Object>) metaFieldsObj);
}
Object parserConfigObj = getValueFromMultipleKeys(docMap, "parser_config", "parser", "parse_config", "config");
Object parserConfigObj = getValueFromMultipleKeys(docMap, "parser_config", "parser", "parse_config",
"config");
if (parserConfigObj instanceof Map) {
dto.setParserConfig((Map<String, Object>) parserConfigObj);
}
@@ -283,7 +285,8 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
dto.setChunkMethod(getStringValueFromMultipleKeys(docMap, "chunk_method", "chunking", "chunk_strategy"));
// 设置时间信息 - 支持多种可能的字段名
Object createTimeObj = getValueFromMultipleKeys(docMap, "create_time", "created_at", "creation_time", "created");
Object createTimeObj = getValueFromMultipleKeys(docMap, "create_time", "created_at", "creation_time",
"created");
if (createTimeObj instanceof Long) {
dto.setCreatedAt(new Date((Long) createTimeObj));
} else if (createTimeObj instanceof String) {
@@ -296,7 +299,8 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
}
}
Object updateTimeObj = getValueFromMultipleKeys(docMap, "update_time", "updated_at", "modified_time", "modified");
Object updateTimeObj = getValueFromMultipleKeys(docMap, "update_time", "updated_at", "modified_time",
"modified");
if (updateTimeObj instanceof Long) {
dto.setUpdatedAt(new Date((Long) updateTimeObj));
} else if (updateTimeObj instanceof String) {
@@ -319,7 +323,8 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
* 转换RAGFlow状态到本地状态
*/
private Integer convertRAGStatusToLocal(String ragStatus) {
if (ragStatus == null) return 0;
if (ragStatus == null)
return 0;
switch (ragStatus.toLowerCase()) {
case "pending":
@@ -509,7 +514,6 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
}
}
@Override
public void deleteByDocumentId(String documentId, String datasetId) {
if (StringUtils.isBlank(documentId) || StringUtils.isBlank(datasetId)) {
@@ -549,10 +553,10 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
String extension = fileName.substring(lastDotIndex + 1).toLowerCase();
// 支持RAGFlow四种文档格式类型
String[] documentTypes = {"pdf", "doc", "docx", "txt", "md", "mdx"};
String[] spreadsheetTypes = {"csv", "xls", "xlsx"};
String[] imageTypes = {"jpeg", "jpg", "png", "tif", "gif"};
String[] presentationTypes = {"ppt", "pptx"};
String[] documentTypes = { "pdf", "doc", "docx", "txt", "md", "mdx" };
String[] spreadsheetTypes = { "csv", "xls", "xlsx" };
String[] imageTypes = { "jpeg", "jpg", "png", "tif", "gif" };
String[] presentationTypes = { "ppt", "pptx" };
// 检查文档类型
for (String type : documentTypes) {
@@ -781,11 +785,13 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
} catch (HttpClientErrorException e) {
log.error("RAGFlow API调用失败 - HTTP错误: {}, 状态码: {}, 响应内容: {}",
e.getMessage(), e.getStatusCode(), e.getResponseBodyAsString(), e);
throw new RenException(ErrorCode.RAG_API_CREATE_FAILED, "上传RAGFlow文档失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
throw new RenException(ErrorCode.RAG_API_CREATE_FAILED,
"上传RAGFlow文档失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
} catch (HttpServerErrorException e) {
log.error("RAGFlow API调用失败 - 服务器错误: {}, 状态码: {}, 响应内容: {}",
e.getMessage(), e.getStatusCode(), e.getResponseBodyAsString(), e);
throw new RenException(ErrorCode.RAG_API_CREATE_FAILED, "上传RAGFlow文档失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
throw new RenException(ErrorCode.RAG_API_CREATE_FAILED,
"上传RAGFlow文档失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
} catch (ResourceAccessException e) {
log.error("RAGFlow API调用失败 - 网络连接错误: {}", e.getMessage(), e);
throw new RenException(ErrorCode.RAG_API_CREATE_FAILED, "上传RAGFlow文档失败: 网络连接错误 - " + e.getMessage());
@@ -821,10 +827,11 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
* 从Map中提取documentId,支持多种可能的字段名
*/
private String extractDocumentIdFromMap(Map<String, Object> map) {
if (map == null) return null;
if (map == null)
return null;
// 尝试多种可能的字段名
String[] possibleFieldNames = {"id", "document_id", "documentId", "doc_id", "documentId"};
String[] possibleFieldNames = { "id", "document_id", "documentId", "doc_id", "documentId" };
for (String fieldName : possibleFieldNames) {
Object value = map.get(fieldName);
@@ -840,10 +847,11 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
* 从根级别响应中提取documentId
*/
private String extractDocumentIdFromRoot(Map<String, Object> responseMap) {
if (responseMap == null) return null;
if (responseMap == null)
return null;
// 尝试从根级别提取
String[] possibleFieldNames = {"id", "document_id", "documentId", "doc_id", "documentId"};
String[] possibleFieldNames = { "id", "document_id", "documentId", "doc_id", "documentId" };
for (String fieldName : possibleFieldNames) {
Object value = responseMap.get(fieldName);
@@ -916,11 +924,13 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
} catch (HttpClientErrorException e) {
log.error("RAGFlow API调用失败 - HTTP错误: {}, 状态码: {}, 响应内容: {}",
e.getMessage(), e.getStatusCode(), e.getResponseBodyAsString(), e);
throw new RenException(ErrorCode.RAG_API_UPDATE_FAILED, "更新RAGFlow文档配置失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
throw new RenException(ErrorCode.RAG_API_UPDATE_FAILED,
"更新RAGFlow文档配置失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
} catch (HttpServerErrorException e) {
log.error("RAGFlow API调用失败 - 服务器错误: {}, 状态码: {}, 响应内容: {}",
e.getMessage(), e.getStatusCode(), e.getResponseBodyAsString(), e);
throw new RenException(ErrorCode.RAG_API_UPDATE_FAILED, "更新RAGFlow文档配置失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
throw new RenException(ErrorCode.RAG_API_UPDATE_FAILED,
"更新RAGFlow文档配置失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
} catch (ResourceAccessException e) {
log.error("RAGFlow API调用失败 - 网络连接错误: {}", e.getMessage(), e);
throw new RenException(ErrorCode.RAG_API_UPDATE_FAILED, "更新RAGFlow文档配置失败: 网络连接错误 - " + e.getMessage());
@@ -961,7 +971,8 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
// 发送DELETE请求
log.info("发送DELETE请求到RAGFlow API...");
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.DELETE, requestEntity, String.class);
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.DELETE, requestEntity,
String.class);
log.info("RAGFlow API响应状态码: {}", response.getStatusCode());
log.debug("RAGFlow API响应内容: {}", response.getBody());
@@ -1000,11 +1011,13 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
} catch (HttpClientErrorException e) {
log.error("RAGFlow API调用失败 - HTTP错误: {}, 状态码: {}, 响应内容: {}",
e.getMessage(), e.getStatusCode(), e.getResponseBodyAsString(), e);
throw new RenException(ErrorCode.RAG_API_DELETE_FAILED, "删除RAGFlow文档失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
throw new RenException(ErrorCode.RAG_API_DELETE_FAILED,
"删除RAGFlow文档失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
} catch (HttpServerErrorException e) {
log.error("RAGFlow API调用失败 - 服务器错误: {}, 状态码: {}, 响应内容: {}",
e.getMessage(), e.getStatusCode(), e.getResponseBodyAsString(), e);
throw new RenException(ErrorCode.RAG_API_DELETE_FAILED, "删除RAGFlow文档失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
throw new RenException(ErrorCode.RAG_API_DELETE_FAILED,
"删除RAGFlow文档失败: " + e.getMessage() + ", 响应: " + e.getResponseBodyAsString());
} catch (ResourceAccessException e) {
log.error("RAGFlow API调用失败 - 网络连接错误: {}", e.getMessage(), e);
throw new RenException(ErrorCode.RAG_API_DELETE_FAILED, "删除RAGFlow文档失败: 网络连接错误 - " + e.getMessage());
@@ -1346,7 +1359,7 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
Object chunksObj = null;
// 支持多种可能的切片列表字段名
String[] possibleChunkFields = {"chunks", "items", "list", "data", "docs"};
String[] possibleChunkFields = { "chunks", "items", "list", "data", "docs" };
for (String fieldName : possibleChunkFields) {
if (dataMap.containsKey(fieldName) && dataMap.get(fieldName) instanceof List) {
@@ -1383,7 +1396,7 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
// 解析总数 - 支持多种可能的字段名
Object totalObj = null;
String[] possibleTotalFields = {"total", "totalCount", "total_count", "count"};
String[] possibleTotalFields = { "total", "totalCount", "total_count", "count" };
for (String fieldName : possibleTotalFields) {
if (dataMap.containsKey(fieldName)) {
@@ -1414,7 +1427,7 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
// 如果没有data字段,尝试直接解析响应
Object chunksObj = null;
String[] possibleChunkFields = {"chunks", "items", "list", "data", "docs"};
String[] possibleChunkFields = { "chunks", "items", "list", "data", "docs" };
for (String fieldName : possibleChunkFields) {
if (responseMap.containsKey(fieldName) && responseMap.get(fieldName) instanceof List) {
@@ -1506,7 +1519,7 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
* 提取切片ID
*/
private String extractChunkId(Map<String, Object> chunkMap) {
String[] possibleIdFields = {"id", "chunk_id", "chunkId", "chunkId"};
String[] possibleIdFields = { "id", "chunk_id", "chunkId", "chunkId" };
for (String fieldName : possibleIdFields) {
Object value = chunkMap.get(fieldName);
@@ -1522,7 +1535,7 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
* 提取切片内容
*/
private String extractChunkContent(Map<String, Object> chunkMap) {
String[] possibleContentFields = {"content", "text", "chunk_content", "chunkContent"};
String[] possibleContentFields = { "content", "text", "chunk_content", "chunkContent" };
for (String fieldName : possibleContentFields) {
Object value = chunkMap.get(fieldName);
@@ -1538,7 +1551,7 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
* 提取重要关键词
*/
private List<String> extractImportantKeywords(Map<String, Object> chunkMap) {
String[] possibleKeywordFields = {"important_keywords", "keywords", "importantKeywords", "key_words"};
String[] possibleKeywordFields = { "important_keywords", "keywords", "importantKeywords", "key_words" };
for (String fieldName : possibleKeywordFields) {
Object value = chunkMap.get(fieldName);
@@ -1572,7 +1585,7 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
* 提取问题列表
*/
private List<String> extractQuestions(Map<String, Object> chunkMap) {
String[] possibleQuestionFields = {"questions", "question_list", "questionList", "qas"};
String[] possibleQuestionFields = { "questions", "question_list", "questionList", "qas" };
for (String fieldName : possibleQuestionFields) {
Object value = chunkMap.get(fieldName);
@@ -1606,7 +1619,7 @@ public class KnowledgeFilesServiceImpl implements KnowledgeFilesService {
* 提取创建时间
*/
private String extractCreateTime(Map<String, Object> chunkMap) {
String[] possibleTimeFields = {"create_time", "created_at", "createTime", "timestamp"};
String[] possibleTimeFields = { "create_time", "created_at", "createTime", "timestamp" };
for (String fieldName : possibleTimeFields) {
Object value = chunkMap.get(fieldName);
+151 -252
View File
@@ -8,6 +8,54 @@ function getAuthToken() {
return localStorage.getItem('token') || '';
}
/**
* 通用API请求包装器
* @param {Object} config - 请求配置
* @param {string} config.url - 请求URL
* @param {string} config.method - 请求方法
* @param {Object} [config.data] - 请求数据
* @param {Object} [config.headers] - 额外请求头
* @param {Function} config.callback - 成功回调
* @param {Function} [config.errorCallback] - 错误回调
* @param {string} [config.errorMessage] - 错误消息
* @param {Function} [config.retryFunction] - 重试函数
*/
function makeApiRequest(config) {
const token = getAuthToken();
const { url, method, data, headers, callback, errorCallback, errorMessage, retryFunction } = config;
const requestBuilder = RequestService.sendRequest()
.url(url)
.method(method)
.header({
'Authorization': `Bearer ${token}`,
...headers
});
if (data) {
requestBuilder.data(data);
}
requestBuilder
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.fail((err) => {
console.error(errorMessage || '操作失败', err);
if (errorCallback) {
errorCallback(err);
}
})
.networkFail(() => {
if (retryFunction) {
RequestService.reAjaxFun(() => {
retryFunction();
});
}
}).send();
}
/**
* 知识库管理相关API
*/
@@ -19,33 +67,20 @@ export default {
* @param {Function} errorCallback - 错误回调
*/
getKnowledgeBaseList(params, callback, errorCallback) {
const token = getAuthToken();
const queryParams = new URLSearchParams({
page: params.page,
page_size: params.page_size,
name: params.name || ''
}).toString();
RequestService.sendRequest()
.url(`${getServiceUrl()}/api/v1/datasets?${queryParams}`)
.method('GET')
.header({ 'Authorization': `Bearer ${token}` })
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.fail((err) => {
console.error('获取知识库列表失败:', err);
if (errorCallback) {
errorCallback(err);
}
})
.networkFail(() => {
const self = this;
RequestService.reAjaxFun(() => {
self.getKnowledgeBaseList(params, callback, errorCallback);
makeApiRequest({
url: `${getServiceUrl()}/api/v1/datasets?${queryParams}`,
method: 'GET',
callback: callback,
errorCallback: errorCallback,
errorMessage: '获取知识库列表失败',
retryFunction: () => this.getKnowledgeBaseList(params, callback, errorCallback)
});
}).send();
},
/**
@@ -56,20 +91,18 @@ export default {
*/
createKnowledgeBase(data, callback, errorCallback) {
console.log('createKnowledgeBase called with data:', data);
const token = getAuthToken();
console.log('Token exists:', !!token);
console.log('API URL:', `${getServiceUrl()}/api/v1/datasets`);
RequestService.sendRequest()
.url(`${getServiceUrl()}/api/v1/datasets`)
.method('POST')
.data(data)
.header({ 'Authorization': `Bearer ${token}` })
.success((res) => {
makeApiRequest({
url: `${getServiceUrl()}/api/v1/datasets`,
method: 'POST',
data: data,
headers: { 'Content-Type': 'application/json' },
callback: (res) => {
console.log('createKnowledgeBase success response:', res);
RequestService.clearRequestTime();
callback(res);
})
.fail((err) => {
},
errorCallback: (err) => {
console.error('创建知识库失败:', err);
if (err.response) {
console.error('Error response data:', err.response.data);
@@ -78,14 +111,10 @@ export default {
if (errorCallback) {
errorCallback(err);
}
})
.networkFail(() => {
console.log('Network failure, retrying...');
const self = this;
RequestService.reAjaxFun(() => {
self.createKnowledgeBase(data, callback, errorCallback);
},
errorMessage: '创建知识库失败',
retryFunction: () => this.createKnowledgeBase(data, callback, errorCallback)
});
}).send();
},
/**
@@ -97,30 +126,18 @@ export default {
*/
updateKnowledgeBase(datasetId, data, callback, errorCallback) {
console.log('updateKnowledgeBase called with datasetId:', datasetId, 'data:', data);
const token = getAuthToken();
console.log('Token exists:', !!token);
console.log('API URL:', `${getServiceUrl()}/api/v1/datasets/${datasetId}`);
RequestService.sendRequest()
.url(`${getServiceUrl()}/api/v1/datasets/${datasetId}`)
.method('PUT')
.data(data)
.header({ 'Authorization': `Bearer ${token}` })
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.fail((err) => {
console.error('更新知识库失败:', err);
if (errorCallback) {
errorCallback(err);
}
})
.networkFail(() => {
const self = this;
RequestService.reAjaxFun(() => {
self.updateKnowledgeBase(datasetId, data, callback, errorCallback);
makeApiRequest({
url: `${getServiceUrl()}/api/v1/datasets/${datasetId}`,
method: 'PUT',
data: data,
headers: { 'Content-Type': 'application/json' },
callback: callback,
errorCallback: errorCallback,
errorMessage: '更新知识库失败',
retryFunction: () => this.updateKnowledgeBase(datasetId, data, callback, errorCallback)
});
}).send();
},
/**
@@ -131,29 +148,16 @@ export default {
*/
deleteKnowledgeBase(datasetId, callback, errorCallback) {
console.log('deleteKnowledgeBase called with datasetId:', datasetId);
const token = getAuthToken();
console.log('Token exists:', !!token);
console.log('API URL:', `${getServiceUrl()}/api/v1/datasets/${datasetId}`);
RequestService.sendRequest()
.url(`${getServiceUrl()}/api/v1/datasets/${datasetId}`)
.method('DELETE')
.header({ 'Authorization': `Bearer ${token}` })
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.fail((err) => {
console.error('删除知识库失败:', err);
if (errorCallback) {
errorCallback(err);
}
})
.networkFail(() => {
const self = this;
RequestService.reAjaxFun(() => {
self.deleteKnowledgeBase(datasetId, callback, errorCallback);
makeApiRequest({
url: `${getServiceUrl()}/api/v1/datasets/${datasetId}`,
method: 'DELETE',
callback: callback,
errorCallback: errorCallback,
errorMessage: '删除知识库失败',
retryFunction: () => this.deleteKnowledgeBase(datasetId, callback, errorCallback)
});
}).send();
},
/**
@@ -163,29 +167,17 @@ export default {
* @param {Function} errorCallback - 错误回调
*/
deleteKnowledgeBases(ids, callback, errorCallback) {
const token = getAuthToken();
// 确保ids是正确格式的字符串
const idsStr = Array.isArray(ids) ? ids.join(',') : ids;
RequestService.sendRequest()
.url(`${getServiceUrl()}/api/v1/datasets/batch?ids=${idsStr}`)
.method('DELETE')
.header({ 'Authorization': `Bearer ${token}` })
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.fail((err) => {
console.error('批量删除知识库失败:', err);
if (errorCallback) {
errorCallback(err);
}
})
.networkFail(() => {
const self = this;
RequestService.reAjaxFun(() => {
self.deleteKnowledgeBases(ids, callback, errorCallback);
makeApiRequest({
url: `${getServiceUrl()}/api/v1/datasets/batch?ids=${idsStr}`,
method: 'DELETE',
callback: callback,
errorCallback: errorCallback,
errorMessage: '批量删除知识库失败',
retryFunction: () => this.deleteKnowledgeBases(ids, callback, errorCallback)
});
}).send();
},
/**
@@ -196,33 +188,20 @@ export default {
* @param {Function} errorCallback - 错误回调
*/
getDocumentList(datasetId, params, callback, errorCallback) {
const token = getAuthToken();
const queryParams = new URLSearchParams({
page: params.page,
page_size: params.page_size,
name: params.name || ''
}).toString();
RequestService.sendRequest()
.url(`${getServiceUrl()}/api/v1/datasets/${datasetId}/documents?${queryParams}`)
.method('GET')
.header({ 'Authorization': `Bearer ${token}` })
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.fail((err) => {
console.error('获取文档列表失败:', err);
if (errorCallback) {
errorCallback(err);
}
})
.networkFail(() => {
const self = this;
RequestService.reAjaxFun(() => {
self.getDocumentList(datasetId, params, callback, errorCallback);
makeApiRequest({
url: `${getServiceUrl()}/api/v1/datasets/${datasetId}/documents?${queryParams}`,
method: 'GET',
callback: callback,
errorCallback: errorCallback,
errorMessage: '获取文档列表失败',
retryFunction: () => this.getDocumentList(datasetId, params, callback, errorCallback)
});
}).send();
},
/**
@@ -233,31 +212,16 @@ export default {
* @param {Function} errorCallback - 错误回调
*/
uploadDocument(datasetId, formData, callback, errorCallback) {
const token = getAuthToken();
RequestService.sendRequest()
.url(`${getServiceUrl()}/api/v1/datasets/${datasetId}/documents`)
.method('POST')
.data(formData)
.header({
'Authorization': `Bearer ${token}`,
'Content-Type': 'multipart/form-data'
})
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.fail((err) => {
console.error('上传文档失败:', err);
if (errorCallback) {
errorCallback(err);
}
})
.networkFail(() => {
const self = this;
RequestService.reAjaxFun(() => {
self.uploadDocument(datasetId, formData, callback, errorCallback);
makeApiRequest({
url: `${getServiceUrl()}/api/v1/datasets/${datasetId}/documents`,
method: 'POST',
data: formData,
headers: { 'Content-Type': 'multipart/form-data' },
callback: callback,
errorCallback: errorCallback,
errorMessage: '上传文档失败',
retryFunction: () => this.uploadDocument(datasetId, formData, callback, errorCallback)
});
}).send();
},
/**
@@ -268,35 +232,20 @@ export default {
* @param {Function} errorCallback - 错误回调
*/
parseDocument(datasetId, documentId, callback, errorCallback) {
const token = getAuthToken();
const requestBody = {
document_ids: [documentId]
};
RequestService.sendRequest()
.url(`${getServiceUrl()}/api/v1/datasets/${datasetId}/chunks`)
.method('POST')
.data(requestBody)
.header({
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
})
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.fail((err) => {
console.error('解析文档失败:', err);
if (errorCallback) {
errorCallback(err);
}
})
.networkFail(() => {
const self = this;
RequestService.reAjaxFun(() => {
self.parseDocument(datasetId, documentId, callback, errorCallback);
makeApiRequest({
url: `${getServiceUrl()}/api/v1/datasets/${datasetId}/chunks`,
method: 'POST',
data: requestBody,
headers: { 'Content-Type': 'application/json' },
callback: callback,
errorCallback: errorCallback,
errorMessage: '解析文档失败',
retryFunction: () => this.parseDocument(datasetId, documentId, callback, errorCallback)
});
}).send();
},
/**
@@ -307,27 +256,14 @@ export default {
* @param {Function} errorCallback - 错误回调
*/
deleteDocument(datasetId, documentId, callback, errorCallback) {
const token = getAuthToken();
RequestService.sendRequest()
.url(`${getServiceUrl()}/api/v1/datasets/${datasetId}/documents/${documentId}`)
.method('DELETE')
.header({ 'Authorization': `Bearer ${token}` })
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.fail((err) => {
console.error('删除文档失败:', err);
if (errorCallback) {
errorCallback(err);
}
})
.networkFail(() => {
const self = this;
RequestService.reAjaxFun(() => {
self.deleteDocument(datasetId, documentId, callback, errorCallback);
makeApiRequest({
url: `${getServiceUrl()}/api/v1/datasets/${datasetId}/documents/${documentId}`,
method: 'DELETE',
callback: callback,
errorCallback: errorCallback,
errorMessage: '删除文档失败',
retryFunction: () => this.deleteDocument(datasetId, documentId, callback, errorCallback)
});
}).send();
},
/**
@@ -339,8 +275,7 @@ export default {
* @param {Function} errorCallback - 错误回调
*/
listChunks(datasetId, documentId, params, callback, errorCallback) {
const token = getAuthToken();
const queryParams = new URLSearchParams({
let queryParams = new URLSearchParams({
page: params.page || 1,
page_size: params.page_size || 10
}).toString();
@@ -350,26 +285,14 @@ export default {
queryParams += `&keywords=${encodeURIComponent(params.keywords)}`;
}
RequestService.sendRequest()
.url(`${getServiceUrl()}/api/v1/datasets/${datasetId}/documents/${documentId}/chunks?${queryParams}`)
.method('GET')
.header({ 'Authorization': `Bearer ${token}` })
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.fail((err) => {
console.error('获取切片列表失败:', err);
if (errorCallback) {
errorCallback(err);
}
})
.networkFail(() => {
const self = this;
RequestService.reAjaxFun(() => {
self.listChunks(datasetId, documentId, params, callback, errorCallback);
makeApiRequest({
url: `${getServiceUrl()}/api/v1/datasets/${datasetId}/documents/${documentId}/chunks?${queryParams}`,
method: 'GET',
callback: callback,
errorCallback: errorCallback,
errorMessage: '获取切片列表失败',
retryFunction: () => this.listChunks(datasetId, documentId, params, callback, errorCallback)
});
}).send();
},
/**
@@ -381,28 +304,16 @@ export default {
* @param {Function} errorCallback - 错误回调
*/
addChunk(datasetId, documentId, data, callback, errorCallback) {
const token = getAuthToken();
RequestService.sendRequest()
.url(`${getServiceUrl()}/api/v1/datasets/${datasetId}/documents/${documentId}/chunks`)
.method('POST')
.data(data)
.header({ 'Authorization': `Bearer ${token}` })
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.fail((err) => {
console.error('添加切片失败:', err);
if (errorCallback) {
errorCallback(err);
}
})
.networkFail(() => {
const self = this;
RequestService.reAjaxFun(() => {
self.addChunk(datasetId, documentId, data, callback, errorCallback);
makeApiRequest({
url: `${getServiceUrl()}/api/v1/datasets/${datasetId}/documents/${documentId}/chunks`,
method: 'POST',
data: data,
headers: { 'Content-Type': 'application/json' },
callback: callback,
errorCallback: errorCallback,
errorMessage: '添加切片失败',
retryFunction: () => this.addChunk(datasetId, documentId, data, callback, errorCallback)
});
}).send();
},
/**
@@ -413,28 +324,16 @@ export default {
* @param {Function} errorCallback - 错误回调
*/
retrievalTest(datasetId, data, callback, errorCallback) {
const token = getAuthToken();
RequestService.sendRequest()
.url(`${getServiceUrl()}/api/v1/datasets/${datasetId}/retrieval-test`)
.method('POST')
.data(data)
.header({ 'Authorization': `Bearer ${token}` })
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.fail((err) => {
console.error('召回测试失败:', err);
if (errorCallback) {
errorCallback(err);
}
})
.networkFail(() => {
const self = this;
RequestService.reAjaxFun(() => {
self.retrievalTest(datasetId, data, callback, errorCallback);
makeApiRequest({
url: `${getServiceUrl()}/api/v1/datasets/${datasetId}/retrieval-test`,
method: 'POST',
data: data,
headers: { 'Content-Type': 'application/json' },
callback: callback,
errorCallback: errorCallback,
errorMessage: '召回测试失败',
retryFunction: () => this.retrievalTest(datasetId, data, callback, errorCallback)
});
}).send();
}
};
+1 -1
View File
@@ -1206,7 +1206,7 @@ export default {
'knowledgeFileUpload.documentNamePlaceholder': 'Please enter document name',
'knowledgeFileUpload.file': 'File',
'knowledgeFileUpload.clickToUpload': 'Click to upload',
'knowledgeFileUpload.uploadTip': 'Only pdf, doc, docx, txt files are supported, and file size should not exceed 10MB',
'knowledgeFileUpload.uploadTip': 'Supported file types: PDF, DOC, DOCX, TXT, MD, CSV, XLS, XLSX, PPT, PPTX. Maximum 32 files per upload, each file size up to 10MB',
'knowledgeFileUpload.dragOrClick': 'Drag file here, or click to upload',
'knowledgeFileUpload.cancel': 'Cancel',
'knowledgeFileUpload.confirm': 'Confirm',
+1 -1
View File
@@ -1206,7 +1206,7 @@ export default {
'knowledgeFileUpload.documentNamePlaceholder': '请输入文档名称',
'knowledgeFileUpload.file': '文件',
'knowledgeFileUpload.clickToUpload': '点击上传',
'knowledgeFileUpload.uploadTip': '只能上传pdf、doc、docx、txt文件,且不超过10MB',
'knowledgeFileUpload.uploadTip': '支持的文档类型:PDF、DOC、DOCX、TXT、MD、CSV、XLS、XLSX、PPT、PPTX,单次批量上传文件数不超过 32 个',
'knowledgeFileUpload.dragOrClick': '将文件拖到此处,或点击上传',
'knowledgeFileUpload.cancel': '取消',
'knowledgeFileUpload.confirm': '确定',
+1 -1
View File
@@ -1206,7 +1206,7 @@ export default {
'knowledgeFileUpload.documentNamePlaceholder': '請輸入文檔名稱',
'knowledgeFileUpload.file': '文件',
'knowledgeFileUpload.clickToUpload': '點擊上傳',
'knowledgeFileUpload.uploadTip': '只能上傳pdf、doc、docx、txt文件,且不超過10MB',
'knowledgeFileUpload.uploadTip': '支持的文件類型:PDF、DOC、DOCX、TXT、MD、CSV、XLS、XLSX、PPT、PPTX,单次批量上傳文件數不超過 32 個,每個文件大小不超過 10MB',
'knowledgeFileUpload.dragOrClick': '將文件拖到此處,或點擊上傳',
'knowledgeFileUpload.cancel': '取消',
'knowledgeFileUpload.confirm': '確定',
@@ -15,7 +15,7 @@
<div class="content-panel">
<div class="content-area">
<el-card class="params-card" shadow="never">
<div class="table-wrapper">
<div>
<el-table ref="paramsTable" :data="knowledgeBaseList" class="transparent-table" v-loading="loading"
:element-loading-text="$t('common.loading')" element-loading-spinner="el-icon-loading"
element-loading-background="rgba(255, 255, 255, 0.7)"
@@ -310,7 +310,6 @@ export default {
uploadDialogVisible: false,
uploading: false,
uploadForm: {
name: '',
file: null
},
uploadUrl: '',
@@ -323,7 +322,6 @@ export default {
currentDocumentName: '',
sliceList: [],
sliceLoading: false,
sliceSearchKeyword: '',
sliceCurrentPage: 1,
slicePageSize: 10,
sliceTotal: 0,
@@ -977,17 +975,6 @@ export default {
this.fetchSlices();
},
handleSliceDialogClose: function(done) {
this.sliceDialogVisible = false;
this.currentDocumentId = null;
this.currentDocumentName = '';
this.sliceList = [];
this.sliceTotal = 0;
if (done) {
done();
}
},
// 跳转到切片管理第一页
goToSliceFirstPage: function() {
if (this.sliceCurrentPage !== 1) {
@@ -1433,9 +1420,9 @@ export default {
/* 拖拽上传区域样式 */
.document-uploader {
:deep(.el-upload-dragger) {
width: 100%;
height: 200px;
min-height: 200px;
width: 600px;
height: 300px;
min-height: 300px;
border: 2px dashed #c0c4cc;
border-radius: 16px;
cursor: pointer;
@@ -1993,10 +1980,6 @@ export default {
gap: 10px;
}
.slice-table {
margin-bottom: 20px;
}
.slice-pagination {
text-align: right;
margin-top: 20px;
@@ -2007,172 +1990,6 @@ export default {
justify-content: flex-end;
gap: 5px;
}
:deep(.el-pagination) {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 8px;
.el-pagination__sizes {
margin-right: 8px;
.el-input__inner {
height: 32px;
line-height: 32px;
border-radius: 4px;
border: 1px solid #e4e7ed;
background: #dee7ff;
color: #606266;
font-size: 14px;
}
.el-input__suffix {
right: 6px;
width: 15px;
height: 20px;
display: flex;
justify-content: center;
align-items: center;
top: 6px;
border-radius: 4px;
}
.el-input__suffix-inner {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
}
.el-icon-arrow-up:before {
content: "";
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 9px solid #606266;
position: relative;
transform: rotate(0deg);
transition: transform 0.3s;
}
}
.btn-prev, .btn-next {
min-width: 60px;
height: 32px;
padding: 0 12px;
border-radius: 4px;
border: 1px solid #e4e7ed;
background: #dee7ff;
color: #606266;
font-size: 14px;
cursor: pointer;
transition: all 0.3s ease;
&:hover {
background: #d7dce6;
}
&:disabled {
opacity: 0.6;
cursor: not-allowed;
}
}
.el-pager {
display: flex;
gap: 4px;
.number {
min-width: 28px;
height: 32px;
padding: 0;
border-radius: 4px;
border: 1px solid transparent;
background: transparent;
color: #606266;
font-size: 14px;
cursor: pointer;
transition: all 0.3s ease;
&:hover {
background: rgba(245, 247, 250, 0.3);
}
&.active {
background: #5f70f3 !important;
color: #ffffff !important;
border-color: #5f70f3 !important;
&:hover {
background: #6d7cf5 !important;
}
}
}
}
.el-pagination__jump {
margin-left: 8px;
color: #606266;
font-size: 14px;
.el-pagination__editor {
width: 50px;
margin: 0 8px;
.el-input__inner {
height: 32px;
line-height: 32px;
border-radius: 4px;
border: 1px solid #e4e7ed;
background: #dee7ff;
color: #606266;
font-size: 14px;
}
}
}
.el-pagination__total {
margin-right: 8px;
color: #606266;
font-size: 14px;
}
}
}
.slice-content {
max-height: 300px;
min-height: 60px;
overflow-y: auto;
word-break: break-all;
line-height: 1.4;
padding: 8px 12px;
border: 1px solid #e4e7ed;
border-radius: 4px;
background-color: #f8f9fa;
white-space: pre-wrap;
}
.slice-keywords, .slice-questions {
max-height: 60px;
overflow-y: auto;
}
.slice-tag {
margin: 2px;
}
.add-slice-form {
padding: 20px 0;
}
.form-item {
margin-bottom: 20px;
}
.form-actions {
text-align: right;
margin-top: 20px;
}
@media (min-width: 1144px) {