fix: 修复错误
This commit is contained in:
@@ -4,14 +4,14 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
ai:
|
ai:
|
||||||
ollama:
|
ollama:
|
||||||
base-url: http://117.72.202.142:11434
|
base-url: http://192.168.109.134:11434
|
||||||
|
|
||||||
# Redis
|
# Redis
|
||||||
redis:
|
redis:
|
||||||
sdk:
|
sdk:
|
||||||
config:
|
config:
|
||||||
host: 117.72.202.142
|
host: 127.0.0.1
|
||||||
port: 16379
|
port: 6379
|
||||||
pool-size: 10
|
pool-size: 10
|
||||||
min-idle-size: 5
|
min-idle-size: 5
|
||||||
idle-timeout: 30000
|
idle-timeout: 30000
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class OllamaController implements IAiService {
|
|||||||
private OllamaChatClient chatClient;
|
private OllamaChatClient chatClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* http://localhost:8090/api/v1/ollama/generate?model=deepseek-r1:1.5b&message=1+1
|
* http://localhost:8090/api/v1/ollama/generate?model=deepseek-r1:7b&message=1+1
|
||||||
*/
|
*/
|
||||||
@GetMapping("generate")
|
@GetMapping("generate")
|
||||||
@Override
|
@Override
|
||||||
@@ -31,7 +31,7 @@ public class OllamaController implements IAiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* http://localhost:8090/api/v1/ollama/generate_stream?model=deepseek-r1:1.5b&message=hi
|
* http://localhost:8090/api/v1/ollama/generate_stream?model=deepseek-r1:7b&message=hi
|
||||||
*/
|
*/
|
||||||
@GetMapping("generate_stream")
|
@GetMapping("generate_stream")
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
43
docs/docker-compose-environment-aliyun2.yml
Normal file
43
docs/docker-compose-environment-aliyun2.yml
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# docker-compose -f docker-compose-environment-aliyun.yml up -d
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
# 对话模型
|
||||||
|
# ollama pull deepseek-r1:1.5b
|
||||||
|
# 运行模型
|
||||||
|
# ollama run deepseek-r1:1.5b
|
||||||
|
# 联网模型
|
||||||
|
# ollama pull nomic-embed-text
|
||||||
|
ollama:
|
||||||
|
image: registry.cn-hangzhou.aliyuncs.com/xfg-studio/ollama:0.5.10
|
||||||
|
container_name: ollama
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "11434:11434"
|
||||||
|
vector_db:
|
||||||
|
image: registry.cn-hangzhou.aliyuncs.com/xfg-studio/pgvector:v0.5.0
|
||||||
|
container_name: vector_db
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=postgres
|
||||||
|
- POSTGRES_PASSWORD=postgres
|
||||||
|
- POSTGRES_DB=ai-rag-knowledge
|
||||||
|
- PGPASSWORD=postgres
|
||||||
|
volumes:
|
||||||
|
- ./pgvector/sql/init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||||
|
logging:
|
||||||
|
options:
|
||||||
|
max-size: 10m
|
||||||
|
max-file: "3"
|
||||||
|
ports:
|
||||||
|
- '15432:5432'
|
||||||
|
healthcheck:
|
||||||
|
test: "pg_isready -U postgres -d ai-rag-knowledge"
|
||||||
|
interval: 2s
|
||||||
|
timeout: 20s
|
||||||
|
retries: 10
|
||||||
|
networks:
|
||||||
|
- my-network
|
||||||
|
|
||||||
|
networks:
|
||||||
|
my-network:
|
||||||
|
driver: bridge
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
addMessage('<span class="animate-pulse">▍</span>');
|
addMessage('<span class="animate-pulse">▍</span>');
|
||||||
|
|
||||||
// 构建API URL
|
// 构建API URL
|
||||||
const apiUrl = `http://localhost:8090/api/v1/ollama/generate_stream?model=deepseek-r1:1.5b&message=${encodeURIComponent(message)}`;
|
const apiUrl = `http://localhost:8090/api/v1/ollama/generate_stream?model=deepseek-r1:7b&message=${encodeURIComponent(message)}`;
|
||||||
|
|
||||||
// 使用EventSource接收流式响应
|
// 使用EventSource接收流式响应
|
||||||
const eventSource = new EventSource(apiUrl);
|
const eventSource = new EventSource(apiUrl);
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
const API_BASE = 'http://localhost:8090/api/v1/ollama/generate_stream';
|
const API_BASE = 'http://localhost:8090/api/v1/ollama/generate_stream';
|
||||||
const MODEL = 'deepseek-r1:1.5b';
|
const MODEL = 'deepseek-r1:7b';
|
||||||
const chatContainer = document.getElementById('chatContainer');
|
const chatContainer = document.getElementById('chatContainer');
|
||||||
const messageInput = document.getElementById('messageInput');
|
const messageInput = document.getElementById('messageInput');
|
||||||
const sendButton = document.getElementById('sendButton');
|
const sendButton = document.getElementById('sendButton');
|
||||||
|
|||||||
Reference in New Issue
Block a user