You've already forked DataMate
feat: deer-flow通过gateway转发 (#193)
This commit is contained in:
14
Makefile
14
Makefile
@@ -257,16 +257,11 @@ VALID_SERVICE_TARGETS := datamate backend frontend runtime mineru "deer-flow" mi
|
||||
elif [ "$*" = "mineru" ]; then \
|
||||
REGISTRY=$(REGISTRY) && docker compose -f deployment/docker/datamate/docker-compose.yml up -d datamate-mineru; \
|
||||
elif [ "$*" = "datamate" ]; then \
|
||||
if docker compose ls --filter name=deer-flow | grep -q deer-flow; then \
|
||||
(NGINX_CONF="./backend-with-deer-flow.conf" REGISTRY=$(REGISTRY) docker compose -f deployment/docker/datamate/docker-compose.yml up -d); \
|
||||
else \
|
||||
(REGISTRY=$(REGISTRY) docker compose -f deployment/docker/datamate/docker-compose.yml up -d); \
|
||||
fi; \
|
||||
REGISTRY=$(REGISTRY) docker compose -f deployment/docker/datamate/docker-compose.yml up -d; \
|
||||
elif [ "$*" = "deer-flow" ]; then \
|
||||
cp runtime/deer-flow/.env deployment/docker/deer-flow/.env; \
|
||||
cp runtime/deer-flow/conf.yaml deployment/docker/deer-flow/conf.yaml; \
|
||||
REGISTRY=$(REGISTRY) docker compose -f deployment/docker/deer-flow/docker-compose.yml up -d; \
|
||||
NGINX_CONF="./backend-with-deer-flow.conf" REGISTRY=$(REGISTRY) docker compose -f deployment/docker/datamate/docker-compose.yml up -d; \
|
||||
elif [ "$*" = "milvus" ]; then \
|
||||
docker compose -f deployment/docker/milvus/docker-compose.yml up -d; \
|
||||
else \
|
||||
@@ -300,9 +295,6 @@ VALID_SERVICE_TARGETS := datamate backend frontend runtime mineru "deer-flow" mi
|
||||
fi; \
|
||||
elif [ "$*" = "deer-flow" ]; then \
|
||||
docker compose -f deployment/docker/deer-flow/docker-compose.yml down; \
|
||||
if docker compose ls --filter name=datamate | grep -q datamate; then \
|
||||
REGISTRY=$(REGISTRY) docker compose -f deployment/docker/datamate/docker-compose.yml up -d; \
|
||||
fi; \
|
||||
elif [ "$*" = "milvus" ]; then \
|
||||
if [ "$(DELETE_VOLUMES_CHOICE)" = "1" ]; then \
|
||||
docker compose -f deployment/docker/milvus/docker-compose.yml down -v; \
|
||||
@@ -337,7 +329,6 @@ VALID_K8S_TARGETS := mineru datamate deer-flow milvus label-studio
|
||||
cp runtime/deer-flow/.env deployment/helm/deer-flow/charts/public/.env; \
|
||||
cp runtime/deer-flow/conf.yaml deployment/helm/deer-flow/charts/public/conf.yaml; \
|
||||
helm upgrade deer-flow deployment/helm/deer-flow -n $(NAMESPACE) --install --set global.image.repository=$(REGISTRY); \
|
||||
helm upgrade datamate deployment/helm/datamate/ -n $(NAMESPACE) --install --set global.deerFlow.enable=true --set global.image.repository=$(REGISTRY); \
|
||||
elif [ "$*" = "milvus" ]; then \
|
||||
helm upgrade milvus deployment/helm/milvus -n $(NAMESPACE) --install; \
|
||||
fi
|
||||
@@ -359,9 +350,6 @@ VALID_K8S_TARGETS := mineru datamate deer-flow milvus label-studio
|
||||
helm uninstall datamate -n $(NAMESPACE) --ignore-not-found; \
|
||||
elif [ "$*" = "deer-flow" ]; then \
|
||||
helm uninstall deer-flow -n $(NAMESPACE) --ignore-not-found; \
|
||||
if helm ls -n $(NAMESPACE) --filter datamate | grep -q datamate; then \
|
||||
helm upgrade datamate deployment/helm/datamate/ -n $(NAMESPACE) --set global.deerFlow.enable=false; \
|
||||
fi; \
|
||||
elif [ "$*" = "milvus" ]; then \
|
||||
helm uninstall milvus -n $(NAMESPACE) --ignore-not-found; \
|
||||
fi
|
||||
|
||||
@@ -33,6 +33,16 @@ public class ApiGatewayApplication {
|
||||
.route("data-evaluation", r -> r.path("/api/evaluation/**")
|
||||
.uri("http://datamate-backend-python:18000"))
|
||||
|
||||
.route("deer-flow-frontend", r -> r.path("/chat/**")
|
||||
.uri("http://deer-flow-frontend:3000"))
|
||||
|
||||
.route("deer-flow-static", r -> r.path("/_next/**")
|
||||
.uri("http://deer-flow-frontend:3000"))
|
||||
|
||||
.route("deer-flow-backend", r -> r.path("/deer-flow-backend/**")
|
||||
.filters(f -> f.stripPrefix(1).prefixPath("/api"))
|
||||
.uri("http://deer-flow-backend:8000"))
|
||||
|
||||
// 其他后端服务
|
||||
.route("default", r -> r.path("/api/**")
|
||||
.uri("http://datamate-backend:8080"))
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name 0.0.0.0;
|
||||
|
||||
access_log /var/log/datamate/frontend/access.log main;
|
||||
error_log /var/log/datamate/frontend/error.log notice;
|
||||
|
||||
client_max_body_size 1024M;
|
||||
|
||||
add_header Set-Cookie "NEXT_LOCALE=zh";
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://datamate-gateway:8080/api/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location /chat {
|
||||
proxy_pass http://deer-flow-frontend:3000/chat;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location /_next {
|
||||
proxy_pass http://deer-flow-frontend:3000/_next;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location /deer-flow-backend/ {
|
||||
proxy_pass http://deer-flow-backend:8000/api/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location / {
|
||||
if ($query_string ~* "_rsc=pmmii") {
|
||||
proxy_pass http://deer-flow-frontend:3000;
|
||||
break;
|
||||
}
|
||||
|
||||
root /opt/frontend;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ server {
|
||||
|
||||
client_max_body_size 1024M;
|
||||
|
||||
add_header Set-Cookie "NEXT_LOCALE=zh";
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://datamate-gateway:8080/api/;
|
||||
proxy_set_header Host $host;
|
||||
@@ -14,6 +16,35 @@ server {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location /chat {
|
||||
proxy_pass http://datamate-gateway:8080/chat;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
||||
proxy_intercept_errors on;
|
||||
error_page 500 501 502 503 504 =200 @static_fallback;
|
||||
}
|
||||
|
||||
location /_next {
|
||||
proxy_pass http://datamate-gateway:8080/_next;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location /deer-flow-backend {
|
||||
proxy_pass http://datamate-gateway:8080/deer-flow-backend;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location @static_fallback {
|
||||
root /opt/frontend;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location / {
|
||||
root /opt/frontend;
|
||||
try_files $uri $uri/ /index.html;
|
||||
|
||||
@@ -47,7 +47,7 @@ services:
|
||||
- "30000:80" # nodePort → hostPort
|
||||
volumes:
|
||||
- frontend_log_volume:/var/log/datamate/frontend
|
||||
- ${NGINX_CONF:-./backend.conf}:/etc/nginx/conf.d/backend.conf
|
||||
- ./backend.conf:/etc/nginx/conf.d/backend.conf
|
||||
networks: [ datamate ]
|
||||
depends_on:
|
||||
- datamate-backend
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
{{- if .Values.global.deerFlow.enable }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
@@ -24,62 +23,36 @@ data:
|
||||
}
|
||||
|
||||
location /chat {
|
||||
proxy_pass http://deer-flow-frontend:3000/chat;
|
||||
proxy_pass http://datamate-gateway:8080/chat;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
||||
proxy_intercept_errors on;
|
||||
error_page 500 501 502 503 504 =200 @static_fallback;
|
||||
}
|
||||
|
||||
location /_next {
|
||||
proxy_pass http://deer-flow-frontend:3000/_next;
|
||||
proxy_pass http://datamate-gateway:8080/_next;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location /deer-flow-backend/ {
|
||||
proxy_pass http://deer-flow-backend:8000/api/;
|
||||
location /deer-flow-backend {
|
||||
proxy_pass http://datamate-gateway:8080/deer-flow-backend;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location / {
|
||||
if ($query_string ~* "_rsc=pmmii") {
|
||||
proxy_pass http://deer-flow-frontend:3000;
|
||||
break;
|
||||
}
|
||||
|
||||
location @static_fallback {
|
||||
root /opt/frontend;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
{{- else }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: datamate-nginx-conf
|
||||
data:
|
||||
backend.conf: |
|
||||
server {
|
||||
listen 80;
|
||||
server_name 0.0.0.0;
|
||||
|
||||
access_log /var/log/datamate/frontend/access.log main;
|
||||
error_log /var/log/datamate/frontend/error.log notice;
|
||||
|
||||
client_max_body_size 1024M;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://datamate-gateway:8080/api/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location / {
|
||||
root /opt/frontend;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
{{- end }}
|
||||
}
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
global:
|
||||
namespace: datamate
|
||||
deerFlow:
|
||||
enable: false
|
||||
image:
|
||||
repository: "ghcr.io/modelengine-group/"
|
||||
pullPolicy: "IfNotPresent"
|
||||
|
||||
@@ -31,8 +31,7 @@ export default function WelcomePage() {
|
||||
});
|
||||
|
||||
// 检查 HTTP 状态码在 200-299 范围内
|
||||
const contentType = response.headers.get("content-type");
|
||||
if (contentType && contentType.includes('application/json')) {
|
||||
if (response.ok) {
|
||||
return true;
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user