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 \
|
elif [ "$*" = "mineru" ]; then \
|
||||||
REGISTRY=$(REGISTRY) && docker compose -f deployment/docker/datamate/docker-compose.yml up -d datamate-mineru; \
|
REGISTRY=$(REGISTRY) && docker compose -f deployment/docker/datamate/docker-compose.yml up -d datamate-mineru; \
|
||||||
elif [ "$*" = "datamate" ]; then \
|
elif [ "$*" = "datamate" ]; then \
|
||||||
if docker compose ls --filter name=deer-flow | grep -q deer-flow; then \
|
REGISTRY=$(REGISTRY) docker compose -f deployment/docker/datamate/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); \
|
|
||||||
else \
|
|
||||||
(REGISTRY=$(REGISTRY) docker compose -f deployment/docker/datamate/docker-compose.yml up -d); \
|
|
||||||
fi; \
|
|
||||||
elif [ "$*" = "deer-flow" ]; then \
|
elif [ "$*" = "deer-flow" ]; then \
|
||||||
cp runtime/deer-flow/.env deployment/docker/deer-flow/.env; \
|
cp runtime/deer-flow/.env deployment/docker/deer-flow/.env; \
|
||||||
cp runtime/deer-flow/conf.yaml deployment/docker/deer-flow/conf.yaml; \
|
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; \
|
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 \
|
elif [ "$*" = "milvus" ]; then \
|
||||||
docker compose -f deployment/docker/milvus/docker-compose.yml up -d; \
|
docker compose -f deployment/docker/milvus/docker-compose.yml up -d; \
|
||||||
else \
|
else \
|
||||||
@@ -300,9 +295,6 @@ VALID_SERVICE_TARGETS := datamate backend frontend runtime mineru "deer-flow" mi
|
|||||||
fi; \
|
fi; \
|
||||||
elif [ "$*" = "deer-flow" ]; then \
|
elif [ "$*" = "deer-flow" ]; then \
|
||||||
docker compose -f deployment/docker/deer-flow/docker-compose.yml down; \
|
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 \
|
elif [ "$*" = "milvus" ]; then \
|
||||||
if [ "$(DELETE_VOLUMES_CHOICE)" = "1" ]; then \
|
if [ "$(DELETE_VOLUMES_CHOICE)" = "1" ]; then \
|
||||||
docker compose -f deployment/docker/milvus/docker-compose.yml down -v; \
|
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/.env deployment/helm/deer-flow/charts/public/.env; \
|
||||||
cp runtime/deer-flow/conf.yaml deployment/helm/deer-flow/charts/public/conf.yaml; \
|
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 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 \
|
elif [ "$*" = "milvus" ]; then \
|
||||||
helm upgrade milvus deployment/helm/milvus -n $(NAMESPACE) --install; \
|
helm upgrade milvus deployment/helm/milvus -n $(NAMESPACE) --install; \
|
||||||
fi
|
fi
|
||||||
@@ -359,9 +350,6 @@ VALID_K8S_TARGETS := mineru datamate deer-flow milvus label-studio
|
|||||||
helm uninstall datamate -n $(NAMESPACE) --ignore-not-found; \
|
helm uninstall datamate -n $(NAMESPACE) --ignore-not-found; \
|
||||||
elif [ "$*" = "deer-flow" ]; then \
|
elif [ "$*" = "deer-flow" ]; then \
|
||||||
helm uninstall deer-flow -n $(NAMESPACE) --ignore-not-found; \
|
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 \
|
elif [ "$*" = "milvus" ]; then \
|
||||||
helm uninstall milvus -n $(NAMESPACE) --ignore-not-found; \
|
helm uninstall milvus -n $(NAMESPACE) --ignore-not-found; \
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -33,6 +33,16 @@ public class ApiGatewayApplication {
|
|||||||
.route("data-evaluation", r -> r.path("/api/evaluation/**")
|
.route("data-evaluation", r -> r.path("/api/evaluation/**")
|
||||||
.uri("http://datamate-backend-python:18000"))
|
.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/**")
|
.route("default", r -> r.path("/api/**")
|
||||||
.uri("http://datamate-backend:8080"))
|
.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;
|
client_max_body_size 1024M;
|
||||||
|
|
||||||
|
add_header Set-Cookie "NEXT_LOCALE=zh";
|
||||||
|
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://datamate-gateway:8080/api/;
|
proxy_pass http://datamate-gateway:8080/api/;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
@@ -14,6 +16,35 @@ server {
|
|||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
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 / {
|
location / {
|
||||||
root /opt/frontend;
|
root /opt/frontend;
|
||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ services:
|
|||||||
- "30000:80" # nodePort → hostPort
|
- "30000:80" # nodePort → hostPort
|
||||||
volumes:
|
volumes:
|
||||||
- frontend_log_volume:/var/log/datamate/frontend
|
- 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 ]
|
networks: [ datamate ]
|
||||||
depends_on:
|
depends_on:
|
||||||
- datamate-backend
|
- datamate-backend
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
{{- if .Values.global.deerFlow.enable }}
|
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
metadata:
|
metadata:
|
||||||
@@ -24,62 +23,36 @@ data:
|
|||||||
}
|
}
|
||||||
|
|
||||||
location /chat {
|
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 Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
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 {
|
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 Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /deer-flow-backend/ {
|
location /deer-flow-backend {
|
||||||
proxy_pass http://deer-flow-backend:8000/api/;
|
proxy_pass http://datamate-gateway:8080/deer-flow-backend;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location @static_fallback {
|
||||||
if ($query_string ~* "_rsc=pmmii") {
|
|
||||||
proxy_pass http://deer-flow-frontend:3000;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
root /opt/frontend;
|
root /opt/frontend;
|
||||||
try_files $uri $uri/ /index.html;
|
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 / {
|
location / {
|
||||||
root /opt/frontend;
|
root /opt/frontend;
|
||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{{- end }}
|
|
||||||
@@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
global:
|
global:
|
||||||
namespace: datamate
|
namespace: datamate
|
||||||
deerFlow:
|
|
||||||
enable: false
|
|
||||||
image:
|
image:
|
||||||
repository: "ghcr.io/modelengine-group/"
|
repository: "ghcr.io/modelengine-group/"
|
||||||
pullPolicy: "IfNotPresent"
|
pullPolicy: "IfNotPresent"
|
||||||
|
|||||||
@@ -31,8 +31,7 @@ export default function WelcomePage() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 检查 HTTP 状态码在 200-299 范围内
|
// 检查 HTTP 状态码在 200-299 范围内
|
||||||
const contentType = response.headers.get("content-type");
|
if (response.ok) {
|
||||||
if (contentType && contentType.includes('application/json')) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user