Commit 6cc434d2 authored by 林洋洋's avatar 林洋洋

添加向量模型

parent 62500905
...@@ -72,6 +72,11 @@ ...@@ -72,6 +72,11 @@
<groupId>io.projectreactor.netty</groupId> <groupId>io.projectreactor.netty</groupId>
<artifactId>reactor-netty-http</artifactId> <artifactId>reactor-netty-http</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.24.0</version>
</dependency>
<!-- SpringBoot Actuator --> <!-- SpringBoot Actuator -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
......
...@@ -42,7 +42,7 @@ import java.util.stream.Collectors; ...@@ -42,7 +42,7 @@ import java.util.stream.Collectors;
public class AskVectorStoreServiceImpl extends ServiceImpl<AskVectorStoreMapper, AskVectorStore> implements AskVectorStoreService { public class AskVectorStoreServiceImpl extends ServiceImpl<AskVectorStoreMapper, AskVectorStore> implements AskVectorStoreService {
@Autowired @Autowired
private EmbeddingModel ollamaEmbeddingModel; private EmbeddingModel embeddingModel;
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
...@@ -74,7 +74,7 @@ public class AskVectorStoreServiceImpl extends ServiceImpl<AskVectorStoreMapper, ...@@ -74,7 +74,7 @@ public class AskVectorStoreServiceImpl extends ServiceImpl<AskVectorStoreMapper,
String result = (title == null || title.trim().isEmpty()) ? String result = (title == null || title.trim().isEmpty()) ?
(content == null ? "" : content) : (content == null ? "" : content) :
title.trim() + "\n" + (content == null ? "" : content); title.trim() + "\n" + (content == null ? "" : content);
return ollamaEmbeddingModel.embed(result); return embeddingModel.embed(result);
}) })
.toList(); .toList();
......
...@@ -19,7 +19,7 @@ spring: ...@@ -19,7 +19,7 @@ spring:
driver-class-name: org.postgresql.Driver driver-class-name: org.postgresql.Driver
ai: ai:
model: model:
embedding: ollama embedding: openai
vectorstore: vectorstore:
pgvector: pgvector:
index-type: HNSW index-type: HNSW
...@@ -40,6 +40,10 @@ spring: ...@@ -40,6 +40,10 @@ spring:
chat: chat:
options: options:
model: deepseek-r1-0528 model: deepseek-r1-0528
embedding:
options:
base-url: https://dashscope.aliyuncs.com/compatible-mode
model: Qwen3-Embedding-8B
deepseek: deepseek:
base-url: https://dashscope.aliyuncs.com/compatible-mode/v1 base-url: https://dashscope.aliyuncs.com/compatible-mode/v1
......
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