zhenghao 2788fc3118 减少打包体积 | 4 months ago | |
---|---|---|
sql | 5 months ago | |
src | 4 months ago | |
.gitignore | 4 months ago | |
LICENSE | 5 months ago | |
README.md | 4 months ago | |
pom.xml | 4 months ago |
1、数据准备,将待文本数据通过embedding模型转成文本向量,并存储到向量数据库中。
2、用户提问,将用户提出的文本通过embedding模型转成问题文本向量,并在向量库中进行搜索,搜索得到一些文本段落,将搜索到的文本段落组装成prompt去调用大模型来获得答案。
jdk 17+
postgresql-12+ (linux环境)
ollama (linux环境)
###创建maven配置文件(maven.xml)
<settings>
<localRepository>D:/repository</localRepository>
<mirrors>
<mirror>
<id>public</id>
<url>https://maven.aliyun.com/repository/public</url>
<mirrorOf>public,!bladex</mirrorOf>
</mirror>
<mirror>
<id>central</id>
<url>https://maven.aliyun.com/repository/central</url>
<mirrorOf>central,!bladex</mirrorOf>
</mirror>
</mirrors>
<servers>
<server>
<id>bladex</id>
<configuration>
<httpHeaders>
<property>
<name>Authorization</name>
<value>token c02fc9fe46326c7706fb65c233ac2c7ba1af6dfe</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>
###配置idea maven环境
ctrl + alt + s 打开设置
搜索 maven
找到 User settings file
勾选Override
找到配置的maven.xml
(centos7) sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
(centos8) sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
(centos8) sudo dnf -qy module disable postgresql
yum -y install postgresql[pg版本]-server postgresql[pg版本]
yum -y install pgvector_[pg版本]
yum -y install postgresql[pg版本]-contrib
####下载ollama
curl -o ~/ollama https://hub.whtrys.space/ollama/ollama/releases/download/v0.2.5/ollama-linux-amd64
####启动ollama
nohup ~/ollama serve > ~/ollama.log 2>&1 &
####下载qwen2:7b:
~/ollama pull qwen2:7b
####下载embedding模型:
~/ollama pull mofanke/dmeta-embedding-zh
####开启会话qwen2:7b
~/ollama run qwen2:7b
####打包启动
#打包
maven -> ragchat -> clean
maven -> ragchat -> package
# 启动
nohup java -Dloader.path='lib/' -jar ragchat.jar > ragchat.log 2>&1 &
# 添加依赖包到当前lib目录(首次/或依赖包更新时)
# 将lib打包并解压到与jar包同级目录
mvn dependency:copy-dependencies -DoutputDirectory=.\lib -DincludeScope=runtime