正在显示
4 个修改的文件
包含
11 行增加
和
14 行删除
| @@ -31,6 +31,4 @@ public interface QuestionEmbeddingMapper { | @@ -31,6 +31,4 @@ public interface QuestionEmbeddingMapper { | ||
| 31 | @Param("limit") int limit, | 31 | @Param("limit") int limit, |
| 32 | @Param("minSimilarity") Double minSimilarity); | 32 | @Param("minSimilarity") Double minSimilarity); |
| 33 | 33 | ||
| 34 | - List<QuestionEmbedding> similaritySearch(@Param("vector") float[] vector, | ||
| 35 | - @Param("limit") int limit); | ||
| 36 | } | 34 | } |
| @@ -82,10 +82,5 @@ | @@ -82,10 +82,5 @@ | ||
| 82 | ]]> | 82 | ]]> |
| 83 | </select> | 83 | </select> |
| 84 | 84 | ||
| 85 | - <select id="similaritySearch" resultMap="questionEmbeddingResultMap"> | ||
| 86 | -<!-- SELECT *, embedding <-> #{vector} AS similarity--> | ||
| 87 | -<!-- FROM question_embedding--> | ||
| 88 | -<!-- ORDER BY similarity ASC--> | ||
| 89 | -<!-- LIMIT #{limit}--> | ||
| 90 | - </select> | 85 | + |
| 91 | </mapper> | 86 | </mapper> |
| @@ -9,15 +9,22 @@ import org.springframework.web.multipart.MultipartFile; | @@ -9,15 +9,22 @@ import org.springframework.web.multipart.MultipartFile; | ||
| 9 | import java.util.List; | 9 | import java.util.List; |
| 10 | 10 | ||
| 11 | public interface IQuestionEmbeddingService { | 11 | public interface IQuestionEmbeddingService { |
| 12 | + | ||
| 12 | Page<QuestionEmbedding> findAll(QuestionEmbedding questionEmbedding, Integer pageNo, Integer pageSize); | 13 | Page<QuestionEmbedding> findAll(QuestionEmbedding questionEmbedding, Integer pageNo, Integer pageSize); |
| 14 | + | ||
| 13 | Integer findQuestionCount(QuestionEmbedding questionEmbedding); | 15 | Integer findQuestionCount(QuestionEmbedding questionEmbedding); |
| 16 | + | ||
| 14 | QuestionEmbedding findById(String id); | 17 | QuestionEmbedding findById(String id); |
| 18 | + | ||
| 15 | int insert(QuestionEmbedding record); | 19 | int insert(QuestionEmbedding record); |
| 20 | + | ||
| 16 | int update(QuestionEmbedding record); | 21 | int update(QuestionEmbedding record); |
| 22 | + | ||
| 17 | int removeByIds(List<String> ids); | 23 | int removeByIds(List<String> ids); |
| 24 | + | ||
| 18 | int deleteById(String id); | 25 | int deleteById(String id); |
| 26 | + | ||
| 19 | List<QuestionEmbedding> similaritySearchByQuestion(String question, int limit, Double minSimilarity, AiragChatsetting chatSetting); | 27 | List<QuestionEmbedding> similaritySearchByQuestion(String question, int limit, Double minSimilarity, AiragChatsetting chatSetting); |
| 20 | - List<QuestionEmbedding> similaritySearch(float[] vector, int limit); | ||
| 21 | 28 | ||
| 22 | Result<?> processZipUpload(MultipartFile file, String knowledgeId); | 29 | Result<?> processZipUpload(MultipartFile file, String knowledgeId); |
| 23 | } | 30 | } |
| @@ -118,13 +118,10 @@ public class QuestionEmbeddingServiceImpl implements IQuestionEmbeddingService { | @@ -118,13 +118,10 @@ public class QuestionEmbeddingServiceImpl implements IQuestionEmbeddingService { | ||
| 118 | Response<Embedding> embedding = aiModelUtils.getEmbedding(chatSetting.getEmbeddingId(), question); | 118 | Response<Embedding> embedding = aiModelUtils.getEmbedding(chatSetting.getEmbeddingId(), question); |
| 119 | 119 | ||
| 120 | 120 | ||
| 121 | - return questionEmbeddingMapper.similaritySearchByQuestion(embedding.content().vector(), limit, 1-minSimilarity); | 121 | + return questionEmbeddingMapper.similaritySearchByQuestion(embedding.content().vector(), limit, 1 - minSimilarity); |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | - @Override | ||
| 125 | - public List<QuestionEmbedding> similaritySearch(float[] vector, int limit) { | ||
| 126 | - return questionEmbeddingMapper.similaritySearch(vector, limit); | ||
| 127 | - } | 124 | + |
| 128 | 125 | ||
| 129 | @Override | 126 | @Override |
| 130 | public Result<?> processZipUpload(MultipartFile zipFile, String knowledgeId) { | 127 | public Result<?> processZipUpload(MultipartFile zipFile, String knowledgeId) { |
-
请 注册 或 登录 后发表评论