diff --git a/scripts/deploy/3-install-server/init_config.sh b/scripts/deploy/3-install-server/init_config.sh index 7e7b1ab25f78e7c8b2699fec9e3b140a605f4d92..f08433b50dc73ecfef2a4cbf8408d2b723e941d6 100644 --- a/scripts/deploy/3-install-server/init_config.sh +++ b/scripts/deploy/3-install-server/init_config.sh @@ -547,8 +547,8 @@ install_rag() { # 配置文件处理 local env_file="../5-resource/env" local env_target="/etc/euler-copilot-rag/data_chain/env" - local service_file="../5-resource/rag.service" - local service_target="/etc/systemd/system/rag.service" + local service_file="../5-resource/oi-rag.service" + local service_target="/etc/systemd/system/oi-rag.service" # 复制配置文件(验证文件存在性) if [[ -f "$env_file" ]]; then @@ -575,22 +575,22 @@ install_rag() { fi # 启动服务 - echo -e "${COLOR_INFO}[Info] 设置并启动 rag 服务...${COLOR_RESET}" + echo -e "${COLOR_INFO}[Info] 设置并启动 oi-rag 服务...${COLOR_RESET}" systemctl daemon-reload - systemctl enable --now rag || { - echo -e "${COLOR_ERROR}[Error] rag 服务启动失败!${COLOR_RESET}" - systemctl status rag --no-pager + systemctl enable --now oi-rag || { + echo -e "${COLOR_ERROR}[Error] oi-rag 服务启动失败!${COLOR_RESET}" + systemctl status oi-rag --no-pager return 1 } # 验证服务状态 - echo -e "${COLOR_INFO}[Info] 验证 rag 服务状态...${COLOR_RESET}" - if systemctl is-active --quiet rag; then - echo -e "${COLOR_SUCCESS}[Success] rag 服务运行正常${COLOR_RESET}" - systemctl status rag --no-pager | grep -E "Active:|Loaded:" + echo -e "${COLOR_INFO}[Info] 验证 oi-rag 服务状态...${COLOR_RESET}" + if systemctl is-active --quiet oi-rag; then + echo -e "${COLOR_SUCCESS}[Success] oi-rag 服务运行正常${COLOR_RESET}" + systemctl status oi-rag --no-pager | grep -E "Active:|Loaded:" else - echo -e "${COLOR_ERROR}[Error] rag 服务未运行!${COLOR_RESET}" - journalctl -u rag --no-pager -n 20 + echo -e "${COLOR_ERROR}[Error] oi-rag 服务未运行!${COLOR_RESET}" + journalctl -u oi-rag --no-pager -n 20 return 1 fi @@ -728,8 +728,8 @@ install_framework() { # 5. 配置文件处理 local framework_file="../5-resource/config.toml" local framework_target="/etc/euler-copilot-framework/config.toml" - local framework_service_file="../5-resource/framework.service" - local framework_service_target="/etc/systemd/system/framework.service" + local framework_service_file="../5-resource/oi-runtime.service" + local framework_service_target="/etc/systemd/system/oi-runtime.service" # 检查源文件是否存在 for file in "$framework_file" "$framework_service_file"; do @@ -830,23 +830,23 @@ EOF } # 8. 启动服务 - echo -e "${COLOR_INFO}[Info] 启动 framework 服务...${COLOR_RESET}" + echo -e "${COLOR_INFO}[Info] 启动 oi-runtime 服务...${COLOR_RESET}" systemctl daemon-reload || { echo -e "${COLOR_ERROR}[Error] systemd 配置重载失败${COLOR_RESET}" return 1 } - if ! systemctl enable --now framework; then - echo -e "${COLOR_ERROR}[Error] 无法启动 framework 服务${COLOR_RESET}" - systemctl status framework --no-pager + if ! systemctl enable --now oi-runtime; then + echo -e "${COLOR_ERROR}[Error] 无法启动 oi-runtime 服务${COLOR_RESET}" + systemctl status oi-runtime --no-pager return 1 fi # 9. 验证服务状态 echo -e "${COLOR_INFO}[Info] 检查服务状态...${COLOR_RESET}" - if ! systemctl is-active --quiet framework; then - echo -e "${COLOR_ERROR}[Error] framework 服务未运行${COLOR_RESET}" - journalctl -u framework --no-pager -n 20 + if ! systemctl is-active --quiet oi-runtime; then + echo -e "${COLOR_ERROR}[Error] oi-runtime 服务未运行${COLOR_RESET}" + journalctl -u oi-runtime --no-pager -n 20 return 1 fi diff --git a/scripts/deploy/3-install-server/init_mcpserver.sh b/scripts/deploy/3-install-server/init_mcpserver.sh index 30bde8b1ff9cd8a6543a6ebce4c1de0eb3422669..c05d2c946d3f877aad4ff85ab589c988ce3c8a88 100644 --- a/scripts/deploy/3-install-server/init_mcpserver.sh +++ b/scripts/deploy/3-install-server/init_mcpserver.sh @@ -3,7 +3,6 @@ COLOR_INFO='\033[34m' # 蓝色信息 COLOR_SUCCESS='\033[32m' # 绿色成功 COLOR_ERROR='\033[31m' # 红色错误 -COLOR_WARNING='\033[33m' # 黄色警告 COLOR_RESET='\033[0m' # 重置颜色 init_mcp_config() { @@ -53,120 +52,120 @@ start_bak() { } # 执行MCP配置初始化 - echo -e "${COLOR_INFO}[Info] 开始执行MCP配置初始化...${COLOR_RESET}" + echo -e "${COLOR_INFO}[Info] 开始执行 MCP 配置初始化...${COLOR_RESET}" init_mcp_config local init_result=$? if [ $init_result -ne 0 ]; then - echo -e "${COLOR_ERROR}[Error] MCP配置初始化失败,终止执行${COLOR_RESET}" + echo -e "${COLOR_ERROR}[Error] MCP 配置初始化失败,终止执行${COLOR_RESET}" return $init_result fi - # 重启framework服务 - echo -e "${COLOR_INFO}[Info] 开始重启framework服务...${COLOR_RESET}" - if ! systemctl restart framework; then - echo -e "${COLOR_ERROR}[Error] framework服务重启失败${COLOR_RESET}" + # 重启 oi-runtime 服务 + echo -e "${COLOR_INFO}[Info] 开始重启 oi-runtime 服务...${COLOR_RESET}" + if ! systemctl restart oi-runtime; then + echo -e "${COLOR_ERROR}[Error] oi-runtime 服务重启失败${COLOR_RESET}" return 1 fi # 检查服务状态 - echo -e "${COLOR_INFO}[Info] 验证framework服务状态...${COLOR_RESET}" + echo -e "${COLOR_INFO}[Info] 验证 oi-runtime 服务状态...${COLOR_RESET}" sleep 5 - if systemctl is-active --quiet framework; then - echo -e "${COLOR_SUCCESS}[Success] framework服务重启成功并正常运行${COLOR_RESET}" + if systemctl is-active --quiet oi-runtime; then + echo -e "${COLOR_SUCCESS}[Success] oi-runtime 服务重启成功并正常运行${COLOR_RESET}" return 0 else - echo -e "${COLOR_ERROR}[Error] framework服务重启后未正常运行${COLOR_RESET}" + echo -e "${COLOR_ERROR}[Error] oi-runtime 服务重启后未正常运行${COLOR_RESET}" return 1 fi - sleep 10 - python3 "../4-other-script/init_agent.py" >client_info.tmp 2>&1 } # 日志输出函数 info() { - echo -e "${COLOR_INFO}[Info] $1${COLOR_RESET}" + echo -e "${COLOR_INFO}[Info] $1${COLOR_RESET}" } warn() { - echo -e "${COLOR_WARN}[Warn] $1${COLOR_RESET}" + echo -e "${COLOR_WARN}[Warn] $1${COLOR_RESET}" } error() { - echo -e "${COLOR_ERROR}[Error] $1${COLOR_RESET}" >&2 # 错误信息输出到 stderr + echo -e "${COLOR_ERROR}[Error] $1${COLOR_RESET}" >&2 # 错误信息输出到 stderr } main() { - # 获取脚本所在的绝对路径 - SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) - if [ -z "$SCRIPT_DIR" ]; then - error "无法获取脚本所在目录路径" - return 1 - fi - info "脚本所在目录: ${COLOR_BOLD}$SCRIPT_DIR${COLOR_RESET}" + # 获取脚本所在的绝对路径 + SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) + if [ -z "$SCRIPT_DIR" ]; then + error "无法获取脚本所在目录路径" + return 1 + fi + info "脚本所在目录: ${COLOR_BOLD}$SCRIPT_DIR${COLOR_RESET}" - # 切换到脚本所在目录 - info "切换到脚本目录" - cd "$SCRIPT_DIR" || { - error "无法切换到脚本目录: $SCRIPT_DIR" - return 1 - } + # 切换到脚本所在目录 + info "切换到脚本目录" + cd "$SCRIPT_DIR" || { + error "无法切换到脚本目录: $SCRIPT_DIR" + return 1 + } - # 定义配置文件目录和脚本路径 - local mcp_config_root="../5-resource/mcp_config" - local agent_manager_script="../4-other-script/agent_manager.py" + # 定义配置文件目录和脚本路径 + local mcp_config_root="../5-resource/mcp_config" + local agent_manager_script="../4-other-script/agent_manager.py" - # 检查配置文件根目录是否存在 - if [ ! -d "$mcp_config_root" ]; then - error "配置文件根目录不存在: $mcp_config_root" - return 1 - fi + # 检查配置文件根目录是否存在 + if [ ! -d "$mcp_config_root" ]; then + error "配置文件根目录不存在: $mcp_config_root" + return 1 + fi - # 检查管理脚本是否存在 - if [ ! -f "$agent_manager_script" ]; then - error "agent_manager.py 脚本不存在: $agent_manager_script" - return 1 + # 检查管理脚本是否存在 + if [ ! -f "$agent_manager_script" ]; then + error "agent_manager.py 脚本不存在: $agent_manager_script" + return 1 + fi + # 遍历所有子目录下的 config.json 文件 + info "开始查找配置文件: $mcp_config_root/**/config.json" + local config_files + config_files=$(find "$mcp_config_root" -type f -name "config.json") + + # 检查是否找到配置文件 + if [ -z "$config_files" ]; then + warn "未在 $mcp_config_root 下找到任何 config.json 文件" + return 0 + fi + + # 统计配置文件数量 + local file_count + file_count=$(echo "$config_files" | wc -l | tr -d ' ') + info "共找到 ${COLOR_BOLD}$file_count${COLOR_RESET} 个配置文件,开始处理..." + + # 遍历配置文件并执行初始化和创建操作 + local index=1 + while IFS= read -r config_file; do + # 转换为绝对路径 + local abs_config + abs_config=$(realpath "$config_file") + info "\n===== 处理第 $index/$file_count 个配置文件 =====" + info "配置文件路径: $abs_config" + # 执行 init 操作 + info "执行初始化: python3 $agent_manager_script init $abs_config" + if python3 "$agent_manager_script" init "$abs_config"; then + info "初始化成功: $abs_config" + else + warn "继续处理下一个配置文件" fi - # 遍历所有子目录下的 config.json 文件 - info "开始查找配置文件: $mcp_config_root/**/config.json" - local config_files - config_files=$(find "$mcp_config_root" -type f -name "config.json") - - # 检查是否找到配置文件 - if [ -z "$config_files" ]; then - warn "未在 $mcp_config_root 下找到任何 config.json 文件" - return 0 + + # 执行 create 操作 + info "执行创建: python3 $agent_manager_script create $abs_config" + if python3 "$agent_manager_script" create "$abs_config"; then + info "创建成功: $abs_config" + else + warn "继续处理下一个配置文件" fi - # 统计配置文件数量 - local file_count=$(echo "$config_files" | wc -l | tr -d ' ') - info "共找到 ${COLOR_BOLD}$file_count${COLOR_RESET} 个配置文件,开始处理..." - - # 遍历配置文件并执行初始化和创建操作 - local index=1 - while IFS= read -r config_file; do - # 转换为绝对路径 - local abs_config=$(realpath "$config_file") - info "\n===== 处理第 $index/$file_count 个配置文件 =====" - info "配置文件路径: $abs_config" - # 执行 init 操作 - info "执行初始化: python3 $agent_manager_script init $abs_config" - if python3 "$agent_manager_script" init "$abs_config"; then - info "初始化成功: $abs_config" - else - warn "继续处理下一个配置文件" - fi - - # 执行 create 操作 - info "执行创建: python3 $agent_manager_script create $abs_config" - if python3 "$agent_manager_script" create "$abs_config"; then - info "创建成功: $abs_config" - else - warn "继续处理下一个配置文件" - fi - - index=$((index + 1)) - done <<< "$config_files" - - info "\n===== 所有配置文件处理完成 =====" - return 0 + index=$((index + 1)) + done <<<"$config_files" + + info "\n===== 所有配置文件处理完成 =====" + return 0 } # 执行主函数 diff --git a/scripts/deploy/3-install-server/uninstall_server.sh b/scripts/deploy/3-install-server/uninstall_server.sh index 4f1e76b1f592f1acdb7d78dc16ee35d9a78d6cd4..c9294863bcf7649edb9e99145ee2c33d9e9e4f4d 100644 --- a/scripts/deploy/3-install-server/uninstall_server.sh +++ b/scripts/deploy/3-install-server/uninstall_server.sh @@ -50,13 +50,13 @@ uninstall_tika() { fi } is_x86_architecture() { - local arch - arch=$(uname -m) - if [[ $arch == i386 || $arch == i686 || $arch == x86_64 ]]; then - return 0 # 是 x86 架构,返回 0(成功) - else - return 1 # 非 x86 架构,返回 1(失败) - fi + local arch + arch=$(uname -m) + if [[ $arch == i386 || $arch == i686 || $arch == x86_64 ]]; then + return 0 # 是 x86 架构,返回 0(成功) + else + return 1 # 非 x86 架构,返回 1(失败) + fi } uninstall_server() { uninstall_tika @@ -78,8 +78,8 @@ uninstall_server() { flag=1 elif [[ "$pkg" = "euler-copilot-web" || "$pkg" = "euler-copilot-witchaind-web" || "$pkg" = "euler-copilot-rag" ]]; then : # 什么都不做 - elif [ "$pkg" = "minio" ];then - if is_x86_architecture;then + elif [ "$pkg" = "minio" ]; then + if is_x86_architecture; then dnf remove -y "$pkg" >/dev/null 2>&1 else systemctl stop minio >/dev/null 2>&1 @@ -94,7 +94,7 @@ uninstall_server() { fi elif [ "$pkg" = "euler-copilot-framework" ]; then - systemctl stop framework + systemctl stop oi-runtime else systemctl stop $pkg fi @@ -125,8 +125,8 @@ uninstall_server() { rm -rf /etc/euler-copilot-rag rm -rf /etc/euler_Intelligence_install_mode rm -rf /etc/nginx/conf.d/authhub.nginx.conf.bak - rm -rf /etc/systemd/system/framework.service - rm -rf /etc/systemd/system/multi-user.target.wants/framework.service + rm -rf /etc/systemd/system/oi-runtime.service + rm -rf /etc/systemd/system/multi-user.target.wants/oi-runtime.service # 清理系统配置 systemctl daemon-reload diff --git a/scripts/deploy/5-resource/rag.service b/scripts/deploy/5-resource/oi-rag.service similarity index 100% rename from scripts/deploy/5-resource/rag.service rename to scripts/deploy/5-resource/oi-rag.service diff --git a/scripts/deploy/5-resource/framework.service b/scripts/deploy/5-resource/oi-runtime.service similarity index 100% rename from scripts/deploy/5-resource/framework.service rename to scripts/deploy/5-resource/oi-runtime.service diff --git a/scripts/deploy/deploy.sh b/scripts/deploy/deploy.sh index a71f31ec3ca2035fcfeada2d9cc484c475281db3..d5827a3ec6bd01d73422c9529acd9930f47aa4ba 100644 --- a/scripts/deploy/deploy.sh +++ b/scripts/deploy/deploy.sh @@ -45,8 +45,8 @@ show_sub_model_menu() { echo "==============================" echo " 手动分步部署菜单 " echo "==============================" - echo "1) 轻量部署 # 仅部署framework框架服务" - echo "2) 全量部署 # 带有web界面和rag知识库" + echo "1) 轻量部署 # 仅部署 oi-runtime 服务" + echo "2) 全量部署 # 带有 Web 界面和知识库" echo "3) 返回主菜单" echo "==============================" echo -n "请输入选项编号(1-3): " @@ -58,8 +58,8 @@ show_restart_menu() { echo "==============================" echo "可重启的服务列表:" echo "1) authhub" - echo "2) framework" - echo "3) rag" + echo "2) oi-runtime" + echo "3) oi-rag" echo "4) mysql" echo "5) redis" echo "6) postgresql" @@ -349,8 +349,8 @@ while true; do read -r restart_choice case $restart_choice in 1) service="authhub" ;; - 2) service="framework" ;; - 3) service="rag" ;; + 2) service="oi-runtime" ;; + 3) service="oi-rag" ;; 4) service="mysqld" ;; 5) service="redis" ;; 6) service="postgresql" ;; diff --git "a/scripts/deploy/\345\256\211\350\243\205\351\203\250\347\275\262\346\211\213\345\206\214.md" "b/scripts/deploy/\345\256\211\350\243\205\351\203\250\347\275\262\346\211\213\345\206\214.md" index a421c7c0ed1505941295b003da0411ceca536858..c8d617fae66bcd2496c8a6eceeb61eb6c51ccbe3 100644 --- "a/scripts/deploy/\345\256\211\350\243\205\351\203\250\347\275\262\346\211\213\345\206\214.md" +++ "b/scripts/deploy/\345\256\211\350\243\205\351\203\250\347\275\262\346\211\213\345\206\214.md" @@ -62,8 +62,8 @@ dnf install openeuler-intelligence-installer -rwxr-xr-x. 1 root root 1681126 2025年 7月16日 9b5ad71b2ce5302211f9c61530b329a4922fc6a4 -rwxr-xr-x. 1 root root 1340 7月10日 15:40 config.toml -rwxr-xr-x. 1 root root 1460 2025年 7月16日 env --rwxr-xr-x. 1 root root 414 2025年 7月16日 framework.service --rwxr-xr-x. 1 root root 409 2025年 7月16日 rag.service +-rwxr-xr-x. 1 root root 414 2025年 7月16日 oi-runtime.service +-rwxr-xr-x. 1 root root 409 2025年 7月16日 oi-rag.service -rwxr-xr-x. 1 root root 65697210 2025年 7月16日 tika-server-standard-3.2.0.jar -rwxr-xr-x. 1 root root 312 2025年 7月16日 tika.service -rwxr-xr-x. 1 root root 868 2025年 7月16日 token.py @@ -120,7 +120,7 @@ domain = '192.168.2.112' #修改ip为部署服务器ip 4) 退出程序 请输入选项编号(0-4): -说明:0 是默认轻量部署,只部署framework框架;1 手动部署支持选择轻量部署还是全量部署,全量部署包含web端和知识库rag。 +说明:0 是默认轻量部署,只部署 oi-runtime 后端服务;1 手动部署支持选择轻量部署还是全量部署,全量部署包含 Web 端和知识库。 一键部署完openeuler-intelligence之后,轻量部署需要调用下面的初始化agent来构建agent服务。如果是全量部署,可以在web界面进行agent的构建。 ``` diff --git a/scripts/tools/uninstaller.sh b/scripts/tools/uninstaller.sh index 1e9bdb6399d119a754246076a69084f5369111eb..229aaa6e8e1a9b8c668faf831c40b244d3668574 100755 --- a/scripts/tools/uninstaller.sh +++ b/scripts/tools/uninstaller.sh @@ -87,7 +87,7 @@ uninstall_full() { echo "Stopping services..." # For each expected service, first check if the unit file exists, then stop if running and disable it. -for svc in framework rag tika authhub; do +for svc in oi-runtime oi-rag tika authhub; do unit="${svc}.service" # Check if the service unit exists on the system if systemctl list-unit-files --type=service | awk '{print $1}' | grep -Fxq "$unit"; then diff --git a/src/app/deployment/service.py b/src/app/deployment/service.py index c772ddcd02eb05a574ceed0f7eb72d6c909d5afb..59f4547a44abc20714b7347471ba89ac3a4c3a98 100644 --- a/src/app/deployment/service.py +++ b/src/app/deployment/service.py @@ -414,7 +414,7 @@ class DeploymentService: progress_callback: Callable[[DeploymentState], None] | None, ) -> bool: """执行所有部署步骤""" - # 检查并停止旧的 framework 服务 + # 检查并停止旧的 oi-runtime 服务 if not await self._check_and_stop_old_service(progress_callback): return False @@ -843,8 +843,8 @@ class DeploymentService: server_port: int, progress_callback: Callable[[DeploymentState], None] | None, ) -> bool: - """检查 framework 服务健康状态""" - # 1. 检查 systemctl framework 服务状态 + """检查 oi-runtime 服务健康状态""" + # 1. 检查 systemctl oi-runtime 服务状态 if not await self._check_systemctl_service_status(progress_callback): return False @@ -855,12 +855,12 @@ class DeploymentService: self, progress_callback: Callable[[DeploymentState], None] | None, ) -> bool: - """检查 systemctl framework 服务状态,每2秒检查一次,5次后超时""" + """检查 systemctl oi-runtime 服务状态,每2秒检查一次,5次后超时""" max_attempts = 5 check_interval = 2.0 # 2秒 for attempt in range(1, max_attempts + 1): - self.state.add_log(f"检查 framework 服务状态 ({attempt}/{max_attempts})...") + self.state.add_log(f"检查 oi-runtime 服务状态 ({attempt}/{max_attempts})...") if progress_callback: progress_callback(self.state) @@ -870,7 +870,7 @@ class DeploymentService: process = await asyncio.create_subprocess_exec( "systemctl", "is-active", - "framework", + "oi-runtime", stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, ) @@ -902,7 +902,7 @@ class DeploymentService: server_port: int, progress_callback: Callable[[DeploymentState], None] | None, ) -> bool: - """检查 framework API 健康状态,每10秒检查一次,5分钟后超时""" + """检查 oi-runtime API 健康状态,每10秒检查一次,5分钟后超时""" max_attempts = 30 check_interval = 10.0 # 10秒 api_url = f"http://{server_ip}:{server_port}/api/user" @@ -1055,7 +1055,7 @@ class DeploymentService: progress_callback: Callable[[DeploymentState], None] | None, ) -> bool: """ - 检查并停止旧的 framework 和 rag 服务 + 检查并停止旧的 oi-runtime 和 oi-rag 服务 Args: progress_callback: 进度回调函数 @@ -1067,7 +1067,7 @@ class DeploymentService: if progress_callback: progress_callback(self.state) - services_to_check = ["framework", "rag"] + services_to_check = ["oi-runtime", "oi-rag"] for service_name in services_to_check: try: