navigate("/agent")}
+ onClick={() => navigate("/chat")}
className="cursor-pointer rounded px-4 py-2 inline-flex items-center bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 text-white shadow-lg"
>
@@ -233,7 +233,7 @@ export default function WelcomePage() {
navigate("/agent")}
+ onClick={() => navigate("/chat")}
className="cursor-pointer rounded px-4 py-2 inline-flex items-center bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 text-white shadow-lg"
>
diff --git a/frontend/src/routes/routes.ts b/frontend/src/routes/routes.ts
index 763abf6..cb867c7 100644
--- a/frontend/src/routes/routes.ts
+++ b/frontend/src/routes/routes.ts
@@ -53,7 +53,7 @@ const router = createBrowserRouter([
Component: withErrorBoundary(Home),
},
{
- path: "/agent",
+ path: "/chat",
Component: withErrorBoundary(AgentPage),
},
{
diff --git a/runtime/label-studio-adapter/app/core/config.py b/runtime/label-studio-adapter/app/core/config.py
index d6cfe5c..09874e1 100644
--- a/runtime/label-studio-adapter/app/core/config.py
+++ b/runtime/label-studio-adapter/app/core/config.py
@@ -10,7 +10,7 @@ class Settings(BaseSettings):
env_file = ".env"
case_sensitive = False
extra = 'ignore' # 允许额外字段(如 Shell 脚本专用的环境变量)
-
+
# =========================
# Adapter 服务配置
# =========================
@@ -18,7 +18,7 @@ class Settings(BaseSettings):
app_version: str = "1.0.0"
app_description: str = "Adapter for integrating Data Management System with Label Studio"
debug: bool = True
-
+
# 服务器配置
host: str = "0.0.0.0"
port: int = 8000
@@ -34,27 +34,27 @@ class Settings(BaseSettings):
mysql_user: Optional[str] = None
mysql_password: Optional[str] = None
mysql_database: Optional[str] = None
-
+
# PostgreSQL数据库配置 (优先级2)
postgres_host: Optional[str] = None
postgres_port: int = 5432
postgres_user: Optional[str] = None
postgres_password: Optional[str] = None
postgres_database: Optional[str] = None
-
+
# SQLite数据库配置 (优先级3 - 兜底)
sqlite_path: str = "data/labelstudio_adapter.db"
-
+
# 直接数据库URL配置(如果提供,将覆盖上述配置)
database_url: Optional[str] = None
-
+
# 日志配置
log_level: str = "INFO"
-
+
# 安全配置
secret_key: str = "your-secret-key-change-this-in-production"
access_token_expire_minutes: int = 30
-
+
# =========================
# Label Studio 服务配置
# =========================
@@ -75,7 +75,7 @@ class Settings(BaseSettings):
# =========================
dm_service_base_url: str = "http://data-engine"
dm_file_path_prefix: str = "/" # DM存储文件夹前缀
-
+
@property
def computed_database_url(self) -> str:
@@ -86,61 +86,61 @@ class Settings(BaseSettings):
# 如果直接提供了database_url,优先使用
if self.database_url:
return self.database_url
-
+
# 优先级1: MySQL
if all([self.mysql_host, self.mysql_user, self.mysql_password, self.mysql_database]):
return f"mysql+aiomysql://{self.mysql_user}:{self.mysql_password}@{self.mysql_host}:{self.mysql_port}/{self.mysql_database}"
-
+
# 优先级2: PostgreSQL
if all([self.postgres_host, self.postgres_user, self.postgres_password, self.postgres_database]):
return f"postgresql+asyncpg://{self.postgres_user}:{self.postgres_password}@{self.postgres_host}:{self.postgres_port}/{self.postgres_database}"
-
+
# 优先级3: SQLite (兜底)
sqlite_full_path = Path(self.sqlite_path).absolute()
# 确保目录存在
sqlite_full_path.parent.mkdir(parents=True, exist_ok=True)
return f"sqlite+aiosqlite:///{sqlite_full_path}"
-
- @property
+
+ @property
def sync_database_url(self) -> str:
"""
用于数据库迁移的同步连接URL
将异步驱动替换为同步驱动
"""
async_url = self.computed_database_url
-
+
# 替换异步驱动为同步驱动
sync_replacements = {
"mysql+aiomysql://": "mysql+pymysql://",
- "postgresql+asyncpg://": "postgresql+psycopg2://",
+ "postgresql+asyncpg://": "postgresql+psycopg2://",
"sqlite+aiosqlite:///": "sqlite:///"
}
-
+
for async_driver, sync_driver in sync_replacements.items():
if async_url.startswith(async_driver):
return async_url.replace(async_driver, sync_driver)
-
+
return async_url
-
+
def get_database_info(self) -> dict:
"""获取数据库配置信息"""
url = self.computed_database_url
-
+
if url.startswith("mysql"):
db_type = "MySQL"
elif url.startswith("postgresql"):
- db_type = "PostgreSQL"
+ db_type = "PostgreSQL"
elif url.startswith("sqlite"):
db_type = "SQLite"
else:
db_type = "Unknown"
-
+
return {
"type": db_type,
"url": url,
"sync_url": self.sync_database_url
}
-
+
# 全局设置实例
-settings = Settings()
\ No newline at end of file
+settings = Settings()
diff --git a/scripts/images/backend/Dockerfile b/scripts/images/backend/Dockerfile
index ea898e7..8bfaff7 100644
--- a/scripts/images/backend/Dockerfile
+++ b/scripts/images/backend/Dockerfile
@@ -41,6 +41,8 @@ RUN dos2unix /opt/backend/start.sh \
&& chmod +x /opt/backend/start.sh \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
+EXPOSE 8080
+
ENTRYPOINT ["/opt/backend/start.sh"]
CMD ["java", "-Duser.timezone=Asia/Shanghai", "-jar", "/opt/backend/data-mate.jar"]
diff --git a/scripts/images/frontend/Dockerfile b/scripts/images/frontend/Dockerfile
index a00267d..d29fa59 100644
--- a/scripts/images/frontend/Dockerfile
+++ b/scripts/images/frontend/Dockerfile
@@ -10,8 +10,10 @@ RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi && \
FROM nginx:1.29 AS runner
COPY --from=builder /app/dist /opt/frontend
-COPY scripts/images/frontend/backend.conf /etc/nginx/conf.d/default.conf
-RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
+RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
+ && rm -f /etc/nginx/conf.d/default.conf
+
+EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
diff --git a/scripts/images/runtime/Dockerfile b/scripts/images/runtime/Dockerfile
index 6d3f8ef..693c7e9 100644
--- a/scripts/images/runtime/Dockerfile
+++ b/scripts/images/runtime/Dockerfile
@@ -5,7 +5,7 @@ COPY runtime/ops /opt/runtime/datamate/ops
ENV PYTHONPATH=/opt/runtime/datamate/
-RUN sed -i 's/deb.debian.org/mirrors.huaweicloud.com/g' /etc/apt/sources.list.d/debian.sources \
+RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources \
&& apt update \
&& apt install -y libgl1 libglib2.0-0 vim poppler-utils tesseract-ocr tesseract-ocr-chi-sim libmagic1t64 libreoffice\
&& apt clean \
@@ -15,8 +15,10 @@ WORKDIR /opt/runtime
ENV HF_HUB_DISABLE_XET=1
-RUN pip install -e . -i https://mirrors.huaweicloud.com/repository/pypi/simple \
- && pip install -r /opt/runtime/datamate/ops/requirements.txt -i https://mirrors.huaweicloud.com/repository/pypi/simple \
+RUN pip install -e . -i https://mirrors.aliyun.com/pypi/simple/ \
+ && pip install -r /opt/runtime/datamate/ops/requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ \
&& pip cache purge
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
+
+EXPOSE 8081
From 4f5a9a9a83ed37ddcd4dca5268faf514ff6b2de2 Mon Sep 17 00:00:00 2001
From: hhhhsc <1710496817@qq.com>
Date: Tue, 28 Oct 2025 16:24:40 +0800
Subject: [PATCH 2/2] refactor: simplify Dockerfile by removing redundant
mirror configurations and cleaning up package installation commands
---
scripts/images/backend/Dockerfile | 7 ++-----
scripts/images/runtime/Dockerfile | 7 +++----
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/scripts/images/backend/Dockerfile b/scripts/images/backend/Dockerfile
index 8bfaff7..b06aad2 100644
--- a/scripts/images/backend/Dockerfile
+++ b/scripts/images/backend/Dockerfile
@@ -1,8 +1,6 @@
FROM maven:3-openjdk-8-slim AS datax-builder
-RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \
- sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \
- apt-get update && \
+RUN apt-get update && \
apt-get install -y git && \
git clone https://github.com/alibaba/DataX.git
@@ -24,8 +22,7 @@ RUN cd /opt/backend && \
FROM openjdk:21-jdk-slim
-RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources && \
- apt-get update && \
+RUN apt-get update && \
apt-get install -y vim wget curl nfs-common rsync python3 python3-pip python-is-python3 dos2unix && \
apt-get clean && \
rm -rf /var/lib/apy/lists/*
diff --git a/scripts/images/runtime/Dockerfile b/scripts/images/runtime/Dockerfile
index 693c7e9..a9171e7 100644
--- a/scripts/images/runtime/Dockerfile
+++ b/scripts/images/runtime/Dockerfile
@@ -5,8 +5,7 @@ COPY runtime/ops /opt/runtime/datamate/ops
ENV PYTHONPATH=/opt/runtime/datamate/
-RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources \
- && apt update \
+RUN apt update \
&& apt install -y libgl1 libglib2.0-0 vim poppler-utils tesseract-ocr tesseract-ocr-chi-sim libmagic1t64 libreoffice\
&& apt clean \
&& rm -rf /var/lib/apt/lists/*
@@ -15,8 +14,8 @@ WORKDIR /opt/runtime
ENV HF_HUB_DISABLE_XET=1
-RUN pip install -e . -i https://mirrors.aliyun.com/pypi/simple/ \
- && pip install -r /opt/runtime/datamate/ops/requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ \
+RUN pip install -e . \
+ && pip install -r /opt/runtime/datamate/ops/requirements.txt \
&& pip cache purge
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime