Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
.route("data-cleaning", r -> r.path("/api/cleaning/**")
.uri("http://datamate-backend-python:18000"))

.route("data-setting", r -> r.path("/api/sys-param/**")
.uri("http://datamate-backend-python:18000"))

.route("deer-flow-frontend", r -> r.path("/chat/**")
.uri("http://deer-flow-frontend:3000"))

Expand Down
17 changes: 8 additions & 9 deletions deployment/docker/datamate/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,15 @@ services:
# ==============================
label-studio-pgbouncer:
container_name: label-studio-pgbouncer
image: pgbouncer/pgbouncer:latest
image: edoburu/pgbouncer:latest
restart: on-failure
ports:
- "6432:6432"
environment:
- DATABASES_HOST=datamate-database
- DATABASES_PORT=5432
- DATABASES_NAME=labelstudio
- DATABASES_USER=postgres
- DATABASES_PASSWORD=${DB_PASSWORD:-password}
- DB_HOST=datamate-database
- DB_PORT=5432
- DB_NAME=labelstudio
- DB_USER=postgres
- DB_PASSWORD=${DB_PASSWORD:-password}
- AUTH_TYPE=scram-sha-256
- POOL_MODE=transaction
- MAX_CLIENT_CONN=100
- DEFAULT_POOL_SIZE=20
Expand Down Expand Up @@ -241,7 +240,7 @@ services:
- POSTGRE_NAME=labelstudio
- POSTGRE_USER=postgres
- POSTGRE_PASSWORD=${DB_PASSWORD:-password}
- POSTGRE_PORT=6432
- POSTGRE_PORT=5432
- POSTGRE_HOST=label-studio-pgbouncer
- LABEL_STUDIO_HOST=${LABEL_STUDIO_HOST:-}
- LOCAL_FILES_SERVING_ENABLED=true
Expand Down
63 changes: 63 additions & 0 deletions deployment/helm/datamate/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public:
DB_PASSWORD: "password"
CERT_PASS: ""
DOMAIN: ""
HOME_PAGE_URL: ""

datasetVolume: &datasetVolume
name: dataset-volume
Expand Down Expand Up @@ -90,6 +91,11 @@ database:
secretKeyRef:
name: datamate-conf
key: DB_PASSWORD
- name: HOME_PAGE_URL
valueFrom:
secretKeyRef:
name: datamate-conf
key: HOME_PAGE_URL
volumes:
- *dataVolume
- *logVolume
Expand Down Expand Up @@ -420,3 +426,60 @@ ray-cluster:
subPath: site-packages
- mountPath: /usr/local/Ascend
name: ascend
gpuGroup:
disabled: false
replicas: 0
minReplicas: 0
maxReplicas: 8
rayStartParams:
resources: '"{\"gpu\": 1}"'
containerEnv:
- name: RAY_DEDUP_LOGS
value: "0"
- name: RAY_TQDM_PATCH_PRINT
value: "0"
- name: PG_HOST
value: "datamate-database"
- name: PG_PORT
value: "5432"
- name: PG_USER
value: "postgres"
- name: PG_PASSWORD
valueFrom:
secretKeyRef:
name: datamate-conf
key: DB_PASSWORD
- name: PG_DATABASE
value: "datamate"
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
resources:
limits:
cpu: "8"
memory: "64G"
nvidia.com/gpu: 1
requests:
cpu: "1"
memory: "2G"
nvidia.com/gpu: 1
volumes:
- *datasetVolume
- *flowVolume
- *logVolume
- *operatorVolume
volumeMounts:
- mountPath: /tmp/ray
name: log-volume
subPathExpr: ray/$(POD_NAME)
- mountPath: /dataset
name: dataset-volume
- mountPath: /flow
name: flow-volume
- mountPath: /opt/runtime/datamate/ops/user
name: operator-volume
subPath: extract
- mountPath: /usr/local/lib/ops/site-packages
name: operator-volume
subPath: site-packages
2 changes: 1 addition & 1 deletion deployment/helm/label-studio/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
- name: POSTGRE_PASSWORD
value: {{ .Values.env.POSTGRE_PASSWORD | quote }}
- name: POSTGRE_PORT
value: {{ if .Values.pgbouncer.enabled }}{{ "6432" | quote }}{{ else }}{{ .Values.env.POSTGRE_PORT | quote }}{{ end }}
value: 5432
- name: POSTGRE_HOST
value: {{ if .Values.pgbouncer.enabled }}{{ printf "%s-pgbouncer" (include "label-studio.fullname" .) | quote }}{{ else }}{{ .Values.env.POSTGRE_HOST | quote }}{{ end }}
- name: LABEL_STUDIO_HOST
Expand Down
18 changes: 10 additions & 8 deletions deployment/helm/label-studio/templates/pgbouncer-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ spec:
imagePullPolicy: {{ .Values.pgbouncer.image.pullPolicy }}
ports:
- name: pgbouncer
containerPort: 6432
containerPort: 5432
protocol: TCP
env:
- name: DATABASES_HOST
- name: DB_HOST
value: {{ .Values.env.POSTGRE_HOST | quote }}
- name: DATABASES_PORT
- name: DB_PORT
value: {{ .Values.env.POSTGRE_PORT | quote }}
- name: DATABASES_NAME
- name: DB_NAME
value: {{ .Values.env.POSTGRE_NAME | quote }}
- name: DATABASES_USER
- name: DB_USER
value: {{ .Values.env.POSTGRE_USER | quote }}
- name: DATABASES_PASSWORD
- name: DB_PASSWORD
value: {{ .Values.env.POSTGRE_PASSWORD | quote }}
- name: POOL_MODE
value: {{ .Values.pgbouncer.poolMode | quote }}
Expand All @@ -51,14 +51,16 @@ spec:
value: {{ .Values.pgbouncer.defaultPoolSize | quote }}
- name: MAX_DB_CONNECTIONS
value: {{ .Values.pgbouncer.maxDbConnections | quote }}
- name: AUTH_TYPE
value: {{ .Values.pgbouncer.authType | quote }}
livenessProbe:
tcpSocket:
port: 6432
port: 5432
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
tcpSocket:
port: 6432
port: 5432
initialDelaySeconds: 5
periodSeconds: 10
resources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
spec:
type: ClusterIP
ports:
- port: 6432
- port: 5432
targetPort: pgbouncer
protocol: TCP
name: pgbouncer
Expand Down
3 changes: 2 additions & 1 deletion deployment/helm/label-studio/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pgbouncer:
replicaCount: 1

image:
repository: pgbouncer/pgbouncer
repository: edoburu/pgbouncer
tag: "latest"
pullPolicy: IfNotPresent

Expand All @@ -81,6 +81,7 @@ pgbouncer:
maxClientConn: 100 # Maximum number of client connections
defaultPoolSize: 20 # Default pool size per database (max connections to PostgreSQL)
maxDbConnections: 20 # Maximum database connections (hard limit)
authType: scram-sha-256

resources: {}

Expand Down
8 changes: 6 additions & 2 deletions frontend/src/i18n/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1432,6 +1432,8 @@
"processedFileType": "Processed File Type",
"beforeSize": "Before Size",
"afterSize": "After Size",
"result": "Result",
"resultDetail": "Result Detail",
"status": "Status",
"actions": "Actions",
"searchFileName": "Search file name",
Expand All @@ -1450,12 +1452,14 @@
"sizeOptimization": "File Size Optimization",
"reduced": "Reduced by {{percent}}%"
},
"logTable": {
"logTable": {
"selectRun": "Select Run",
"currentDisplay": "Current Display: {{num}}th Run",
"nthRun": "{{num}}th Run",
"noLogs": "No logs available for this task",
"streaming": "Streaming..."
"streaming": "Streaming...",
"download": "Download Log",
"downloadFailed": "Failed to download log file"
},
"operatorTable": {
"serialNumber": "Serial Number",
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/i18n/locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1432,6 +1432,8 @@
"processedFileType": "处理后文件类型",
"beforeSize": "处理前大小",
"afterSize": "处理后大小",
"result": "处理结果",
"resultDetail": "处理结果详情",
"status": "状态",
"actions": "操作",
"searchFileName": "搜索文件名",
Expand All @@ -1455,7 +1457,9 @@
"currentDisplay": "当前展示: 第 {{num}} 次",
"nthRun": "第 {{num}} 次",
"noLogs": "当前任务无可用日志",
"streaming": "实时流式输出中..."
"streaming": "实时流式输出中...",
"download": "下载日志",
"downloadFailed": "下载日志文件失败"
},
"operatorTable": {
"serialNumber": "序号",
Expand Down
105 changes: 81 additions & 24 deletions frontend/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,96 @@ import theme from "./theme";
import {errorConfigStore} from "@/utils/errorConfigStore.ts";
import "@/i18n";

async function checkHomePageRedirect(): Promise<string | null> {
try {
const response = await fetch('/api/sys-param/sys.home.page.url', {
cache: 'no-store'
});

if (response.ok) {
const result = await response.json();
return result.data?.paramValue?.trim() || null;
}
} catch (error) {
console.error('Failed to fetch home page URL:', error);
}

return null;
}

function showLoadingUI() {
const container = document.getElementById("root");
if (!container) return;

container.innerHTML = `
<div style="
min-height: 100vh;
background: linear-gradient(to bottom right, #eff6ff, #e0e7ff);
display: flex;
align-items: center;
justify-content: center;
">
<div style="text-align: center;">
<div style="
width: 40px;
height: 40px;
border: 3px solid #e5e7eb;
border-top-color: #3b82f6;
border-radius: 50%;
animation: spin 1s linear infinite;
"></div>
<style>
@keyframes spin {
to { transform: rotate(360deg); }
}
</style>
</div>
</div>
`;
}

async function bootstrap() {
const container = document.getElementById("root");
if (!container) return;

const root = createRoot(container);
showLoadingUI();

try {
// 2. 【关键步骤】在渲染前,等待配置文件加载完成
// 这一步会发起 fetch 请求去拿 /config/error-code.json
await errorConfigStore.loadConfig();
const [, homePageUrl] = await Promise.all([
errorConfigStore.loadConfig(),
checkHomePageRedirect()
]);

if (homePageUrl) {
const currentPath = window.location.pathname;
const targetPath = new URL(homePageUrl, window.location.origin).pathname;

if (currentPath === '/' && currentPath !== targetPath) {
window.location.href = homePageUrl;
return;
}
}

} catch (e) {
// 容错处理:即使配置文件加载失败(比如404),也不应该导致整个 App 白屏崩溃
// 此时 App 会使用代码里的默认兜底文案
console.error('Error config load failed, using default messages.', e);
} finally {
// 3. 无论配置加载成功与否,最后都执行渲染
root.render(
<StrictMode>
<Provider store={store}>
<ConfigProvider theme={ theme }>
<AntdApp>
<Suspense fallback={<Spin />}>
<TopLoadingBar />
<RouterProvider router={router} />
</Suspense>
</AntdApp>
</ConfigProvider>
</Provider>
</StrictMode>
);
console.error('Config load failed:', e);
}

const root = createRoot(container);

root.render(
<StrictMode>
<Provider store={store}>
<ConfigProvider theme={ theme }>
<AntdApp>
<Suspense fallback={<Spin />}>
<TopLoadingBar />
<RouterProvider router={router} />
</Suspense>
</AntdApp>
</ConfigProvider>
</Provider>
</StrictMode>
);
}

// 4. 执行启动
bootstrap();
2 changes: 1 addition & 1 deletion frontend/src/pages/DataCleansing/Detail/TaskDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export default function CleansingTaskDetail() {
)}
{activeTab === "operators" && <OperatorTable task={task} />}
{activeTab === "files" && <FileTable result={result} fetchTaskResult={fetchTaskResult} />}
{activeTab === "logs" && <LogsTable taskLog={taskLog} fetchTaskLog={fetchTaskLog} retryCount={task.retryCount} />}
{activeTab === "logs" && <LogsTable taskLog={taskLog} fetchTaskLog={fetchTaskLog} retryCount={task.retryCount} taskName={task.name} />}
</div>
</div>
</>
Expand Down
Loading
Loading