通过yml开关控制使用哪些模型和向量库
This commit is contained in:
@@ -43,11 +43,11 @@
|
|||||||
<artifactId>spring-ai-starter-model-openai</artifactId>
|
<artifactId>spring-ai-starter-model-openai</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 本地大模型
|
<!-- 本地大模型 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.ai</groupId>
|
<groupId>org.springframework.ai</groupId>
|
||||||
<artifactId>spring-ai-starter-model-ollama</artifactId>
|
<artifactId>spring-ai-starter-model-ollama</artifactId>
|
||||||
</dependency> -->
|
</dependency>
|
||||||
|
|
||||||
<!-- 向量数据库 -->
|
<!-- 向量数据库 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -65,19 +65,19 @@
|
|||||||
<artifactId>httpclient5</artifactId>
|
<artifactId>httpclient5</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- PG 向量数据库
|
<!-- PG 向量数据库 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.ai</groupId>
|
<groupId>org.springframework.ai</groupId>
|
||||||
<artifactId>spring-ai-starter-vector-store-pgvector</artifactId>
|
<artifactId>spring-ai-starter-vector-store-pgvector</artifactId>
|
||||||
</dependency> -->
|
</dependency>
|
||||||
|
|
||||||
<!-- ES 向量数据库
|
<!-- ES 向量数据库 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.ai</groupId>
|
<groupId>org.springframework.ai</groupId>
|
||||||
<artifactId>spring-ai-starter-vector-store-elasticsearch</artifactId>
|
<artifactId>spring-ai-starter-vector-store-elasticsearch</artifactId>
|
||||||
</dependency> -->
|
</dependency>
|
||||||
|
|
||||||
<!-- Milvus 向量数据库
|
<!-- Milvus 向量数据库 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.ai</groupId>
|
<groupId>org.springframework.ai</groupId>
|
||||||
<artifactId>spring-ai-starter-vector-store-milvus</artifactId>
|
<artifactId>spring-ai-starter-vector-store-milvus</artifactId>
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
<groupId>io.netty</groupId>
|
<groupId>io.netty</groupId>
|
||||||
<artifactId>netty-resolver-dns-native-macos</artifactId>
|
<artifactId>netty-resolver-dns-native-macos</artifactId>
|
||||||
<classifier>osx-aarch_64</classifier>
|
<classifier>osx-aarch_64</classifier>
|
||||||
</dependency> -->
|
</dependency>
|
||||||
|
|
||||||
<!-- HTML 转 Markdown -->
|
<!-- HTML 转 Markdown -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.jeesite.modules.cms.ai.properties;
|
package com.jeesite.modules.cms.ai.properties;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
||||||
|
|
||||||
@ConfigurationProperties("spring.ai")
|
@ConfigurationProperties("spring.ai")
|
||||||
public class CmsAiProperties {
|
public class CmsAiProperties {
|
||||||
@@ -20,6 +21,12 @@ public class CmsAiProperties {
|
|||||||
*/
|
*/
|
||||||
private String defaultPromptTemplate = "";
|
private String defaultPromptTemplate = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向量数据库设置
|
||||||
|
*/
|
||||||
|
@NestedConfigurationProperty
|
||||||
|
private final Vectorstore vectorstore = new Vectorstore();
|
||||||
|
|
||||||
public Boolean getToolCalls() {
|
public Boolean getToolCalls() {
|
||||||
return toolCalls;
|
return toolCalls;
|
||||||
}
|
}
|
||||||
@@ -43,4 +50,24 @@ public class CmsAiProperties {
|
|||||||
public void setDefaultPromptTemplate(String defaultPromptTemplate) {
|
public void setDefaultPromptTemplate(String defaultPromptTemplate) {
|
||||||
this.defaultPromptTemplate = defaultPromptTemplate;
|
this.defaultPromptTemplate = defaultPromptTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Vectorstore getVectorstore() {
|
||||||
|
return vectorstore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Vectorstore {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向量库类型选择:chroma、pgvector、elasticsearch、milvus
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,13 @@
|
|||||||
spring:
|
spring:
|
||||||
ai:
|
ai:
|
||||||
|
|
||||||
|
# 模型选择:openai、ollama
|
||||||
|
model:
|
||||||
|
chat: ollama
|
||||||
|
embedding: ${spring.ai.model.chat}
|
||||||
|
image: ${spring.ai.model.chat}
|
||||||
|
audio: ${spring.ai.model.chat}
|
||||||
|
|
||||||
# 在线大模型【请在 pom.xml 中打开 openai 的注释,并注释上其它模型】
|
# 在线大模型【请在 pom.xml 中打开 openai 的注释,并注释上其它模型】
|
||||||
openai:
|
openai:
|
||||||
|
|
||||||
@@ -83,6 +90,9 @@ spring:
|
|||||||
# 向量数据库配置
|
# 向量数据库配置
|
||||||
vectorstore:
|
vectorstore:
|
||||||
|
|
||||||
|
# 向量库类型:chroma、pgvector、elasticsearch、milvus
|
||||||
|
type: chroma
|
||||||
|
|
||||||
# Chroma 向量数据库【请在 pom.xml 中打开 chroma 的注释,并注释上其它向量库】
|
# Chroma 向量数据库【请在 pom.xml 中打开 chroma 的注释,并注释上其它向量库】
|
||||||
chroma:
|
chroma:
|
||||||
client:
|
client:
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<artifactId>jeesite-web-ai</artifactId>
|
<artifactId>jeesite-web-ai</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
|
||||||
<description>Web AI 服务,也可为分离端提供接口服务</description>
|
<description>Web AI 服务</description>
|
||||||
|
|
||||||
<name>JeeSite Web AI</name>
|
<name>JeeSite Web AI</name>
|
||||||
<url>http://jeesite.com</url>
|
<url>http://jeesite.com</url>
|
||||||
|
|||||||
Reference in New Issue
Block a user