Commit 67d9f272 authored by 林洋洋's avatar 林洋洋

切片添加

parent 4c8bb7c1
......@@ -21,6 +21,12 @@ public class DocumentSegmentResult {
@Schema(description = "文件名")
private String fileName;
/**
* 文件名
*/
@Schema(description = "文件名")
private String filePath;
/**
* 文档分段列表
*/
......@@ -33,11 +39,6 @@ public class DocumentSegmentResult {
@Schema(description = "总分段数")
private Integer totalSegments;
/**
* 文档总字符数
*/
@Schema(description = "文档总字符数")
private Integer totalCharacters;
/**
* 文档分段详情
......
......@@ -44,7 +44,7 @@ public class KnowledgeDocument extends BaseEntity {
/**
* 原始文件名
*/
@Schema(description = "原始文件名")
@Schema(description = "文档名称")
private String fileName;
/**
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the thermal4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.ask.api.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* 文件管理
*/
@Data
@Schema(description = "文件")
@EqualsAndHashCode(callSuper = true)
@TableName(value = "ask_file")
public class SysFile extends Model<SysFile> {
private static final long serialVersionUID = 1L;
/**
* 编号
*/
@TableId(type = IdType.AUTO)
@Schema(description = "文件编号")
private Long id;
/**
* 文件名
*/
@Schema(description = "文件名")
private String fileName;
/**
* 原文件名
*/
@Schema(description = "原始文件名")
private String original;
/**
* 容器名称
*/
@Schema(description = "存储桶名称")
private String bucketName;
/**
* 文件类型
*/
@Schema(description = "文件类型")
private String type;
/**
* 文件大小
*/
@Schema(description = "文件大小")
private Long fileSize;
/**
* 文件大小
*/
@Schema(description = "上传状态 0 失败 1成功")
private Integer status;
/**
* 上传人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建者")
private String createBy;
/**
* 上传时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 更新人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "更新者")
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.UPDATE)
@Schema(description = "更新时间")
private LocalDateTime updateTime;
/**
* 删除标识:1-删除,0-正常
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description = "删除标记,1:已删除,0:正常")
private String delFlag;
@TableField(exist = false)
@Schema(description = "url")
private String url;
}
artifactId=ask-data-ai-api
groupId=com.ask
version=1.0.0-SNAPSHOT
com\ask\api\entity\GenTableColumnEntity.class
com\ask\api\entity\GenTable.class
com\ask\api\entity\ChatConversation.class
com\ask\api\dto\DocumentSegmentResult.class
com\ask\api\entity\GenDatasourceConf.class
com\ask\api\entity\KnowledgeBase.class
com\ask\api\entity\KnowledgeDocument.class
com\ask\api\dto\TableParam.class
com\ask\api\dto\TableDto.class
com\ask\api\entity\ChatConversationDetail.class
com\ask\api\dto\DocumentSegmentResult$DocumentSegment.class
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-api\src\main\java\com\ask\api\entity\GenTable.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-api\src\main\java\com\ask\api\dto\DocumentSegmentResult.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-api\src\main\java\com\ask\api\entity\GenDatasourceConf.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-api\src\main\java\com\ask\api\entity\GenTableColumnEntity.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-api\src\main\java\com\ask\api\entity\ChatConversation.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-api\src\main\java\com\ask\api\dto\TableDto.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-api\src\main\java\com\ask\api\entity\KnowledgeDocument.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-api\src\main\java\com\ask\api\entity\KnowledgeBase.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-api\src\main\java\com\ask\api\dto\TableParam.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-api\src\main\java\com\ask\api\entity\ChatConversationDetail.java
......@@ -67,7 +67,10 @@
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-pdf-document-reader</artifactId>
</dependency>
<!-- MyBatis Plus -->
<dependency>
<groupId>com.baomidou</groupId>
......
......@@ -48,6 +48,7 @@ public class CommonConfiguration {
@Bean
public RetrievalAugmentationAdvisor retrievalAugmentationAdvisor(VectorStore vectorStore) {
return RetrievalAugmentationAdvisor.builder()
.documentRetriever(VectorStoreDocumentRetriever.builder()
.similarityThreshold(0.60)
......
package com.ask.controller;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.ask.api.dto.DocumentSegmentRequest;
import com.ask.api.dto.DocumentSegmentResult;
import com.ask.api.entity.KnowledgeDocument;
import com.ask.api.entity.SysFile;
import com.ask.common.core.FileTemplate;
import com.ask.common.core.R;
import com.ask.service.KnowledgeDocumentService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -20,6 +26,9 @@ import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -37,6 +46,7 @@ public class KnowledgeDocumentController {
private final KnowledgeDocumentService knowledgeDocumentService;
private final FileTemplate fileTemplate;
/**
* 分页查询
* @param page 分页对象
......@@ -58,7 +68,6 @@ public class KnowledgeDocumentController {
if (StringUtils.hasText(name)) {
wrapper.like(KnowledgeDocument::getName, name.trim());
}
// 按创建时间倒序排列
wrapper.orderByDesc(KnowledgeDocument::getCreateTime);
......@@ -129,51 +138,18 @@ public class KnowledgeDocumentController {
/**
* 文档分段处理
* @param knowledgeBaseId 知识库ID
* @param files 文件数组
* @param request 请求体
* @return 文档分段结果列表
*/
@Operation(summary = "文档分段处理", description = "上传文档并进行分段处理,支持PDF、Word、Excel、TXT、MD等格式")
@PostMapping(value = "/segment", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<List<DocumentSegmentResult>> segmentDocuments(
@Parameter(description = "知识库ID", required = true)
@RequestParam Long knowledgeBaseId,
@Parameter(description = "文件数组", required = true)
@RequestParam("files") MultipartFile[] files) {
// 校验知识库ID
if (knowledgeBaseId == null || knowledgeBaseId <= 0) {
return R.failed("知识库ID不能为空且必须大于0");
}
// 校验文件
if (files == null || files.length == 0) {
return R.failed("请选择要上传的文件");
}
// 校验文件大小和类型
for (MultipartFile file : files) {
if (file.isEmpty()) {
return R.failed("文件不能为空:" + file.getOriginalFilename());
}
// 限制文件大小(50MB)
if (file.getSize() > 50 * 1024 * 1024) {
return R.failed("文件大小不能超过50MB:" + file.getOriginalFilename());
}
// 检查文件类型
String fileName = file.getOriginalFilename();
if (fileName == null || !isValidFileType(fileName)) {
return R.failed("不支持的文件类型:" + fileName + ",支持的格式:PDF、DOC、DOCX、XLS、XLSX、TXT、MD、RTF、ODT");
}
}
@PostMapping(value = "/segment")
public R<List<DocumentSegmentResult>> segmentDocuments(@Valid @RequestBody DocumentSegmentRequest request) {
try {
List<DocumentSegmentResult> results = knowledgeDocumentService.segmentDocuments(knowledgeBaseId, files);
List<DocumentSegmentResult> results = knowledgeDocumentService.segmentDocuments(request);
return R.ok(results);
} catch (Exception e) {
log.error("文档分段处理失败,知识库ID: {}, 错误: {}", knowledgeBaseId, e.getMessage(), e);
log.error("文档分段处理失败,知识库ID: {}, 错误: {}", request.getKnowledgeBaseId(), e.getMessage(), e);
return R.failed("文档分段处理失败:" + e.getMessage());
}
}
......@@ -199,4 +175,7 @@ public class KnowledgeDocumentController {
extension.endsWith(".rtf") ||
extension.endsWith(".odt");
}
}
\ No newline at end of file
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the thermal4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.ask.controller;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.StrUtil;
import com.ask.api.dto.FileUploadRequest;
import com.ask.api.entity.SysFile;
import com.ask.common.core.R;
import com.ask.service.SysFileService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.core.io.ClassPathResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import jakarta.validation.Valid;
import java.util.List;
/**
* 文件管理控制器
*
* @author ai
* @date 2024/12/19
*/
@RestController
@AllArgsConstructor
@RequestMapping("/sys-file")
@Tag(name = "文件管理", description = "文件上传、下载、管理等相关接口")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class SysFileController {
private final SysFileService sysFileService;
/**
* 批量上传文件
* 文件名采用uuid,避免原始文件名中带"-"符号导致下载的时候解析出现异常
*
* @param request 文件上传请求参数
* @return R 上传结果,包含文件访问路径 (/ admin / bucketName / filename)
*/
@Operation(
summary = "批量上传文件",
description = "批量上传文件到指定存储桶,支持多文件同时上传。文件名会自动转换为UUID格式避免重名冲突。"
)
@PostMapping(value = "/MultipartUpload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<List<SysFile>> multipartUpload(
@Parameter(description = "文件上传请求参数", required = true)
@Valid @ModelAttribute FileUploadRequest request) {
return sysFileService.multipartUpload(request.getFiles(), request.getBucketName());
}
/**
* 获取文件/下载文件
* 根据存储桶和文件名获取文件流,支持在线预览和下载
*
* @param bucket 存储桶名称
* @param fileName 文件名称
* @param response HTTP响应对象
*/
@Operation(
summary = "获取文件",
description = "根据存储桶名称和文件名获取文件,支持文件下载和在线预览"
)
@GetMapping("/{bucket}/{fileName}")
public void file(
@Parameter(description = "存储桶名称", required = true, example = "1")
@PathVariable String bucket,
@Parameter(description = "文件名称", required = true, example = "example.pdf")
@PathVariable String fileName,
HttpServletResponse response) {
sysFileService.getFile(bucket, fileName, response);
}
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the thermal4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.ask.mapper;
import com.ask.api.entity.SysFile;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 文件管理
*/
@Mapper
public interface SysFileMapper extends BaseMapper<SysFile> {
}
package com.ask.service;
import com.ask.api.dto.DocumentSegmentRequest;
import com.ask.api.dto.DocumentSegmentResult;
import com.ask.api.entity.KnowledgeDocument;
import com.baomidou.mybatisplus.extension.service.IService;
......@@ -17,11 +18,9 @@ public interface KnowledgeDocumentService extends IService<KnowledgeDocument> {
/**
* 文档分段处理
* @param knowledgeBaseId 知识库ID
* @param files 文件数组
* @return 文档分段结果列表
*/
List<DocumentSegmentResult> segmentDocuments(Long knowledgeBaseId, MultipartFile[] files);
List<DocumentSegmentResult> segmentDocuments(DocumentSegmentRequest request);
/**
* 保存文档分段结果
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the thermal4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.ask.service;
import com.ask.api.entity.SysFile;
import com.ask.common.core.R;
import com.baomidou.mybatisplus.extension.service.IService;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream;
import java.util.List;
/**
* 文件管理
*/
public interface SysFileService extends IService<SysFile> {
/**
* 上传文件
* @param files
* @return
*/
R<List<SysFile>> multipartUpload(MultipartFile[] files, Long bucketName);
/**
* 读取文件
* @param bucket 桶名称
* @param fileName 文件名称
* @param response 输出流
*/
void getFile(String bucket, String fileName, HttpServletResponse response);
public InputStream getFileStream(String bruckName,String fileName);
}
//package com.ask.service;
//
//
//import com.ask.api.dto.DocumentSegmentResult;
//
//import java.util.List;
//
///**
// * 向量存储服务接口
// *
// * @author ai
// * @date 2024/12/19
// */
//public interface VectorStoreService {
//
// /**
// * 异步向量化文档分段
// * @param knowledgeBaseId 知识库ID
// * @param documentId 文档ID
// * @param segmentResults 分段结果列表
// */
// void vectorizeDocumentsAsync(Long knowledgeBaseId, Long documentId, List<DocumentSegmentResult> segmentResults);
//
// /**
// * 向量化单个文档的分段
// * @param knowledgeBaseId 知识库ID
// * @param documentId 文档ID
// * @param segmentResult 分段结果
// */
// void vectorizeDocument(Long knowledgeBaseId, Long documentId, DocumentSegmentResult segmentResult);
//
//}
\ No newline at end of file
package com.ask.service.impl;
import com.ask.api.dto.DocumentSegmentRequest;
import com.ask.api.dto.DocumentSegmentResult;
import com.ask.api.entity.KnowledgeDocument;
import com.ask.api.entity.SysFile;
import com.ask.mapper.KnowledgeDocumentMapper;
import com.ask.service.KnowledgeDocumentService;
import com.ask.service.SysFileService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.document.Document;
import org.springframework.ai.reader.ExtractedTextFormatter;
import org.springframework.ai.reader.pdf.ParagraphPdfDocumentReader;
import org.springframework.ai.reader.pdf.config.PdfDocumentReaderConfig;
import org.springframework.ai.reader.tika.TikaDocumentReader;
import org.springframework.ai.transformer.splitter.TokenTextSplitter;
import org.springframework.ai.vectorstore.VectorStore;
import org.springframework.core.io.InputStreamResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 知识库文档服务实现类
......@@ -30,67 +41,225 @@ import java.util.List;
@RequiredArgsConstructor
public class KnowledgeDocumentServiceImpl extends ServiceImpl<KnowledgeDocumentMapper, KnowledgeDocument> implements KnowledgeDocumentService {
private final SysFileService sysFileService;
private final VectorStore vectorStore;
@Override
public List<DocumentSegmentResult> segmentDocuments(Long knowledgeBaseId, MultipartFile[] files) {
List<DocumentSegmentResult> results = new ArrayList<>();
if (files == null || files.length == 0) {
log.warn("文件数组为空,知识库ID: {}", knowledgeBaseId);
return results;
}
/**
* 从PDF文档中读取带目录结构的文档分段
*
* @param inputStream PDF文件的输入流
* @return 文档列表
*/
public List<Document> getDocsFromPdfWithCatalog(InputStream inputStream) {
// 使用InputStreamResource包装InputStream
InputStreamResource resource = new InputStreamResource(inputStream);
// 初始化文本分割器,设置分段参数
TokenTextSplitter textSplitter = new TokenTextSplitter(
1000, // 默认分段大小(token数)
200, // 重叠token数
5, // 最小分段大小
10000, // 最大分段大小
true // 保持分隔符
);
ParagraphPdfDocumentReader pdfReader = new ParagraphPdfDocumentReader(resource,
PdfDocumentReaderConfig.builder()
.withPageTopMargin(0)
.withPageExtractedTextFormatter(ExtractedTextFormatter.builder()
.withNumberOfTopTextLinesToDelete(0)
.build())
.withPagesPerDocument(1)
.build());
for (MultipartFile file : files) {
if (file.isEmpty()) {
log.warn("跳过空文件: {}", file.getOriginalFilename());
continue;
return pdfReader.read();
}
/**
* PDF文档切片函数 - 支持多种切片策略
*
* @param inputStream PDF文件的输入流
* @param sliceStrategy 切片策略 (PAGE, PARAGRAPH, CUSTOM)
* @param maxTokensPerSlice 每片最大token数(仅对CUSTOM策略有效)
* @return 文档片段列表,每个Document就是一片
*/
public List<Document> slicePdfDocument(InputStream inputStream, SliceStrategy sliceStrategy, Integer maxTokensPerSlice) {
InputStreamResource resource = new InputStreamResource(inputStream);
List<Document> documents = new ArrayList<>();
try {
// 使用Tika读取文档
TikaDocumentReader documentReader = new TikaDocumentReader(
new InputStreamResource(file.getInputStream())
);
switch (sliceStrategy) {
case PAGE:
// 按页面切片 - 每页一个Document
documents = sliceByPage(resource);
break;
// 读取文档内容
List<Document> documents = documentReader.get();
if (documents.isEmpty()) {
log.warn("文档解析失败或内容为空: {}", file.getOriginalFilename());
continue;
case PARAGRAPH:
// 按段落切片 - 每个段落一个Document
documents = sliceByParagraph(resource);
break;
case CUSTOM:
// 自定义切片 - 按token数量切片
documents = sliceByTokens(resource, maxTokensPerSlice != null ? maxTokensPerSlice : 500);
break;
default:
log.warn("未知的切片策略: {}, 使用默认页面切片", sliceStrategy);
documents = sliceByPage(resource);
}
//
// // 为每个文档片段添加元数据
// for (int i = 0; i < documents.size(); i++) {
// Document doc = documents.get(i);
// doc.getMetadata().put("slice_index", i + 1);
// doc.getMetadata().put("slice_strategy", sliceStrategy.name());
// doc.getMetadata().put("total_slices", documents.size());
// }
log.info("PDF切片完成,策略: {}, 切片数量: {}", sliceStrategy, documents.size());
} catch (Exception e) {
log.error("PDF切片失败,策略: {}, 错误: {}", sliceStrategy, e.getMessage(), e);
throw new RuntimeException("PDF切片失败: " + e.getMessage(), e);
}
// 合并所有文档内容
StringBuilder contentBuilder = new StringBuilder();
for (Document doc : documents) {
if (StringUtils.hasText(doc.getText())) {
contentBuilder.append(doc.getText()).append("\n");
return documents;
}
/**
* 按页面切片 - 每页一个Document
*/
private List<Document> sliceByPage(InputStreamResource resource) {
ParagraphPdfDocumentReader pdfReader = new ParagraphPdfDocumentReader(resource,
PdfDocumentReaderConfig.builder()
.withPageTopMargin(0)
.withPageExtractedTextFormatter(ExtractedTextFormatter.builder()
.withNumberOfTopTextLinesToDelete(0)
.build())
.withPagesPerDocument(1) // 每页一个Document
.build());
List<Document> documents = pdfReader.read();
// 为每个页面添加页码信息
for (int i = 0; i < documents.size(); i++) {
Document doc = documents.get(i);
doc.getMetadata().put("page_number", i + 1);
doc.getMetadata().put("slice_type", "page");
}
String fullContent = contentBuilder.toString().trim();
if (!StringUtils.hasText(fullContent)) {
log.warn("文档内容为空: {}", file.getOriginalFilename());
continue;
return documents;
}
/**
* 按段落切片 - 每个段落一个Document
*/
private List<Document> sliceByParagraph(InputStreamResource resource) {
// 先读取整个文档
ParagraphPdfDocumentReader pdfReader = new ParagraphPdfDocumentReader(resource,
PdfDocumentReaderConfig.builder()
.withPageTopMargin(0)
.withPageExtractedTextFormatter(ExtractedTextFormatter.builder()
.withNumberOfTopTextLinesToDelete(0)
.build())
.withPagesPerDocument(0)
.build());
List<Document> pageDocuments = pdfReader.read();
// List<Document> paragraphDocuments = new ArrayList<>();
//
// int paragraphIndex = 1;
// for (Document pageDoc : pageDocuments) {
// String content = pageDoc.getText();
// if (StringUtils.hasText(content)) {
// // 按段落分割(双换行符)
// String[] paragraphs = content.split("\\n\\s*\\n");
//
// for (String paragraph : paragraphs) {
// if (StringUtils.hasText(paragraph.trim())) {
// Document paragraphDoc = new Document(paragraph.trim());
// paragraphDoc.getMetadata().put("paragraph_index", paragraphIndex++);
// paragraphDoc.getMetadata().put("slice_type", "paragraph");
// paragraphDoc.getMetadata().put("source_page", pageDoc.getMetadata().get("page_number"));
// paragraphDocuments.add(paragraphDoc);
// }
// }
// }
// }
return pageDocuments;
}
/**
* 按token数量切片 - 每片指定token数量
*/
private List<Document> sliceByTokens(InputStreamResource resource, int maxTokensPerSlice) {
// 先读取整个文档内容
ParagraphPdfDocumentReader pdfReader = new ParagraphPdfDocumentReader(resource,
PdfDocumentReaderConfig.builder()
.withPageTopMargin(0)
.withPageExtractedTextFormatter(ExtractedTextFormatter.builder()
.withNumberOfTopTextLinesToDelete(0)
.build())
.build());
List<Document> pageDocuments = pdfReader.read();
// 合并所有页面内容
StringBuilder fullContent = new StringBuilder();
for (Document pageDoc : pageDocuments) {
if (StringUtils.hasText(pageDoc.getText())) {
fullContent.append(pageDoc.getText()).append("\n");
}
}
// 使用TokenTextSplitter进行切片
TokenTextSplitter textSplitter = new TokenTextSplitter(
maxTokensPerSlice, // 每片最大token数
100, // 重叠token数
50, // 最小片段大小
maxTokensPerSlice * 2, // 最大片段大小
true // 保持分隔符
);
Document fullDocument = new Document(fullContent.toString().trim());
List<Document> tokenDocuments = textSplitter.apply(List.of(fullDocument));
// 为每个token片段添加元数据
for (int i = 0; i < tokenDocuments.size(); i++) {
Document doc = tokenDocuments.get(i);
doc.getMetadata().put("token_slice_index", i + 1);
doc.getMetadata().put("slice_type", "token");
doc.getMetadata().put("max_tokens_per_slice", maxTokensPerSlice);
doc.getMetadata().put("estimated_tokens", estimateTokenCount(doc.getText()));
}
return tokenDocuments;
}
/**
* PDF切片策略枚举
*/
public enum SliceStrategy {
PAGE, // 按页面切片
PARAGRAPH, // 按段落切片
CUSTOM // 自定义切片(按token数量)
}
// 对文档进行分段
Document fullDocument = new Document(fullContent);
List<Document> segments = textSplitter.apply(List.of(fullDocument));
@Override
public List<DocumentSegmentResult> segmentDocuments(DocumentSegmentRequest request) {
List<DocumentSegmentResult> results = new ArrayList<>();
for (SysFile file : request.getFiles()) {
// 读取文档内容 - 使用新的PDF切片函数
List<Document> segments = slicePdfDocument(
sysFileService.getFileStream(file.getBucketName(), file.getFileName()),
SliceStrategy.PARAGRAPH, // 可以改为 PARAGRAPH 或 CUSTOM
500 // 仅在CUSTOM策略时生效
);
if (segments.isEmpty()) {
log.warn("文档解析失败或内容为空: {}", file.getOriginal());
continue;
}
// 构建分段结果
DocumentSegmentResult result = new DocumentSegmentResult();
result.setFileName(file.getOriginalFilename());
result.setFileName(file.getOriginal());
result.setFilePath(file.getUrl());
result.setTotalSegments(segments.size());
result.setTotalCharacters(fullContent.length());
List<DocumentSegmentResult.DocumentSegment> segmentList = new ArrayList<>();
for (int i = 0; i < segments.size(); i++) {
......@@ -103,36 +272,22 @@ public class KnowledgeDocumentServiceImpl extends ServiceImpl<KnowledgeDocumentM
segmentDto.setTokenCount(estimateTokenCount(segment.getText()));
segmentList.add(segmentDto);
}
result.setSegments(segmentList);
results.add(result);
log.info("文档分段完成: {}, 分段数: {}, 总字符数: {}",
file.getOriginalFilename(), segments.size(), fullContent.length());
} catch (IOException e) {
log.error("文档处理失败: {}, 错误: {}", file.getOriginalFilename(), e.getMessage(), e);
// 创建错误结果
DocumentSegmentResult errorResult = new DocumentSegmentResult();
errorResult.setFileName(file.getOriginalFilename());
errorResult.setSegments(new ArrayList<>());
errorResult.setTotalSegments(0);
errorResult.setTotalCharacters(0);
results.add(errorResult);
}
log.info("文档分段完成: {}, 分段数: {}",
file.getOriginal(), segments.size());
}
return results;
}
@Transactional
@Override
public boolean saveSegmentResults(Long knowledgeBaseId, List<DocumentSegmentResult> segmentResults) {
if (segmentResults == null || segmentResults.isEmpty()) {
log.warn("分段结果为空,无法保存,知识库ID: {}", knowledgeBaseId);
return false;
}
List<KnowledgeDocument> knowledgeDocuments = new ArrayList<>();
for (DocumentSegmentResult result : segmentResults) {
// 创建文档记录
KnowledgeDocument document = new KnowledgeDocument();
......@@ -144,31 +299,22 @@ public class KnowledgeDocumentServiceImpl extends ServiceImpl<KnowledgeDocumentM
document.setTokenCount(result.getSegments().stream()
.mapToInt(DocumentSegmentResult.DocumentSegment::getTokenCount)
.sum());
knowledgeDocuments.add(document);
document.setFilePath(result.getFilePath());
this.save(document);
List<Document> list = new ArrayList<>();
result.getSegments().forEach(vo -> {
Map<String, Object> map = new HashMap<>();
map.put("documentId", document.getId());
map.put("knowledgeBaseId", knowledgeBaseId);
map.put("fileName", document.getFileName());
map.put("filePath", document.getFilePath());
list.add(new Document(vo.getContent(), map));
});
vectorStore.add(list);
document.setStatus(2);
this.updateById(document);
}
// 批量保存文档
boolean saveResult = this.saveBatch(knowledgeDocuments);
// if (saveResult) {
// // 异步进行向量化处理
// for (int i = 0; i < knowledgeDocuments.size(); i++) {
// KnowledgeDocument document = knowledgeDocuments.get(i);
// DocumentSegmentResult segmentResult = segmentResults.get(i);
//
// // 异步向量化
// vectorStoreService.vectorizeDocumentsAsync(
// knowledgeBaseId,
// document.getId(),
// List.of(segmentResult)
// );
//
// log.info("启动异步向量化处理: 文档ID={}, 文件名={}",
// document.getId(), segmentResult.getFileName());
// }
// }
return saveResult;
return true;
}
/**
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the thermal4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.ask.service.impl;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.amazonaws.services.s3.model.S3Object;
import com.ask.api.entity.SysFile;
import com.ask.common.core.FileTemplate;
import com.ask.common.core.R;
import com.ask.mapper.SysFileMapper;
import com.ask.service.SysFileService;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* 文件管理
*/
@Slf4j
@Service
@AllArgsConstructor
public class SysFileServiceImpl extends ServiceImpl<SysFileMapper, SysFile> implements SysFileService {
private final FileTemplate fileTemplate;
// private final FileProperties properties;
@Override
public R<List<SysFile>> multipartUpload(MultipartFile[] files,Long bucketName) {
List<SysFile> resultList = new ArrayList<>();
for (MultipartFile file : files) {
String fileName =IdUtil.simpleUUID();
if(StringUtils.isNotEmpty(FileUtil.extName(file.getOriginalFilename()))){
fileName= fileName + StrUtil.DOT + FileUtil.extName(file.getOriginalFilename());
}
SysFile sysFile = new SysFile();
sysFile.setFileName(fileName);
sysFile.setOriginal(file.getOriginalFilename());
sysFile.setFileSize(file.getSize());
sysFile.setType(FileUtil.extName(file.getOriginalFilename()));
sysFile.setBucketName(String.valueOf(bucketName));
try (InputStream inputStream = file.getInputStream()) {
fileTemplate.putObject(String.valueOf(bucketName), fileName, inputStream, file.getContentType());
// 文件管理数据记录,收集管理追踪文件
sysFile.setStatus(1);
}
catch (Exception e) {
sysFile.setStatus(0);
log.error("上传失败", e);
}
sysFile.setUrl(String.format("/admin/sys-file/%s/%s", String.valueOf(bucketName), fileName));
resultList.add(sysFile);
}
this.saveBatch(resultList);
return R.ok(resultList);
}
/**
* 读取文件
* @param bucket
* @param fileName
* @param response
*/
@Override
public void getFile(String bucket, String fileName, HttpServletResponse response) {
try (S3Object s3Object = fileTemplate.getObject(bucket, fileName)) {
response.setContentType("application/octet-stream; charset=UTF-8");
IoUtil.copy(s3Object.getObjectContent(), response.getOutputStream());
}
catch (Exception e) {
log.error("文件读取异常: {}", e.getLocalizedMessage());
}
}
/**
* 获取文件流
* @param fileName
* @return
*/
public InputStream getFileStream(String bruckName,String fileName) {
try {
// 获取 S3Object
S3Object s3Object = fileTemplate.getObject(bruckName,fileName);
return s3Object.getObjectContent();
} catch (Exception e) {
// 处理异常
log.error("文件读取异常: {}", e.getLocalizedMessage());
return null;
}
}
}
//package com.ask.service.impl;
//
//
//import com.ask.api.dto.DocumentSegmentResult;
//import com.ask.api.entity.KnowledgeDocument;
//import com.ask.service.KnowledgeDocumentService;
//import com.ask.service.VectorStoreService;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.ai.document.Document;
//import org.springframework.ai.embedding.EmbeddingModel;
//import org.springframework.ai.vectorstore.VectorStore;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Lazy;
//import org.springframework.scheduling.annotation.Async;
//import org.springframework.stereotype.Service;
//
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * 向量存储服务实现类
// *
// * @author ai
// * @date 2024/12/19
// */
//@Slf4j
//@Service
//public class VectorStoreServiceImpl implements VectorStoreService {
//
// private final VectorStore vectorStore;
// private final EmbeddingModel embeddingModel;
//
// @Autowired
// @Lazy
// private KnowledgeDocumentService knowledgeDocumentService;
//
// public VectorStoreServiceImpl(VectorStore vectorStore, EmbeddingModel embeddingModel) {
// this.vectorStore = vectorStore;
// this.embeddingModel = embeddingModel;
// }
//
// @Async("vectorizeExecutor")
// @Override
// public void vectorizeDocumentsAsync(Long knowledgeBaseId, Long documentId, List<DocumentSegmentResult> segmentResults) {
// try {
// log.info("开始异步向量化处理,知识库ID: {}, 文档ID: {}", knowledgeBaseId, documentId);
//
// // 更新文档状态为处理中
// KnowledgeDocument document = knowledgeDocumentService.getById(documentId);
// if (document != null) {
// document.setStatus(1); // 1-处理中
// knowledgeDocumentService.updateById(document);
// }
//
// List<Document> documents = new ArrayList<>();
//
// for (DocumentSegmentResult segmentResult : segmentResults) {
// if (segmentResult.getSegments() != null) {
// for (DocumentSegmentResult.DocumentSegment segment : segmentResult.getSegments()) {
// // 创建文档对象
// Document doc = new Document(segment.getContent());
//
// // 添加元数据
// Map<String, Object> metadata = new HashMap<>();
// metadata.put("knowledge_base_id", knowledgeBaseId);
// metadata.put("document_id", documentId);
// metadata.put("file_name", segmentResult.getFileName());
// metadata.put("segment_index", segment.getIndex());
// metadata.put("char_count", segment.getCharCount());
// metadata.put("token_count", segment.getTokenCount());
//
// doc.setMetadata(metadata);
// documents.add(doc);
// }
// }
// }
//
// // 批量向量化并存储
// if (!documents.isEmpty()) {
// vectorStore.add(documents);
// log.info("向量化完成,共处理 {} 个分段", documents.size());
//
// // 更新文档状态为处理完成
// if (document != null) {
// document.setStatus(2); // 2-处理完成
// knowledgeDocumentService.updateById(document);
// }
// }
//
// } catch (Exception e) {
// log.error("向量化处理失败,知识库ID: {}, 文档ID: {}, 错误: {}", knowledgeBaseId, documentId, e.getMessage(), e);
//
// // 更新文档状态为处理失败
// KnowledgeDocument document = knowledgeDocumentService.getById(documentId);
// if (document != null) {
// document.setStatus(3); // 3-处理失败
// knowledgeDocumentService.updateById(document);
// }
// }
// }
//
// @Override
// public void vectorizeDocument(Long knowledgeBaseId, Long documentId, DocumentSegmentResult segmentResult) {
// try {
// List<Document> documents = new ArrayList<>();
//
// if (segmentResult.getSegments() != null) {
// for (DocumentSegmentResult.DocumentSegment segment : segmentResult.getSegments()) {
// // 创建文档对象
// Document doc = new Document(segment.getContent());
//
// // 添加元数据
// Map<String, Object> metadata = new HashMap<>();
// metadata.put("knowledge_base_id", knowledgeBaseId);
// metadata.put("document_id", documentId);
// metadata.put("file_name", segmentResult.getFileName());
// metadata.put("segment_index", segment.getIndex());
// metadata.put("char_count", segment.getCharCount());
// metadata.put("token_count", segment.getTokenCount());
//
// doc.setMetadata(metadata);
// documents.add(doc);
// }
// }
//
// // 向量化并存储
// if (!documents.isEmpty()) {
// vectorStore.add(documents);
// log.info("单个文档向量化完成: {}, 分段数: {}", segmentResult.getFileName(), documents.size());
// }
//
// } catch (Exception e) {
// log.error("单个文档向量化失败,知识库ID: {}, 文档ID: {}, 文件名: {}, 错误: {}",
// knowledgeBaseId, documentId, segmentResult.getFileName(), e.getMessage(), e);
// }
// }
//}
\ No newline at end of file
artifactId=ask-data-ai-biz
groupId=com.ask
version=1.0.0-SNAPSHOT
com\ask\service\KnowledgeBaseService.class
com\ask\controller\ChatConversationController.class
com\ask\service\KnowledgeDocumentService.class
com\ask\config\PostgresChatMemoryDialect.class
com\ask\controller\KnowledgeDocumentController.class
com\ask\mapper\ChatConversationDetailMapper.class
com\ask\service\impl\ChatConversationServiceImpl.class
com\ask\service\ChatConversationService.class
com\ask\config\CommonConfiguration.class
com\ask\mapper\ChatConversationMapper.class
com\ask\service\impl\KnowledgeBaseServiceImpl.class
com\ask\service\impl\KnowledgeDocumentServiceImpl.class
com\ask\mapper\KnowledgeBaseMapper.class
com\ask\controller\ChatController.class
com\ask\controller\ChatConversationDetailController.class
com\ask\controller\KnowledgeBaseController.class
com\ask\mapper\KnowledgeDocumentMapper.class
com\ask\service\ChatConversationDetailService.class
com\ask\config\AsyncConfig.class
com\ask\service\impl\ChatConversationDetailServiceImpl.class
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\service\impl\KnowledgeBaseServiceImpl.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\config\CommonConfiguration.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\mapper\GenDatasourceConfMapper.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\service\GenDatasourceConfService.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\controller\KnowledgeBaseController.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\controller\ChatConversationDetailController.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\config\PostgresChatMemoryDialect.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\service\ChatConversationDetailService.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\controller\KnowledgeDocumentController.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\config\InitDataBase.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\mapper\GenTableMapper.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\service\impl\ChatConversationServiceImpl.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\mapper\ChatConversationMapper.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\service\KnowledgeDocumentService.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\service\impl\KnowledgeDocumentServiceImpl.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\mapper\KnowledgeDocumentMapper.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\config\AsyncConfig.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\service\ChatConversationService.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\service\GenTableService.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\mapper\ChatConversationDetailMapper.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\service\impl\GenDatasourceConfServiceImpl.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\service\VectorStoreService.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\service\impl\GenTableServiceImpl.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\controller\ChatConversationController.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\service\KnowledgeBaseService.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\service\impl\VectorStoreServiceImpl.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\service\impl\ChatConversationDetailServiceImpl.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\mapper\KnowledgeBaseMapper.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-biz\src\main\java\com\ask\controller\ChatController.java
......@@ -5,6 +5,13 @@ server:
spring:
application:
name: ask-data-ai
# 文件上传配置
servlet:
multipart:
enabled: true
max-file-size: 100MB # 单个文件最大大小
max-request-size: 500MB # 请求最大大小
file-size-threshold: 0 # 文件写入磁盘的阈值
datasource:
url: jdbc:postgresql://81.70.183.25:25432/ask_data_ai_db
username: postgres
......@@ -32,10 +39,10 @@ spring:
options:
model: qwen-plus
embedding:
base-url: https://dashscope.aliyuncs.com/compatible-mode
base-url: http://localhost:11434/api/embeddings
api-key: sk-ae96ff281ff644c992843c64a711a950
options:
model: text-embedding-v4
model: nomic-embed-text:latest
mybatis-plus:
mapper-locations: classpath*:/mapper/*Mapper.xml # mapper文件位置
......@@ -99,3 +106,8 @@ logging:
root: INFO
com.ask: DEBUG
# 本地文件系统
file:
local:
enable: true
base-path: D:/app/upFiles
\ No newline at end of file
......@@ -5,6 +5,13 @@ server:
spring:
application:
name: ask-data-ai
# 文件上传配置
servlet:
multipart:
enabled: true
max-file-size: 100MB # 单个文件最大大小
max-request-size: 500MB # 请求最大大小
file-size-threshold: 0 # 文件写入磁盘的阈值
datasource:
url: jdbc:postgresql://81.70.183.25:25432/ask_data_ai_db
username: postgres
......@@ -32,10 +39,10 @@ spring:
options:
model: qwen-plus
embedding:
base-url: https://dashscope.aliyuncs.com/compatible-mode
base-url: http://localhost:11434/api/embeddings
api-key: sk-ae96ff281ff644c992843c64a711a950
options:
model: text-embedding-v4
model: nomic-embed-text:latest
mybatis-plus:
mapper-locations: classpath*:/mapper/*Mapper.xml # mapper文件位置
......@@ -99,3 +106,8 @@ logging:
root: INFO
com.ask: DEBUG
# 本地文件系统
file:
local:
enable: true
base-path: D:/app/upFiles
\ No newline at end of file
artifactId=ask-data-ai-boot
groupId=com.ask
version=1.0.0-SNAPSHOT
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-boot\src\main\java\com\ask\AskDataAiApplication.java
......@@ -32,6 +32,11 @@
<!-- <artifactId>spring-cloud-commons</artifactId>-->
<!-- </dependency>-->
<!-- MyBatis Plus -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.11.543</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
......@@ -57,7 +62,11 @@
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.39</version>
</dependency>
<!-- FastJson -->
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
......
package com.ask.common.core;
import com.amazonaws.services.s3.model.Bucket;
import com.amazonaws.services.s3.model.S3Object;
import com.amazonaws.services.s3.model.S3ObjectSummary;
import org.springframework.beans.factory.InitializingBean;
import java.io.InputStream;
import java.util.List;
/**
* 文件操作模板
*/
public interface FileTemplate extends InitializingBean {
/**
* 创建bucket
* @param bucketName bucket名称
*/
void createBucket(String bucketName);
/**
* 获取全部bucket
* <p>
*
* API Documentation</a>
*/
List<Bucket> getAllBuckets();
/**
* @param bucketName bucket名称
* @see <a href= Documentation</a>
*/
void removeBucket(String bucketName);
/**
* 上传文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @param stream 文件流
* @param contextType 文件类型
* @throws Exception
*/
void putObject(String bucketName, String objectName, InputStream stream, String contextType) throws Exception;
/**
* 上传文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @param stream 文件流
* @throws Exception
*/
void putObject(String bucketName, String objectName, InputStream stream) throws Exception;
/**
* 获取文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @return 二进制流 API Documentation</a>
*/
S3Object getObject(String bucketName, String objectName);
void removeObject(String bucketName, String objectName) throws Exception;
/**
* @throws Exception
*/
@Override
default void afterPropertiesSet() throws Exception {
}
/**
* 根据文件前置查询文件
* @param bucketName bucket名称
* @param prefix 前缀
* @param recursive 是否递归查询
* @return S3ObjectSummary 列表
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjects">AWS
* API Documentation</a>
*/
List<S3ObjectSummary> getAllObjectsByPrefix(String bucketName, String prefix, boolean recursive);
}
package com.ask.common.factory;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.core.env.PropertiesPropertySource;
import org.springframework.core.env.PropertySource;
import org.springframework.core.io.support.EncodedResource;
import org.springframework.core.io.support.PropertySourceFactory;
import org.springframework.lang.Nullable;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
/**
* YAML属性源工厂类:用于读取自定义YAML文件并转换为属性源
*
* @author lengleng
* @date 2025/05/30
*/
public class YamlPropertySourceFactory implements PropertySourceFactory {
/**
* 创建属性源
* @param name 属性源名称,可为空
* @param resource 编码资源
* @return 属性源对象
* @throws IOException 读取资源时可能抛出IO异常
*/
@Override
public PropertySource<?> createPropertySource(@Nullable String name, EncodedResource resource) throws IOException {
Properties propertiesFromYaml = loadYamlIntoProperties(resource);
String sourceName = name != null ? name : resource.getResource().getFilename();
return new PropertiesPropertySource(sourceName, propertiesFromYaml);
}
/**
* 将YAML资源加载为Properties对象
* @param resource 编码后的资源对象
* @return 加载后的Properties对象
* @throws FileNotFoundException 当资源文件不存在时抛出
*/
private Properties loadYamlIntoProperties(EncodedResource resource) throws FileNotFoundException {
try {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(resource.getResource());
factory.afterPropertiesSet();
return factory.getObject();
}
catch (IllegalStateException e) {
Throwable cause = e.getCause();
if (cause instanceof FileNotFoundException) {
throw (FileNotFoundException) e.getCause();
}
throw e;
}
}
}
package com.ask.common.local;
import cn.hutool.core.io.FileUtil;
import com.amazonaws.services.s3.model.Bucket;
import com.amazonaws.services.s3.model.S3Object;
import com.amazonaws.services.s3.model.S3ObjectSummary;
import com.ask.common.core.FileTemplate;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import java.io.File;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* 本地文件读取模式
*/
@RequiredArgsConstructor
public class LocalFileTemplate implements FileTemplate {
private final String basePath;
/**
* 创建bucket
* @param bucketName bucket名称
*/
@Override
public void createBucket(String bucketName) {
FileUtil.mkdir(basePath + FileUtil.FILE_SEPARATOR + bucketName);
}
/**
* 获取全部bucket
* <p>
* <p>
* API Documentation</a>
*/
@Override
public List<Bucket> getAllBuckets() {
return Arrays.stream(FileUtil.ls(basePath))
.filter(FileUtil::isDirectory)
.map(dir -> new Bucket(dir.getName()))
.collect(Collectors.toList());
}
/**
* @param bucketName bucket名称
* @see <a href= Documentation</a>
*/
@Override
public void removeBucket(String bucketName) {
FileUtil.del(basePath + FileUtil.FILE_SEPARATOR + bucketName);
}
/**
* 上传文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @param stream 文件流
* @param contextType 文件类型
*/
@Override
public void putObject(String bucketName, String objectName, InputStream stream, String contextType) {
// 当 Bucket 不存在时创建
String dir = basePath + FileUtil.FILE_SEPARATOR + bucketName;
if (!FileUtil.isDirectory(basePath + FileUtil.FILE_SEPARATOR + bucketName)) {
createBucket(bucketName);
}
// 写入文件
File file = FileUtil.file(dir + FileUtil.FILE_SEPARATOR + objectName);
FileUtil.writeFromStream(stream, file);
}
/**
* 获取文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @return 二进制流 API Documentation</a>
*/
@Override
@SneakyThrows
public S3Object getObject(String bucketName, String objectName) {
String dir = basePath + FileUtil.FILE_SEPARATOR + bucketName;
S3Object s3Object = new S3Object();
s3Object.setObjectContent(FileUtil.getInputStream(dir + FileUtil.FILE_SEPARATOR + objectName));
return s3Object;
}
/**
* @param bucketName
* @param objectName
* @throws Exception
*/
@Override
public void removeObject(String bucketName, String objectName) throws Exception {
String dir = basePath + FileUtil.FILE_SEPARATOR + bucketName;
FileUtil.del(dir + FileUtil.FILE_SEPARATOR + objectName);
}
/**
* 上传文件
* @param bucketName bucket名称
* @param objectName 文件名称
* @param stream 文件流
* @throws Exception
*/
@Override
public void putObject(String bucketName, String objectName, InputStream stream) throws Exception {
putObject(bucketName, objectName, stream, null);
}
/**
* 根据文件前置查询文件
* @param bucketName bucket名称
* @param prefix 前缀
* @param recursive 是否递归查询
* @return S3ObjectSummary 列表
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjects">AWS
* API Documentation</a>
*/
@Override
public List<S3ObjectSummary> getAllObjectsByPrefix(String bucketName, String prefix, boolean recursive) {
String dir = basePath + FileUtil.FILE_SEPARATOR + bucketName;
return Arrays.stream(FileUtil.ls(dir)).filter(file -> file.getName().startsWith(prefix)).map(file -> {
S3ObjectSummary summary = new S3ObjectSummary();
summary.setKey(file.getName());
return new S3ObjectSummary();
}).collect(Collectors.toList());
}
}
......@@ -6,6 +6,7 @@
//import org.apache.ibatis.type.MappedJdbcTypes;
//import org.apache.ibatis.type.MappedTypes;
//
//
//import java.sql.CallableStatement;
//import java.sql.PreparedStatement;
//import java.sql.ResultSet;
......@@ -57,7 +58,7 @@
// }
//
// private Object parse(String json) {
// if (json == null) {
// if (json == null || json.trim().isEmpty()) {
// return null;
// }
// try {
......
artifactId=ask-data-ai-common
groupId=com.ask
version=1.0.0-SNAPSHOT
com\ask\common\config\CorsConfig.class
com\ask\common\config\MybatisPlusConfig.class
com\ask\common\core\R.class
com\ask\common\factory\YamlPropertySourceFactory.class
com\ask\common\mybatis\handler\MybatisMetaObjectHandler.class
com\ask\common\base\BaseEntity.class
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-common\src\main\java\com\ask\common\core\R.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-common\src\main\java\com\ask\common\mybatis\handler\MybatisMetaObjectHandler.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-common\src\main\java\com\ask\common\config\MybatisPlusConfig.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-common\src\main\java\com\ask\common\factory\YamlPropertySourceFactory.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-common\src\main\java\com\ask\common\mybatis\handler\JsonTypeHandler.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-common\src\main\java\com\ask\common\config\CorsConfig.java
D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-common\src\main\java\com\ask\common\base\BaseEntity.java
......@@ -1059,3 +1059,558 @@ java.lang.IllegalArgumentException: When allowCredentials is true, allowedOrigin
at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
at java.base/java.lang.Thread.run(Thread.java:840)
2025-07-14 17:44:55.174 [XNIO-1 task-5] INFO org.springdoc.api.AbstractOpenApiResource:390 - Init duration for springdoc-openapi is: 261 ms
2025-07-14 17:45:13.288 [XNIO-1 task-5] WARN o.s.w.s.m.support.DefaultHandlerExceptionResolver:247 - Resolved [org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.lang.Long'; For input string: "generate-cookie"]
2025-07-14 17:45:25.285 [XNIO-1 task-5] ERROR io.undertow.request:80 - UT005023: Exception handling request to /admin/chat/ai/create/client
java.lang.IllegalArgumentException: When allowCredentials is true, allowedOrigins cannot contain the special value "*" since that cannot be set on the "Access-Control-Allow-Origin" response header. To allow credentials to a set of origins, list them explicitly or consider using "allowedOriginPatterns" instead.
at org.springframework.web.cors.CorsConfiguration.validateAllowCredentials(CorsConfiguration.java:538)
at org.springframework.web.cors.CorsConfiguration.checkOrigin(CorsConfiguration.java:642)
at org.springframework.web.cors.DefaultCorsProcessor.checkOrigin(DefaultCorsProcessor.java:173)
at org.springframework.web.cors.DefaultCorsProcessor.handleInternal(DefaultCorsProcessor.java:115)
at org.springframework.web.cors.DefaultCorsProcessor.processRequest(DefaultCorsProcessor.java:94)
at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:87)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.ServerHttpObservationFilter.doFilterInternal(ServerHttpObservationFilter.java:109)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:117)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:276)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:132)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:256)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:101)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
at java.base/java.lang.Thread.run(Thread.java:840)
2025-07-14 17:45:31.599 [XNIO-1 task-5] ERROR io.undertow.request:80 - UT005023: Exception handling request to /admin/chat/ai/chat
java.lang.IllegalArgumentException: When allowCredentials is true, allowedOrigins cannot contain the special value "*" since that cannot be set on the "Access-Control-Allow-Origin" response header. To allow credentials to a set of origins, list them explicitly or consider using "allowedOriginPatterns" instead.
at org.springframework.web.cors.CorsConfiguration.validateAllowCredentials(CorsConfiguration.java:538)
at org.springframework.web.cors.CorsConfiguration.checkOrigin(CorsConfiguration.java:642)
at org.springframework.web.cors.DefaultCorsProcessor.checkOrigin(DefaultCorsProcessor.java:173)
at org.springframework.web.cors.DefaultCorsProcessor.handleInternal(DefaultCorsProcessor.java:115)
at org.springframework.web.cors.DefaultCorsProcessor.processRequest(DefaultCorsProcessor.java:94)
at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:87)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.ServerHttpObservationFilter.doFilterInternal(ServerHttpObservationFilter.java:109)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:117)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:276)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:132)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:256)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:101)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
at java.base/java.lang.Thread.run(Thread.java:840)
2025-07-14 17:45:52.558 [XNIO-1 task-5] ERROR io.undertow.request:80 - UT005023: Exception handling request to /admin/chat/ai/create/client
java.lang.IllegalArgumentException: When allowCredentials is true, allowedOrigins cannot contain the special value "*" since that cannot be set on the "Access-Control-Allow-Origin" response header. To allow credentials to a set of origins, list them explicitly or consider using "allowedOriginPatterns" instead.
at org.springframework.web.cors.CorsConfiguration.validateAllowCredentials(CorsConfiguration.java:538)
at org.springframework.web.cors.CorsConfiguration.checkOrigin(CorsConfiguration.java:642)
at org.springframework.web.cors.DefaultCorsProcessor.checkOrigin(DefaultCorsProcessor.java:173)
at org.springframework.web.cors.DefaultCorsProcessor.handleInternal(DefaultCorsProcessor.java:115)
at org.springframework.web.cors.DefaultCorsProcessor.processRequest(DefaultCorsProcessor.java:94)
at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:87)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.ServerHttpObservationFilter.doFilterInternal(ServerHttpObservationFilter.java:109)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:117)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:276)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:132)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:256)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:101)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
at java.base/java.lang.Thread.run(Thread.java:840)
2025-07-14 17:47:21.207 [SpringApplicationShutdownHook] INFO io.undertow:259 - stopping server: Undertow - 2.3.10.Final
2025-07-14 17:47:21.212 [SpringApplicationShutdownHook] INFO io.undertow.servlet:372 - Destroying Spring FrameworkServlet 'dispatcherServlet'
2025-07-14 17:47:21.212 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource:350 - HikariPool-1 - Shutdown initiated...
2025-07-14 17:47:21.218 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource:352 - HikariPool-1 - Shutdown completed.
2025-07-14 17:47:24.940 [background-preinit] INFO org.hibernate.validator.internal.util.Version:21 - HV000001: Hibernate Validator 8.0.1.Final
2025-07-14 17:47:24.965 [main] INFO com.ask.AskDataAiApplication:50 - Starting AskDataAiApplication using Java 17.0.15 with PID 28104 (D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-boot\target\classes started by 11523 in D:\java\ask_data_ai\pig-master\ask-data-ai)
2025-07-14 17:47:24.970 [main] DEBUG com.ask.AskDataAiApplication:51 - Running with Spring Boot v3.2.1, Spring v6.1.2
2025-07-14 17:47:24.970 [main] INFO com.ask.AskDataAiApplication:662 - No active profile set, falling back to 1 default profile: "default"
2025-07-14 17:47:26.307 [main] WARN io.undertow.websockets.jsr:68 - UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2025-07-14 17:47:26.324 [main] INFO io.undertow.servlet:372 - Initializing Spring embedded WebApplicationContext
2025-07-14 17:47:26.325 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext:296 - Root WebApplicationContext: initialization completed in 1326 ms
2025-07-14 17:47:26.815 [main] INFO com.zaxxer.hikari.HikariDataSource:110 - HikariPool-1 - Starting...
2025-07-14 17:47:27.293 [main] INFO com.zaxxer.hikari.pool.HikariPool:565 - HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@2270f58d
2025-07-14 17:47:27.295 [main] INFO com.zaxxer.hikari.HikariDataSource:123 - HikariPool-1 - Start completed.
2025-07-14 17:47:27.304 [main] WARN o.s.a.c.m.r.jdbc.JdbcChatMemoryRepository$Builder:242 - Explicitly set dialect PostgresChatMemoryDialect will be used instead of detected dialect PostgresChatMemoryRepositoryDialect from datasource
2025-07-14 17:47:27.740 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:229 - Using the vector table name: ask_vector_store. Is empty: false
2025-07-14 17:47:27.743 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:410 - Initializing PGVectorStore schema for table: ask_vector_store in schema: public
2025-07-14 17:47:27.743 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:413 - vectorTableValidationsEnabled false
2025-07-14 17:47:28.750 [main] INFO o.s.b.actuate.endpoint.web.EndpointLinksResolver:58 - Exposing 1 endpoint(s) beneath base path '/actuator'
2025-07-14 17:47:28.821 [main] INFO io.undertow:120 - starting server: Undertow - 2.3.10.Final
2025-07-14 17:47:28.831 [main] INFO org.xnio:95 - XNIO version 3.8.8.Final
2025-07-14 17:47:28.838 [main] INFO org.xnio.nio:58 - XNIO NIO Implementation Version 3.8.8.Final
2025-07-14 17:47:28.860 [main] INFO org.jboss.threads:55 - JBoss Threads version 3.5.0.Final
2025-07-14 17:47:28.903 [main] INFO o.s.boot.web.embedded.undertow.UndertowWebServer:121 - Undertow started on port 9999 (http) with context path '/admin'
2025-07-14 17:47:28.915 [main] INFO com.ask.AskDataAiApplication:56 - Started AskDataAiApplication in 4.31 seconds (process running for 4.771)
2025-07-14 17:47:29.303 [RMI TCP Connection(1)-192.168.156.117] INFO io.undertow.servlet:372 - Initializing Spring DispatcherServlet 'dispatcherServlet'
2025-07-14 17:47:29.304 [RMI TCP Connection(1)-192.168.156.117] INFO org.springframework.web.servlet.DispatcherServlet:532 - Initializing Servlet 'dispatcherServlet'
2025-07-14 17:47:29.306 [RMI TCP Connection(1)-192.168.156.117] INFO org.springframework.web.servlet.DispatcherServlet:554 - Completed initialization in 2 ms
2025-07-14 17:48:08.699 [SpringApplicationShutdownHook] INFO io.undertow:259 - stopping server: Undertow - 2.3.10.Final
2025-07-14 17:48:08.705 [SpringApplicationShutdownHook] INFO io.undertow.servlet:372 - Destroying Spring FrameworkServlet 'dispatcherServlet'
2025-07-14 17:48:08.710 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource:350 - HikariPool-1 - Shutdown initiated...
2025-07-14 17:48:08.712 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource:352 - HikariPool-1 - Shutdown completed.
2025-07-14 17:50:27.483 [background-preinit] INFO org.hibernate.validator.internal.util.Version:21 - HV000001: Hibernate Validator 8.0.1.Final
2025-07-14 17:50:27.511 [main] INFO com.ask.AskDataAiApplication:50 - Starting AskDataAiApplication using Java 17.0.15 with PID 10688 (D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-boot\target\classes started by 11523 in D:\java\ask_data_ai\pig-master\ask-data-ai)
2025-07-14 17:50:27.511 [main] DEBUG com.ask.AskDataAiApplication:51 - Running with Spring Boot v3.2.1, Spring v6.1.2
2025-07-14 17:50:27.511 [main] INFO com.ask.AskDataAiApplication:662 - No active profile set, falling back to 1 default profile: "default"
2025-07-14 17:50:28.902 [main] WARN io.undertow.websockets.jsr:68 - UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2025-07-14 17:50:28.918 [main] INFO io.undertow.servlet:372 - Initializing Spring embedded WebApplicationContext
2025-07-14 17:50:28.919 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext:296 - Root WebApplicationContext: initialization completed in 1377 ms
2025-07-14 17:50:29.441 [main] INFO com.zaxxer.hikari.HikariDataSource:110 - HikariPool-1 - Starting...
2025-07-14 17:50:29.895 [main] INFO com.zaxxer.hikari.pool.HikariPool:565 - HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@543ac221
2025-07-14 17:50:29.897 [main] INFO com.zaxxer.hikari.HikariDataSource:123 - HikariPool-1 - Start completed.
2025-07-14 17:50:29.905 [main] WARN o.s.a.c.m.r.jdbc.JdbcChatMemoryRepository$Builder:242 - Explicitly set dialect PostgresChatMemoryDialect will be used instead of detected dialect PostgresChatMemoryRepositoryDialect from datasource
2025-07-14 17:50:30.363 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:229 - Using the vector table name: ask_vector_store. Is empty: false
2025-07-14 17:50:30.366 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:410 - Initializing PGVectorStore schema for table: ask_vector_store in schema: public
2025-07-14 17:50:30.367 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:413 - vectorTableValidationsEnabled false
2025-07-14 17:50:31.360 [main] INFO o.s.b.actuate.endpoint.web.EndpointLinksResolver:58 - Exposing 1 endpoint(s) beneath base path '/actuator'
2025-07-14 17:50:31.426 [main] INFO io.undertow:120 - starting server: Undertow - 2.3.10.Final
2025-07-14 17:50:31.433 [main] INFO org.xnio:95 - XNIO version 3.8.8.Final
2025-07-14 17:50:31.439 [main] INFO org.xnio.nio:58 - XNIO NIO Implementation Version 3.8.8.Final
2025-07-14 17:50:31.464 [main] INFO org.jboss.threads:55 - JBoss Threads version 3.5.0.Final
2025-07-14 17:50:31.507 [main] INFO o.s.boot.web.embedded.undertow.UndertowWebServer:121 - Undertow started on port 9999 (http) with context path '/admin'
2025-07-14 17:50:31.518 [main] INFO com.ask.AskDataAiApplication:56 - Started AskDataAiApplication in 4.358 seconds (process running for 4.798)
2025-07-14 17:50:31.889 [RMI TCP Connection(1)-192.168.156.117] INFO io.undertow.servlet:372 - Initializing Spring DispatcherServlet 'dispatcherServlet'
2025-07-14 17:50:31.890 [RMI TCP Connection(1)-192.168.156.117] INFO org.springframework.web.servlet.DispatcherServlet:532 - Initializing Servlet 'dispatcherServlet'
2025-07-14 17:50:31.891 [RMI TCP Connection(1)-192.168.156.117] INFO org.springframework.web.servlet.DispatcherServlet:554 - Completed initialization in 1 ms
2025-07-14 17:50:35.294 [XNIO-1 task-2] INFO org.springdoc.api.AbstractOpenApiResource:390 - Init duration for springdoc-openapi is: 297 ms
2025-07-14 17:56:45.814 [XNIO-1 task-2] WARN o.s.w.s.m.support.DefaultHandlerExceptionResolver:247 - Resolved [org.springframework.web.bind.MissingRequestCookieException: Required cookie 'userId' for method parameter type Long is not present]
2025-07-14 17:57:44.944 [XNIO-1 task-2] WARN o.s.w.s.m.support.DefaultHandlerExceptionResolver:247 - Resolved [org.springframework.web.bind.MissingRequestCookieException: Required cookie 'userId' for method parameter type Long is not present]
2025-07-14 17:58:30.254 [XNIO-1 task-2] WARN o.s.w.s.m.support.DefaultHandlerExceptionResolver:247 - Resolved [org.springframework.web.bind.MissingRequestCookieException: Required cookie 'userId' for method parameter type Long is not present]
2025-07-14 17:58:42.649 [XNIO-1 task-2] WARN o.s.w.s.m.support.DefaultHandlerExceptionResolver:247 - Resolved [org.springframework.web.bind.MissingRequestCookieException: Required cookie 'userId' for method parameter type Long is not present]
2025-07-14 17:59:32.023 [XNIO-1 task-2] WARN o.s.w.s.m.support.DefaultHandlerExceptionResolver:247 - Resolved [org.springframework.web.bind.MissingServletRequestParameterException: Required request parameter 'conversationId' for method parameter type String is not present]
2025-07-14 18:00:25.944 [XNIO-1 task-2] WARN o.s.w.s.m.support.DefaultHandlerExceptionResolver:247 - Resolved [org.springframework.web.bind.MissingRequestCookieException: Required cookie 'userId' for method parameter type Long is not present]
2025-07-14 18:03:23.480 [SpringApplicationShutdownHook] INFO io.undertow:259 - stopping server: Undertow - 2.3.10.Final
2025-07-14 18:03:23.485 [SpringApplicationShutdownHook] INFO io.undertow.servlet:372 - Destroying Spring FrameworkServlet 'dispatcherServlet'
2025-07-14 18:03:23.490 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource:350 - HikariPool-1 - Shutdown initiated...
2025-07-14 18:03:23.490 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource:352 - HikariPool-1 - Shutdown completed.
2025-07-14 18:03:28.961 [background-preinit] INFO org.hibernate.validator.internal.util.Version:21 - HV000001: Hibernate Validator 8.0.1.Final
2025-07-14 18:03:28.987 [main] INFO com.ask.AskDataAiApplication:50 - Starting AskDataAiApplication using Java 17.0.15 with PID 19612 (D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-boot\target\classes started by 11523 in D:\java\ask_data_ai\pig-master\ask-data-ai)
2025-07-14 18:03:28.987 [main] DEBUG com.ask.AskDataAiApplication:51 - Running with Spring Boot v3.2.1, Spring v6.1.2
2025-07-14 18:03:28.987 [main] INFO com.ask.AskDataAiApplication:662 - No active profile set, falling back to 1 default profile: "default"
2025-07-14 18:03:30.424 [main] WARN io.undertow.websockets.jsr:68 - UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2025-07-14 18:03:30.440 [main] INFO io.undertow.servlet:372 - Initializing Spring embedded WebApplicationContext
2025-07-14 18:03:30.441 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext:296 - Root WebApplicationContext: initialization completed in 1424 ms
2025-07-14 18:03:30.927 [main] INFO com.zaxxer.hikari.HikariDataSource:110 - HikariPool-1 - Starting...
2025-07-14 18:03:31.355 [main] INFO com.zaxxer.hikari.pool.HikariPool:565 - HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@56da8847
2025-07-14 18:03:31.357 [main] INFO com.zaxxer.hikari.HikariDataSource:123 - HikariPool-1 - Start completed.
2025-07-14 18:03:31.365 [main] WARN o.s.a.c.m.r.jdbc.JdbcChatMemoryRepository$Builder:242 - Explicitly set dialect PostgresChatMemoryDialect will be used instead of detected dialect PostgresChatMemoryRepositoryDialect from datasource
2025-07-14 18:03:31.796 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:229 - Using the vector table name: ask_vector_store. Is empty: false
2025-07-14 18:03:31.798 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:410 - Initializing PGVectorStore schema for table: ask_vector_store in schema: public
2025-07-14 18:03:31.799 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:413 - vectorTableValidationsEnabled false
2025-07-14 18:03:32.833 [main] INFO o.s.b.actuate.endpoint.web.EndpointLinksResolver:58 - Exposing 1 endpoint(s) beneath base path '/actuator'
2025-07-14 18:03:32.909 [main] INFO io.undertow:120 - starting server: Undertow - 2.3.10.Final
2025-07-14 18:03:32.916 [main] INFO org.xnio:95 - XNIO version 3.8.8.Final
2025-07-14 18:03:32.923 [main] INFO org.xnio.nio:58 - XNIO NIO Implementation Version 3.8.8.Final
2025-07-14 18:03:32.947 [main] INFO org.jboss.threads:55 - JBoss Threads version 3.5.0.Final
2025-07-14 18:03:32.985 [main] INFO o.s.boot.web.embedded.undertow.UndertowWebServer:121 - Undertow started on port 9999 (http) with context path '/admin'
2025-07-14 18:03:32.996 [main] INFO com.ask.AskDataAiApplication:56 - Started AskDataAiApplication in 4.371 seconds (process running for 4.824)
2025-07-14 18:03:33.390 [RMI TCP Connection(2)-192.168.156.117] INFO io.undertow.servlet:372 - Initializing Spring DispatcherServlet 'dispatcherServlet'
2025-07-14 18:03:33.391 [RMI TCP Connection(2)-192.168.156.117] INFO org.springframework.web.servlet.DispatcherServlet:532 - Initializing Servlet 'dispatcherServlet'
2025-07-14 18:03:33.392 [RMI TCP Connection(2)-192.168.156.117] INFO org.springframework.web.servlet.DispatcherServlet:554 - Completed initialization in 1 ms
2025-07-14 18:03:38.627 [XNIO-1 task-2] DEBUG com.ask.mapper.ChatConversationMapper.insert:135 - ==> Preparing: INSERT INTO ask_chat_conversation ( conversation_id, title, agent_id, user_id, create_by, create_time, update_by, update_time ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ? )
2025-07-14 18:03:38.640 [XNIO-1 task-2] DEBUG com.ask.mapper.ChatConversationMapper.insert:135 - ==> Parameters: 9d8dd23b2b6641d09189c3814a840275(String), 新建会话窗口(String), 1(Integer), 1752507975261(Long), admin(String), 2025-07-14T18:03:38.591610900(LocalDateTime), admin(String), 2025-07-14T18:03:38.591610900(LocalDateTime)
2025-07-14 18:03:38.683 [XNIO-1 task-2] DEBUG com.ask.mapper.ChatConversationMapper.insert:135 - <== Updates: 1
2025-07-14 18:05:12.560 [SpringApplicationShutdownHook] INFO io.undertow:259 - stopping server: Undertow - 2.3.10.Final
2025-07-14 18:05:12.564 [SpringApplicationShutdownHook] INFO io.undertow.servlet:372 - Destroying Spring FrameworkServlet 'dispatcherServlet'
2025-07-14 18:05:12.569 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource:350 - HikariPool-1 - Shutdown initiated...
2025-07-14 18:05:12.571 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource:352 - HikariPool-1 - Shutdown completed.
2025-07-14 18:05:15.919 [background-preinit] INFO org.hibernate.validator.internal.util.Version:21 - HV000001: Hibernate Validator 8.0.1.Final
2025-07-14 18:05:15.945 [main] INFO com.ask.AskDataAiApplication:50 - Starting AskDataAiApplication using Java 17.0.15 with PID 17004 (D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-boot\target\classes started by 11523 in D:\java\ask_data_ai\pig-master\ask-data-ai)
2025-07-14 18:05:15.947 [main] DEBUG com.ask.AskDataAiApplication:51 - Running with Spring Boot v3.2.1, Spring v6.1.2
2025-07-14 18:05:15.947 [main] INFO com.ask.AskDataAiApplication:662 - No active profile set, falling back to 1 default profile: "default"
2025-07-14 18:05:17.296 [main] WARN io.undertow.websockets.jsr:68 - UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2025-07-14 18:05:17.312 [main] INFO io.undertow.servlet:372 - Initializing Spring embedded WebApplicationContext
2025-07-14 18:05:17.312 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext:296 - Root WebApplicationContext: initialization completed in 1334 ms
2025-07-14 18:05:17.796 [main] INFO com.zaxxer.hikari.HikariDataSource:110 - HikariPool-1 - Starting...
2025-07-14 18:05:19.189 [main] INFO com.zaxxer.hikari.pool.HikariPool:565 - HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@cef885d
2025-07-14 18:05:19.190 [main] INFO com.zaxxer.hikari.HikariDataSource:123 - HikariPool-1 - Start completed.
2025-07-14 18:05:19.199 [main] WARN o.s.a.c.m.r.jdbc.JdbcChatMemoryRepository$Builder:242 - Explicitly set dialect PostgresChatMemoryDialect will be used instead of detected dialect PostgresChatMemoryRepositoryDialect from datasource
2025-07-14 18:05:19.606 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:229 - Using the vector table name: ask_vector_store. Is empty: false
2025-07-14 18:05:19.609 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:410 - Initializing PGVectorStore schema for table: ask_vector_store in schema: public
2025-07-14 18:05:19.609 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:413 - vectorTableValidationsEnabled false
2025-07-14 18:05:20.608 [main] INFO o.s.b.actuate.endpoint.web.EndpointLinksResolver:58 - Exposing 1 endpoint(s) beneath base path '/actuator'
2025-07-14 18:05:20.680 [main] INFO io.undertow:120 - starting server: Undertow - 2.3.10.Final
2025-07-14 18:05:20.687 [main] INFO org.xnio:95 - XNIO version 3.8.8.Final
2025-07-14 18:05:20.695 [main] INFO org.xnio.nio:58 - XNIO NIO Implementation Version 3.8.8.Final
2025-07-14 18:05:20.717 [main] INFO org.jboss.threads:55 - JBoss Threads version 3.5.0.Final
2025-07-14 18:05:20.765 [main] INFO o.s.boot.web.embedded.undertow.UndertowWebServer:121 - Undertow started on port 9999 (http) with context path '/admin'
2025-07-14 18:05:20.777 [main] INFO com.ask.AskDataAiApplication:56 - Started AskDataAiApplication in 5.187 seconds (process running for 5.626)
2025-07-14 18:05:21.356 [RMI TCP Connection(1)-192.168.156.117] INFO io.undertow.servlet:372 - Initializing Spring DispatcherServlet 'dispatcherServlet'
2025-07-14 18:05:21.356 [RMI TCP Connection(1)-192.168.156.117] INFO org.springframework.web.servlet.DispatcherServlet:532 - Initializing Servlet 'dispatcherServlet'
2025-07-14 18:05:21.358 [RMI TCP Connection(1)-192.168.156.117] INFO org.springframework.web.servlet.DispatcherServlet:554 - Completed initialization in 2 ms
2025-07-14 18:05:21.704 [XNIO-1 task-2] WARN o.s.w.s.m.support.DefaultHandlerExceptionResolver:247 - Resolved [org.springframework.web.bind.MissingRequestCookieException: Required cookie 'userId' for method parameter type Long is not present]
2025-07-14 18:05:57.958 [XNIO-1 task-2] WARN o.s.w.s.m.support.DefaultHandlerExceptionResolver:247 - Resolved [org.springframework.web.bind.MissingRequestCookieException: Required cookie 'userId' for method parameter type Long is not present]
2025-07-14 18:06:01.338 [SpringApplicationShutdownHook] INFO io.undertow:259 - stopping server: Undertow - 2.3.10.Final
2025-07-14 18:06:01.349 [SpringApplicationShutdownHook] INFO io.undertow.servlet:372 - Destroying Spring FrameworkServlet 'dispatcherServlet'
2025-07-14 18:06:01.359 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource:350 - HikariPool-1 - Shutdown initiated...
2025-07-14 18:06:01.370 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource:352 - HikariPool-1 - Shutdown completed.
2025-07-14 18:06:06.583 [background-preinit] INFO org.hibernate.validator.internal.util.Version:21 - HV000001: Hibernate Validator 8.0.1.Final
2025-07-14 18:06:06.616 [main] INFO com.ask.AskDataAiApplication:50 - Starting AskDataAiApplication using Java 17.0.15 with PID 29464 (D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-boot\target\classes started by 11523 in D:\java\ask_data_ai\pig-master\ask-data-ai)
2025-07-14 18:06:06.616 [main] DEBUG com.ask.AskDataAiApplication:51 - Running with Spring Boot v3.2.1, Spring v6.1.2
2025-07-14 18:06:06.616 [main] INFO com.ask.AskDataAiApplication:662 - No active profile set, falling back to 1 default profile: "default"
2025-07-14 18:06:08.130 [main] WARN io.undertow.websockets.jsr:68 - UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2025-07-14 18:06:08.147 [main] INFO io.undertow.servlet:372 - Initializing Spring embedded WebApplicationContext
2025-07-14 18:06:08.149 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext:296 - Root WebApplicationContext: initialization completed in 1505 ms
2025-07-14 18:06:08.661 [main] INFO com.zaxxer.hikari.HikariDataSource:110 - HikariPool-1 - Starting...
2025-07-14 18:06:09.026 [main] INFO com.zaxxer.hikari.pool.HikariPool:565 - HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@3c62be3c
2025-07-14 18:06:09.028 [main] INFO com.zaxxer.hikari.HikariDataSource:123 - HikariPool-1 - Start completed.
2025-07-14 18:06:09.040 [main] WARN o.s.a.c.m.r.jdbc.JdbcChatMemoryRepository$Builder:242 - Explicitly set dialect PostgresChatMemoryDialect will be used instead of detected dialect PostgresChatMemoryRepositoryDialect from datasource
2025-07-14 18:06:09.480 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:229 - Using the vector table name: ask_vector_store. Is empty: false
2025-07-14 18:06:09.483 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:410 - Initializing PGVectorStore schema for table: ask_vector_store in schema: public
2025-07-14 18:06:09.483 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:413 - vectorTableValidationsEnabled false
2025-07-14 18:06:10.497 [main] INFO o.s.b.actuate.endpoint.web.EndpointLinksResolver:58 - Exposing 1 endpoint(s) beneath base path '/actuator'
2025-07-14 18:06:10.571 [main] INFO io.undertow:120 - starting server: Undertow - 2.3.10.Final
2025-07-14 18:06:10.580 [main] INFO org.xnio:95 - XNIO version 3.8.8.Final
2025-07-14 18:06:10.587 [main] INFO org.xnio.nio:58 - XNIO NIO Implementation Version 3.8.8.Final
2025-07-14 18:06:10.612 [main] INFO org.jboss.threads:55 - JBoss Threads version 3.5.0.Final
2025-07-14 18:06:10.663 [main] INFO o.s.boot.web.embedded.undertow.UndertowWebServer:121 - Undertow started on port 9999 (http) with context path '/admin'
2025-07-14 18:06:10.680 [main] INFO com.ask.AskDataAiApplication:56 - Started AskDataAiApplication in 4.425 seconds (process running for 4.87)
2025-07-14 18:06:11.062 [RMI TCP Connection(3)-192.168.156.117] INFO io.undertow.servlet:372 - Initializing Spring DispatcherServlet 'dispatcherServlet'
2025-07-14 18:06:11.063 [RMI TCP Connection(3)-192.168.156.117] INFO org.springframework.web.servlet.DispatcherServlet:532 - Initializing Servlet 'dispatcherServlet'
2025-07-14 18:06:11.065 [RMI TCP Connection(3)-192.168.156.117] INFO org.springframework.web.servlet.DispatcherServlet:554 - Completed initialization in 1 ms
2025-07-14 18:06:55.971 [SpringApplicationShutdownHook] INFO io.undertow:259 - stopping server: Undertow - 2.3.10.Final
2025-07-14 18:06:55.974 [SpringApplicationShutdownHook] INFO io.undertow.servlet:372 - Destroying Spring FrameworkServlet 'dispatcherServlet'
2025-07-14 18:06:55.974 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource:350 - HikariPool-1 - Shutdown initiated...
2025-07-14 18:06:55.995 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource:352 - HikariPool-1 - Shutdown completed.
2025-07-14 18:06:59.480 [background-preinit] INFO org.hibernate.validator.internal.util.Version:21 - HV000001: Hibernate Validator 8.0.1.Final
2025-07-14 18:06:59.506 [main] INFO com.ask.AskDataAiApplication:50 - Starting AskDataAiApplication using Java 17.0.15 with PID 21032 (D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-boot\target\classes started by 11523 in D:\java\ask_data_ai\pig-master\ask-data-ai)
2025-07-14 18:06:59.506 [main] DEBUG com.ask.AskDataAiApplication:51 - Running with Spring Boot v3.2.1, Spring v6.1.2
2025-07-14 18:06:59.506 [main] INFO com.ask.AskDataAiApplication:662 - No active profile set, falling back to 1 default profile: "default"
2025-07-14 18:07:00.985 [main] WARN io.undertow.websockets.jsr:68 - UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2025-07-14 18:07:01.000 [main] INFO io.undertow.servlet:372 - Initializing Spring embedded WebApplicationContext
2025-07-14 18:07:01.001 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext:296 - Root WebApplicationContext: initialization completed in 1459 ms
2025-07-14 18:07:01.544 [main] INFO com.zaxxer.hikari.HikariDataSource:110 - HikariPool-1 - Starting...
2025-07-14 18:07:01.926 [main] INFO com.zaxxer.hikari.pool.HikariPool:565 - HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@25f14e93
2025-07-14 18:07:01.928 [main] INFO com.zaxxer.hikari.HikariDataSource:123 - HikariPool-1 - Start completed.
2025-07-14 18:07:01.937 [main] WARN o.s.a.c.m.r.jdbc.JdbcChatMemoryRepository$Builder:242 - Explicitly set dialect PostgresChatMemoryDialect will be used instead of detected dialect PostgresChatMemoryRepositoryDialect from datasource
2025-07-14 18:07:02.406 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:229 - Using the vector table name: ask_vector_store. Is empty: false
2025-07-14 18:07:02.409 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:410 - Initializing PGVectorStore schema for table: ask_vector_store in schema: public
2025-07-14 18:07:02.409 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:413 - vectorTableValidationsEnabled false
2025-07-14 18:07:03.470 [main] INFO o.s.b.actuate.endpoint.web.EndpointLinksResolver:58 - Exposing 1 endpoint(s) beneath base path '/actuator'
2025-07-14 18:07:03.541 [main] INFO io.undertow:120 - starting server: Undertow - 2.3.10.Final
2025-07-14 18:07:03.547 [main] INFO org.xnio:95 - XNIO version 3.8.8.Final
2025-07-14 18:07:03.554 [main] INFO org.xnio.nio:58 - XNIO NIO Implementation Version 3.8.8.Final
2025-07-14 18:07:03.576 [main] INFO org.jboss.threads:55 - JBoss Threads version 3.5.0.Final
2025-07-14 18:07:03.626 [main] INFO o.s.boot.web.embedded.undertow.UndertowWebServer:121 - Undertow started on port 9999 (http) with context path '/admin'
2025-07-14 18:07:03.639 [main] INFO com.ask.AskDataAiApplication:56 - Started AskDataAiApplication in 4.5 seconds (process running for 4.962)
2025-07-14 18:07:03.877 [RMI TCP Connection(2)-192.168.156.117] INFO io.undertow.servlet:372 - Initializing Spring DispatcherServlet 'dispatcherServlet'
2025-07-14 18:07:03.877 [RMI TCP Connection(2)-192.168.156.117] INFO org.springframework.web.servlet.DispatcherServlet:532 - Initializing Servlet 'dispatcherServlet'
2025-07-14 18:07:03.879 [RMI TCP Connection(2)-192.168.156.117] INFO org.springframework.web.servlet.DispatcherServlet:554 - Completed initialization in 1 ms
2025-07-14 18:07:05.576 [XNIO-1 task-2] ERROR io.undertow.request:80 - UT005023: Exception handling request to /admin/chat/conversation/generate-cookie
java.lang.IllegalArgumentException: When allowCredentials is true, allowedOrigins cannot contain the special value "*" since that cannot be set on the "Access-Control-Allow-Origin" response header. To allow credentials to a set of origins, list them explicitly or consider using "allowedOriginPatterns" instead.
at org.springframework.web.cors.CorsConfiguration.validateAllowCredentials(CorsConfiguration.java:538)
at org.springframework.web.cors.CorsConfiguration.checkOrigin(CorsConfiguration.java:642)
at org.springframework.web.cors.DefaultCorsProcessor.checkOrigin(DefaultCorsProcessor.java:173)
at org.springframework.web.cors.DefaultCorsProcessor.handleInternal(DefaultCorsProcessor.java:115)
at org.springframework.web.cors.DefaultCorsProcessor.processRequest(DefaultCorsProcessor.java:94)
at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:87)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.ServerHttpObservationFilter.doFilterInternal(ServerHttpObservationFilter.java:109)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:117)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:276)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:132)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:256)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:101)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1512)
at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
at java.base/java.lang.Thread.run(Thread.java:840)
2025-07-14 18:07:05.653 [XNIO-1 task-2] ERROR io.undertow.request:80 - UT005023: Exception handling request to /admin/chat/conversation/page
java.lang.IllegalArgumentException: When allowCredentials is true, allowedOrigins cannot contain the special value "*" since that cannot be set on the "Access-Control-Allow-Origin" response header. To allow credentials to a set of origins, list them explicitly or consider using "allowedOriginPatterns" instead.
at org.springframework.web.cors.CorsConfiguration.validateAllowCredentials(CorsConfiguration.java:538)
at org.springframework.web.cors.CorsConfiguration.checkOrigin(CorsConfiguration.java:642)
at org.springframework.web.cors.DefaultCorsProcessor.checkOrigin(DefaultCorsProcessor.java:173)
at org.springframework.web.cors.DefaultCorsProcessor.handleInternal(DefaultCorsProcessor.java:115)
at org.springframework.web.cors.DefaultCorsProcessor.processRequest(DefaultCorsProcessor.java:94)
at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:87)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.ServerHttpObservationFilter.doFilterInternal(ServerHttpObservationFilter.java:109)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:117)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:276)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:132)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:256)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:101)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
at java.base/java.lang.Thread.run(Thread.java:840)
2025-07-14 18:07:19.535 [SpringApplicationShutdownHook] INFO io.undertow:259 - stopping server: Undertow - 2.3.10.Final
2025-07-14 18:07:19.540 [SpringApplicationShutdownHook] INFO io.undertow.servlet:372 - Destroying Spring FrameworkServlet 'dispatcherServlet'
2025-07-14 18:07:19.543 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource:350 - HikariPool-1 - Shutdown initiated...
2025-07-14 18:07:19.545 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource:352 - HikariPool-1 - Shutdown completed.
2025-07-14 18:07:22.938 [background-preinit] INFO org.hibernate.validator.internal.util.Version:21 - HV000001: Hibernate Validator 8.0.1.Final
2025-07-14 18:07:22.968 [main] INFO com.ask.AskDataAiApplication:50 - Starting AskDataAiApplication using Java 17.0.15 with PID 27000 (D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-boot\target\classes started by 11523 in D:\java\ask_data_ai\pig-master\ask-data-ai)
2025-07-14 18:07:22.968 [main] DEBUG com.ask.AskDataAiApplication:51 - Running with Spring Boot v3.2.1, Spring v6.1.2
2025-07-14 18:07:22.968 [main] INFO com.ask.AskDataAiApplication:662 - No active profile set, falling back to 1 default profile: "default"
2025-07-14 18:07:24.417 [main] WARN io.undertow.websockets.jsr:68 - UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2025-07-14 18:07:24.434 [main] INFO io.undertow.servlet:372 - Initializing Spring embedded WebApplicationContext
2025-07-14 18:07:24.435 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext:296 - Root WebApplicationContext: initialization completed in 1438 ms
2025-07-14 18:07:24.967 [main] INFO com.zaxxer.hikari.HikariDataSource:110 - HikariPool-1 - Starting...
2025-07-14 18:07:25.321 [main] INFO com.zaxxer.hikari.pool.HikariPool:565 - HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@33fec21
2025-07-14 18:07:25.324 [main] INFO com.zaxxer.hikari.HikariDataSource:123 - HikariPool-1 - Start completed.
2025-07-14 18:07:25.333 [main] WARN o.s.a.c.m.r.jdbc.JdbcChatMemoryRepository$Builder:242 - Explicitly set dialect PostgresChatMemoryDialect will be used instead of detected dialect PostgresChatMemoryRepositoryDialect from datasource
2025-07-14 18:07:25.830 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:229 - Using the vector table name: ask_vector_store. Is empty: false
2025-07-14 18:07:25.834 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:410 - Initializing PGVectorStore schema for table: ask_vector_store in schema: public
2025-07-14 18:07:25.835 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:413 - vectorTableValidationsEnabled false
2025-07-14 18:07:26.891 [main] INFO o.s.b.actuate.endpoint.web.EndpointLinksResolver:58 - Exposing 1 endpoint(s) beneath base path '/actuator'
2025-07-14 18:07:26.962 [main] INFO io.undertow:120 - starting server: Undertow - 2.3.10.Final
2025-07-14 18:07:26.972 [main] INFO org.xnio:95 - XNIO version 3.8.8.Final
2025-07-14 18:07:26.979 [main] INFO org.xnio.nio:58 - XNIO NIO Implementation Version 3.8.8.Final
2025-07-14 18:07:27.007 [main] INFO org.jboss.threads:55 - JBoss Threads version 3.5.0.Final
2025-07-14 18:07:27.054 [main] INFO o.s.boot.web.embedded.undertow.UndertowWebServer:121 - Undertow started on port 9999 (http) with context path '/admin'
2025-07-14 18:07:27.067 [main] INFO com.ask.AskDataAiApplication:56 - Started AskDataAiApplication in 4.486 seconds (process running for 4.935)
2025-07-14 18:07:27.326 [RMI TCP Connection(2)-192.168.156.117] INFO io.undertow.servlet:372 - Initializing Spring DispatcherServlet 'dispatcherServlet'
2025-07-14 18:07:27.326 [RMI TCP Connection(2)-192.168.156.117] INFO org.springframework.web.servlet.DispatcherServlet:532 - Initializing Servlet 'dispatcherServlet'
2025-07-14 18:07:27.328 [RMI TCP Connection(2)-192.168.156.117] INFO org.springframework.web.servlet.DispatcherServlet:554 - Completed initialization in 1 ms
2025-07-14 18:08:51.818 [SpringApplicationShutdownHook] INFO io.undertow:259 - stopping server: Undertow - 2.3.10.Final
2025-07-14 18:08:51.826 [SpringApplicationShutdownHook] INFO io.undertow.servlet:372 - Destroying Spring FrameworkServlet 'dispatcherServlet'
2025-07-14 18:08:51.831 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource:350 - HikariPool-1 - Shutdown initiated...
2025-07-14 18:08:51.831 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource:352 - HikariPool-1 - Shutdown completed.
2025-07-14 18:08:56.159 [background-preinit] INFO org.hibernate.validator.internal.util.Version:21 - HV000001: Hibernate Validator 8.0.1.Final
2025-07-14 18:08:56.190 [main] INFO com.ask.AskDataAiApplication:50 - Starting AskDataAiApplication using Java 17.0.15 with PID 15640 (D:\java\ask_data_ai\pig-master\ask-data-ai\ask-data-ai-boot\target\classes started by 11523 in D:\java\ask_data_ai\pig-master\ask-data-ai)
2025-07-14 18:08:56.190 [main] DEBUG com.ask.AskDataAiApplication:51 - Running with Spring Boot v3.2.1, Spring v6.1.2
2025-07-14 18:08:56.191 [main] INFO com.ask.AskDataAiApplication:662 - No active profile set, falling back to 1 default profile: "default"
2025-07-14 18:08:57.641 [main] WARN io.undertow.websockets.jsr:68 - UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2025-07-14 18:08:57.657 [main] INFO io.undertow.servlet:372 - Initializing Spring embedded WebApplicationContext
2025-07-14 18:08:57.658 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext:296 - Root WebApplicationContext: initialization completed in 1433 ms
2025-07-14 18:08:58.193 [main] INFO com.zaxxer.hikari.HikariDataSource:110 - HikariPool-1 - Starting...
2025-07-14 18:08:58.663 [main] INFO com.zaxxer.hikari.pool.HikariPool:565 - HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@12a0d249
2025-07-14 18:08:58.665 [main] INFO com.zaxxer.hikari.HikariDataSource:123 - HikariPool-1 - Start completed.
2025-07-14 18:08:58.674 [main] WARN o.s.a.c.m.r.jdbc.JdbcChatMemoryRepository$Builder:242 - Explicitly set dialect PostgresChatMemoryDialect will be used instead of detected dialect PostgresChatMemoryRepositoryDialect from datasource
2025-07-14 18:08:59.151 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:229 - Using the vector table name: ask_vector_store. Is empty: false
2025-07-14 18:08:59.155 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:410 - Initializing PGVectorStore schema for table: ask_vector_store in schema: public
2025-07-14 18:08:59.155 [main] INFO o.s.ai.vectorstore.pgvector.PgVectorStore:413 - vectorTableValidationsEnabled false
2025-07-14 18:09:00.293 [main] INFO o.s.b.actuate.endpoint.web.EndpointLinksResolver:58 - Exposing 1 endpoint(s) beneath base path '/actuator'
2025-07-14 18:09:00.362 [main] INFO io.undertow:120 - starting server: Undertow - 2.3.10.Final
2025-07-14 18:09:00.370 [main] INFO org.xnio:95 - XNIO version 3.8.8.Final
2025-07-14 18:09:00.377 [main] INFO org.xnio.nio:58 - XNIO NIO Implementation Version 3.8.8.Final
2025-07-14 18:09:00.405 [main] INFO org.jboss.threads:55 - JBoss Threads version 3.5.0.Final
2025-07-14 18:09:00.457 [main] INFO o.s.boot.web.embedded.undertow.UndertowWebServer:121 - Undertow started on port 9999 (http) with context path '/admin'
2025-07-14 18:09:00.471 [main] INFO com.ask.AskDataAiApplication:56 - Started AskDataAiApplication in 4.668 seconds (process running for 5.136)
2025-07-14 18:09:01.073 [RMI TCP Connection(4)-192.168.156.117] INFO io.undertow.servlet:372 - Initializing Spring DispatcherServlet 'dispatcherServlet'
2025-07-14 18:09:01.073 [RMI TCP Connection(4)-192.168.156.117] INFO org.springframework.web.servlet.DispatcherServlet:532 - Initializing Servlet 'dispatcherServlet'
2025-07-14 18:09:01.075 [RMI TCP Connection(4)-192.168.156.117] INFO org.springframework.web.servlet.DispatcherServlet:554 - Completed initialization in 2 ms
2025-07-14 18:10:38.186 [XNIO-1 task-2] INFO org.springdoc.api.AbstractOpenApiResource:390 - Init duration for springdoc-openapi is: 501 ms
2025-07-14 18:18:45.079 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.selectList:135 - ==> Preparing: SELECT id,conversation_id,title,agent_id,user_id,del_flag,create_by,create_time,update_by,update_time FROM ask_chat_conversation WHERE del_flag='0' AND (user_id = ?)
2025-07-14 18:18:45.106 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.selectList:135 - ==> Parameters: 17524747444862804(Long)
2025-07-14 18:18:45.173 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.selectList:135 - <== Total: 0
2025-07-14 18:18:50.897 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.insert:135 - ==> Preparing: INSERT INTO ask_chat_conversation ( conversation_id, title, agent_id, user_id, create_by, create_time, update_by, update_time ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ? )
2025-07-14 18:18:50.905 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.insert:135 - ==> Parameters: 902e7063ca5b4781a291c51a4fbd6c18(String), 新建会话窗口(String), 1(Integer), 17524747444862804(Long), admin(String), 2025-07-14T18:18:50.865589400(LocalDateTime), admin(String), 2025-07-14T18:18:50.865589400(LocalDateTime)
2025-07-14 18:18:50.967 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.insert:135 - <== Updates: 1
2025-07-14 18:19:33.830 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.selectList:135 - ==> Preparing: SELECT id,conversation_id,title,agent_id,user_id,del_flag,create_by,create_time,update_by,update_time FROM ask_chat_conversation WHERE del_flag='0' AND (user_id = ?)
2025-07-14 18:19:33.830 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.selectList:135 - ==> Parameters: 17524747444862804(Long)
2025-07-14 18:19:33.890 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.selectList:135 - <== Total: 1
2025-07-14 18:20:50.560 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.selectList:135 - ==> Preparing: SELECT id,conversation_id,title,agent_id,user_id,del_flag,create_by,create_time,update_by,update_time FROM ask_chat_conversation WHERE del_flag='0' AND (user_id = ?)
2025-07-14 18:20:50.560 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.selectList:135 - ==> Parameters: 17524747444862804(Long)
2025-07-14 18:20:50.600 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.selectList:135 - <== Total: 1
2025-07-14 18:20:53.098 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.selectList:135 - ==> Preparing: SELECT id,conversation_id,title,agent_id,user_id,del_flag,create_by,create_time,update_by,update_time FROM ask_chat_conversation WHERE del_flag='0' AND (user_id = ?)
2025-07-14 18:20:53.098 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.selectList:135 - ==> Parameters: 17524747444862804(Long)
2025-07-14 18:20:53.138 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.selectList:135 - <== Total: 1
2025-07-14 18:20:55.600 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.selectList:135 - ==> Preparing: SELECT id,conversation_id,title,agent_id,user_id,del_flag,create_by,create_time,update_by,update_time FROM ask_chat_conversation WHERE del_flag='0' AND (user_id = ?)
2025-07-14 18:20:55.600 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.selectList:135 - ==> Parameters: 17524747444862804(Long)
2025-07-14 18:20:55.651 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.selectList:135 - <== Total: 1
2025-07-14 18:20:59.490 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.insert:135 - ==> Preparing: INSERT INTO ask_chat_conversation ( conversation_id, title, agent_id, user_id, create_by, create_time, update_by, update_time ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ? )
2025-07-14 18:20:59.490 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.insert:135 - ==> Parameters: e90577e866534ec494ccc5a9ae8d0a95(String), 新建会话窗口(String), 1(Integer), 17524747444862804(Long), admin(String), 2025-07-14T18:20:59.455787200(LocalDateTime), admin(String), 2025-07-14T18:20:59.455787200(LocalDateTime)
2025-07-14 18:20:59.540 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.insert:135 - <== Updates: 1
2025-07-14 18:21:05.560 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.selectList:135 - ==> Preparing: SELECT id,conversation_id,title,agent_id,user_id,del_flag,create_by,create_time,update_by,update_time FROM ask_chat_conversation WHERE del_flag='0' AND (user_id = ?)
2025-07-14 18:21:05.560 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.selectList:135 - ==> Parameters: 17524747444862804(Long)
2025-07-14 18:21:05.601 [XNIO-1 task-3] DEBUG com.ask.mapper.ChatConversationMapper.selectList:135 - <== Total: 2
2025-07-14 18:22:31.607 [XNIO-1 task-3] WARN o.s.w.s.m.support.DefaultHandlerExceptionResolver:247 - Resolved [org.springframework.web.bind.MissingServletRequestParameterException: Required request parameter 'userId' for method parameter type Long is not present]
2025-07-14 18:22:57.640 [XNIO-1 task-3] WARN o.s.w.s.m.support.DefaultHandlerExceptionResolver:247 - Resolved [org.springframework.web.bind.MissingServletRequestParameterException: Required request parameter 'userId' for method parameter type Long is not present]
2025-07-14 18:23:00.974 [XNIO-1 task-3] WARN o.s.w.s.m.support.DefaultHandlerExceptionResolver:247 - Resolved [org.springframework.web.bind.MissingServletRequestParameterException: Required request parameter 'userId' for method parameter type Long is not present]
2025-07-14 18:23:15.210 [XNIO-1 task-3] WARN o.s.w.s.m.support.DefaultHandlerExceptionResolver:247 - Resolved [org.springframework.web.bind.MissingServletRequestParameterException: Required request parameter 'userId' for method parameter type Long is not present]
2025-07-14 18:23:51.761 [SpringApplicationShutdownHook] INFO io.undertow:259 - stopping server: Undertow - 2.3.10.Final
2025-07-14 18:23:51.761 [SpringApplicationShutdownHook] INFO io.undertow.servlet:372 - Destroying Spring FrameworkServlet 'dispatcherServlet'
2025-07-14 18:23:51.761 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource:350 - HikariPool-1 - Shutdown initiated...
2025-07-14 18:23:51.770 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource:352 - HikariPool-1 - Shutdown completed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment