diff --git a/distribution/linux/euler-copilot-shell.spec b/distribution/linux/euler-copilot-shell.spec index 5a2a83e8aff456000f0835d541f4f265f29858c1..bf3a333d9d54fe65f90071fdceef48e02ea1e3f7 100644 --- a/distribution/linux/euler-copilot-shell.spec +++ b/distribution/linux/euler-copilot-shell.spec @@ -4,7 +4,7 @@ Name: euler-copilot-shell Version: 0.10.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: openEuler Intelligence 智能命令行工具集 License: MulanPSL-2.0 URL: https://gitee.com/openeuler/euler-copilot-shell @@ -49,17 +49,16 @@ openEuler Intelligence 部署安装工具包,包含部署脚本和相关资源 python3 -m venv %{_builddir}/venv source %{_builddir}/venv/bin/activate -# 升级pip和setuptools +# 升级 pip 和 setuptools pip install --upgrade pip setuptools wheel # 安装项目依赖 pip install -r requirements.txt -# 安装PyInstaller +# 安装 PyInstaller pip install pyinstaller # 使用虚拟环境中的 PyInstaller 创建单一可执行文件 -# 使用专用的 .spec 文件解决 Textual 动态导入问题 pyinstaller --noconfirm \ --distpath dist \ oi-cli.spec @@ -100,6 +99,10 @@ ln -sf /usr/lib/openeuler-intelligence/scripts/deploy %{buildroot}%{_bindir}/ope %{_bindir}/openeuler-intelligence-installer %changelog +* Tue Sep 09 2025 openEuler - 0.10.0-4 +- 优化安装脚本:添加内核版本检查和架构支持,优化 MongoDB 和 MinIO 安装逻辑 +- 优化 MCP 交互相关 TUI 样式 + * Thu Sep 04 2025 openEuler - 0.10.0-3 - 部署功能新增支持全量部署(含 RAG、Web) - 允许构建 riscv64 loongarch64 版本 @@ -111,4 +114,28 @@ ln -sf /usr/lib/openeuler-intelligence/scripts/deploy %{buildroot}%{_bindir}/ope * Wed Aug 13 2025 openEuler - 0.10.0-1 - 重构为子包形式:openeuler-intelligence-cli 和 openeuler-intelligence-installer - openeuler-intelligence-cli 替换原 euler-copilot-shell 包 -- 新增 openeuler-intelligence-installer 子包,包含部署安装脚本 \ No newline at end of file +- 新增 openeuler-intelligence-installer 子包,包含部署安装脚本 + +* Thu Jun 26 2025 Wenlong Zhang - 0.9.2-12 +- enable loongarch64 build + +* Fri Jun 20 2025 misaka00251 - 0.9.2-11 +- Enable riscv64 build + +* Tue May 20 2025 Hongyu Shi - 0.9.2-10 +- Fix OpenAI backend issue + +* Mon Apr 07 2025 Hongyu Shi - 0.9.2-9 +- Fix OpenAI backend issue + +* Wed Mar 12 2025 Hongyu Shi - 0.9.2-8 +- Set default backend to openai + +* Mon Mar 10 2025 Hongyu Shi - 0.9.2-7 +- Update build 7 + +* Fri Feb 28 2025 Hongyu Shi - 0.9.2-6 +- Update build 6 + +* Mon Feb 24 2025 Hongyu Shi - 0.9.2-5 +- Add euler-copilot-shell diff --git a/scripts/deploy/1-check-env/check_env.sh b/scripts/deploy/1-check-env/check_env.sh index 021034e7837e7f14e974781c127ec1fd92a6e72b..9d7199608e1e50ed6251d283517aa12ae172dafa 100644 --- a/scripts/deploy/1-check-env/check_env.sh +++ b/scripts/deploy/1-check-env/check_env.sh @@ -9,20 +9,50 @@ INSTALL_MODE_FILE="/etc/euler_Intelligence_install_mode" # 全局模式标记 OFFLINE_MODE=false -is_x86_architecture() { - # 获取系统架构信息(使用 uname -m 或 arch 命令) - local arch - arch=$(uname -m) # 多数系统支持,返回架构名称(如 x86_64、i686、aarch64 等) - # 备选:arch 命令,输出与 uname -m 类似 - # arch=$(arch) - - # x86 架构的常见标识:i386、i686(32位),x86_64(64位) - if [[ $arch == i386 || $arch == i686 || $arch == x86_64 ]]; then - return 0 # 是 x86 架构,返回 0(成功) +# 检查系统版本并返回兼容的 el 版本 +get_el_version() { + # 首先检查是否为 openEuler 系统 + if [ -f "/etc/openEuler-release" ]; then + local openeuler_version + openeuler_version=$(grep -oP 'openEuler release \K[0-9]+\.[0-9]+' /etc/openEuler-release) + + if [ -n "$openeuler_version" ]; then + # 将版本号转换为可比较的数字格式(如 22.03 -> 2203) + local major minor + major=$(echo "$openeuler_version" | cut -d'.' -f1) + minor=$(echo "$openeuler_version" | cut -d'.' -f2) + local version_num=$((major * 100 + minor)) + + # openEuler 22.03 及之前使用 el8,24.03 及之后使用 el9 + if [ $version_num -le 2203 ]; then + echo "8" + return 0 + else + echo "9" + return 0 + fi + fi + fi + + # 如果不是标准的 openEuler 或无法获取版本,则检查内核版本 + echo -e "${COLOR_WARNING}[Warning] 非标准 openEuler 系统,基于内核版本判断 el 版本${COLOR_RESET}" >&2 + local kernel_version + kernel_version=$(uname -r | cut -d'.' -f1,2) + + # 将版本号转换为可比较的数字格式 + local major minor + major=$(echo "$kernel_version" | cut -d'.' -f1) + minor=$(echo "$kernel_version" | cut -d'.' -f2) + local version_num=$((major * 100 + minor)) + + # 内核版本 < 5.14 使用 el8,>= 5.14 使用 el9 + if [ $version_num -lt 514 ]; then + echo "8" else - return 1 # 非 x86 架构,返回 1(失败) + echo "9" fi } + # 安装wget工具 install_wget() { echo -e "${COLOR_INFO}[INFO] 正在尝试安装wget...${COLOR_RESET}" @@ -52,15 +82,31 @@ install_wget() { } # 基础URL列表(无论RAG是否启用都需要检测) -base_urls_x86=( - "https://downloads.mongodb.com/compass/mongodb-mongosh-2.5.2.x86_64.rpm" - "https://repo.mongodb.org/yum/redhat/9/mongodb-org/7.0/x86_64/RPMS/mongodb-org-server-7.0.21-1.el9.x86_64.rpm" -) +get_mongodb_urls() { + local el_version arch + el_version=$(get_el_version) + arch=$(uname -m) + + # 根据架构映射到对应的包架构名称 + case "$arch" in + x86_64 | i386 | i686) + local pkg_arch="x86_64" + ;; + aarch64 | arm64) + local pkg_arch="aarch64" + ;; + *) + echo -e "${COLOR_ERROR}[Error] 不支持的架构: $arch${COLOR_RESET}" + echo -e "${COLOR_ERROR}[Error] 仅支持 x86_64、aarch64 架构${COLOR_RESET}" + return 1 + ;; + esac -base_urls_arm=( - "https://repo.mongodb.org/yum/redhat/9/mongodb-org/7.0/aarch64/RPMS/mongodb-org-server-7.0.21-1.el9.aarch64.rpm" - "https://downloads.mongodb.com/compass/mongodb-mongosh-2.5.2.aarch64.rpm" -) + base_urls=( + "https://downloads.mongodb.com/compass/mongodb-mongosh-2.5.2.${pkg_arch}.rpm" + "https://repo.mongodb.org/yum/redhat/${el_version}/mongodb-org/7.0/${pkg_arch}/RPMS/mongodb-org-server-7.0.21-1.el${el_version}.${pkg_arch}.rpm" + ) +} # RAG专用URL列表(仅当RAG启用时检测) rag_urls=( @@ -87,11 +133,10 @@ check_url_accessibility() { # 根据架构和RAG状态组合最终需要检测的URL列表 local detect_urls=() - if is_x86_architecture; then - detect_urls+=("${base_urls_x86[@]}") - else - detect_urls+=("${base_urls_arm[@]}") - fi + + # 初始化 MongoDB URLs + get_mongodb_urls + detect_urls+=("${base_urls[@]}") # 如果启用RAG,添加RAG专用URL if [ "$RAG_INSTALL" = "y" ]; then diff --git a/scripts/deploy/2-install-dependency/install_openEulerIntelligence.sh b/scripts/deploy/2-install-dependency/install_openEulerIntelligence.sh index e08ded032aa7d174579989d45af3b555a0b7b847..30a3bedf202b02be28f3d183ca1f6878e4ea2e81 100644 --- a/scripts/deploy/2-install-dependency/install_openEulerIntelligence.sh +++ b/scripts/deploy/2-install-dependency/install_openEulerIntelligence.sh @@ -12,6 +12,51 @@ install_success=true missing_pkgs=() LOCAL_REPO_DIR="/var/cache/rpms" LOCAL_REPO_FILE="/etc/yum.repos.d/local.repo" + +# 检查系统版本并返回兼容的 el 版本 +get_el_version() { + # 首先检查是否为 openEuler 系统 + if [ -f "/etc/openEuler-release" ]; then + local openeuler_version + openeuler_version=$(grep -oP 'openEuler release \K[0-9]+\.[0-9]+' /etc/openEuler-release) + + if [ -n "$openeuler_version" ]; then + # 将版本号转换为可比较的数字格式(如 22.03 -> 2203) + local major minor + major=$(echo "$openeuler_version" | cut -d'.' -f1) + minor=$(echo "$openeuler_version" | cut -d'.' -f2) + local version_num=$((major * 100 + minor)) + + # openEuler 22.03 及之前使用 el8,24.03 及之后使用 el9 + if [ $version_num -le 2203 ]; then + echo "8" + return 0 + else + echo "9" + return 0 + fi + fi + fi + + # 如果不是标准的 openEuler 或无法获取版本,则检查内核版本 + echo -e "${COLOR_WARNING}[Warning] 非标准 openEuler 系统,基于内核版本判断 el 版本${COLOR_RESET}" >&2 + local kernel_version + kernel_version=$(uname -r | cut -d'.' -f1,2) + + # 将版本号转换为可比较的数字格式 + local major minor + major=$(echo "$kernel_version" | cut -d'.' -f1) + minor=$(echo "$kernel_version" | cut -d'.' -f2) + local version_num=$((major * 100 + minor)) + + # 内核版本 < 5.14 使用 el8,>= 5.14 使用 el9 + if [ $version_num -lt 514 ]; then + echo "8" + else + echo "9" + fi +} + # 初始化本地仓库 init_local_repo() { [ "$(id -u)" -ne 0 ] && { @@ -51,11 +96,17 @@ EOF install_minio() { echo -e "${COLOR_INFO}[Info] 开始安装MinIO...${COLOR_RESET}" local minio_dir="/opt/minio" + local arch + arch=$(uname -m) + if ! mkdir -p "$minio_dir"; then echo -e "${COLOR_ERROR}[Error] 创建目录失败: $minio_dir${COLOR_RESET}" return 1 fi - ! is_x86_architecture || { + + # 根据架构选择不同的安装方式 + case "$arch" in + x86_64 | i386 | i686) local minio_url="https://dl.min.io/server/minio/release/linux-amd64/archive/minio-20250524170830.0.0-1.x86_64.rpm" local minio_src="../5-resource/rpm/minio-20250524170830.0.0-1.x86_64.rpm" local minio_file="/opt/minio/minio-20250524170830.0.0-1.x86_64.rpm" @@ -78,23 +129,31 @@ install_minio() { } echo -e "${COLOR_SUCCESS}[Success] MinIO安装成功...${COLOR_RESET}" return 0 - } - echo -e "${COLOR_INFO}[Info] 下载MinIO二进制文件(aarch64)...${COLOR_RESET}" - local minio_url="https://dl.min.io/server/minio/release/linux-arm64/minio" - local temp_dir=$minio_dir - local minio_path="../5-resource/rpm/minio" - - # 检查文件是否已存在 - if [ -f "$minio_path" ]; then - cp -r $minio_path $temp_dir - echo -e "${COLOR_INFO}[Info] MinIO二进制文件已存在,跳过下载${COLOR_RESET}" - else - if ! wget -q --show-progress "$minio_url" -O "$temp_dir/minio" --no-check-certificate; then - echo -e "${COLOR_ERROR}[Error] 下载MinIO失败,请检查网络连接${COLOR_RESET}" - rm -rf "$temp_dir" - return 1 + ;; + aarch64 | arm64) + echo -e "${COLOR_INFO}[Info] 下载MinIO二进制文件(aarch64)...${COLOR_RESET}" + local minio_url="https://dl.min.io/server/minio/release/linux-arm64/minio" + local temp_dir=$minio_dir + local minio_path="../5-resource/rpm/minio" + + # 检查文件是否已存在 + if [ -f "$minio_path" ]; then + cp -r $minio_path $temp_dir + echo -e "${COLOR_INFO}[Info] MinIO二进制文件已存在,跳过下载${COLOR_RESET}" + else + if ! wget -q --show-progress "$minio_url" -O "$temp_dir/minio" --no-check-certificate; then + echo -e "${COLOR_ERROR}[Error] 下载MinIO失败,请检查网络连接${COLOR_RESET}" + rm -rf "$temp_dir" + return 1 + fi fi - fi + ;; + *) + echo -e "${COLOR_ERROR}[Error] 不支持的架构: $arch${COLOR_RESET}" + echo -e "${COLOR_ERROR}[Error] 仅支持 x86_64、aarch64 架构${COLOR_RESET}" + return 1 + ;; + esac } # 智能安装函数 smart_install() { @@ -333,37 +392,37 @@ install_zhparser() { echo -e "${COLOR_SUCCESS}[Success] zhparser安装成功${COLOR_RESET}" return 0 } -is_x86_architecture() { - # 获取系统架构信息(使用 uname -m 或 arch 命令) - local arch - arch=$(uname -m) # 多数系统支持,返回架构名称(如 x86_64、i686、aarch64 等) - # 备选:arch 命令,输出与 uname -m 类似 - # arch=$(arch) - - # x86 架构的常见标识:i386、i686(32位),x86_64(64位) - if [[ $arch == i386 || $arch == i686 || $arch == x86_64 ]]; then - return 0 # 是 x86 架构,返回 0(成功) - else - return 1 # 非 x86 架构,返回 1(失败) - fi -} # 安装配置mongodb install_mongodb() { - local mongodb_server_url="https://repo.mongodb.org/yum/redhat/9/mongodb-org/7.0/x86_64/RPMS/mongodb-org-server-7.0.21-1.el9.x86_64.rpm" - local mongodb_mongosh_url="https://downloads.mongodb.com/compass/mongodb-mongosh-2.5.2.x86_64.rpm" - local mongodb_server_arm_url="https://repo.mongodb.org/yum/redhat/9/mongodb-org/7.0/aarch64/RPMS/mongodb-org-server-7.0.21-1.el9.aarch64.rpm" - local mongodb_mongosh_arm_url="https://downloads.mongodb.com/compass/mongodb-mongosh-2.5.2.aarch64.rpm" - - is_x86_architecture || { - mongodb_server_url=$mongodb_server_arm_url - mongodb_mongosh_url=$mongodb_mongosh_arm_url - } + local el_version arch + el_version=$(get_el_version) + arch=$(uname -m) + + # 根据架构映射到对应的包架构名称 + local pkg_arch mongodb_server_url mongodb_mongosh_url + case "$arch" in + x86_64 | i386 | i686) + pkg_arch="x86_64" + ;; + aarch64 | arm64) + pkg_arch="aarch64" + ;; + *) + echo -e "${COLOR_ERROR}[Error] 不支持的架构: $arch${COLOR_RESET}" + echo -e "${COLOR_ERROR}[Error] 仅支持 x86_64、aarch64 架构${COLOR_RESET}" + return 1 + ;; + esac + + mongodb_server_url="https://repo.mongodb.org/yum/redhat/${el_version}/mongodb-org/7.0/${pkg_arch}/RPMS/mongodb-org-server-7.0.21-1.el${el_version}.${pkg_arch}.rpm" + mongodb_mongosh_url="https://downloads.mongodb.com/compass/mongodb-mongosh-2.5.2.${pkg_arch}.rpm" + local mongodb_dir="/opt/mongodb" - local mongodb_server="/opt/mongodb/mongodb-org-server-7.0.21-1.el9.x86_64.rpm" - local mongodb_server_src="../5-resource/rpm/mongodb-org-server-7.0.21-1.el9.x86_64.rpm" - local mongodb_mongosh="/opt/mongodb/mongodb-mongosh-2.5.2.x86_64.rpm" - local mongodb_mongosh_src="../5-resource/rpm/mongodb-mongosh-2.5.2.x86_64.rpm" + local mongodb_server="/opt/mongodb/mongodb-org-server-7.0.21-1.el${el_version}.${pkg_arch}.rpm" + local mongodb_server_src="../5-resource/rpm/mongodb-org-server-7.0.21-1.el${el_version}.${pkg_arch}.rpm" + local mongodb_mongosh="/opt/mongodb/mongodb-mongosh-2.5.2.${pkg_arch}.rpm" + local mongodb_mongosh_src="../5-resource/rpm/mongodb-mongosh-2.5.2.${pkg_arch}.rpm" echo -e "${COLOR_INFO}[Info] 开始安装MongoDB...${COLOR_RESET}" if rpm -q mongod &>/dev/null; then echo -e "${COLOR_WARNING}[Warning] MongoDB 已安装,当前版本: $(rpm -q mongod)${COLOR_RESET}" @@ -398,7 +457,7 @@ install_mongodb() { return 1 fi fi - dnf install -y $mongodb_server || { + dnf install -y "$mongodb_server" || { echo -e "${COLOR_ERROR}[Error] MongoDB server安装失败${COLOR_RESET}" return 1 } @@ -466,6 +525,9 @@ install_mongodb() { } check_pip_rag() { + local need_install=0 + local install_list=() + # 定义需要检查的包和版本 declare -A REQUIRED_PACKAGES=( ["sqlalchemy"]="2.0.23" @@ -474,9 +536,6 @@ check_pip_rag() { ["tiktoken"]="" ) - local need_install=0 - local install_list=() - echo -e "${COLOR_INFO}[Info] 检查Python依赖包...${COLOR_RESET}" # 检查每个包是否需要安装 @@ -519,6 +578,9 @@ check_pip_rag() { } check_pip_framework() { + local need_install=0 + local install_list=() + # 获取 Python 版本 local python_version python_version=$(python3 --version 2>&1 | grep -oP '\d+\.\d+' | head -1) @@ -547,9 +609,6 @@ check_pip_framework() { return 1 fi - local need_install=0 - local install_list=() - echo -e "${COLOR_INFO}[Info] 检查Python依赖包...${COLOR_RESET}" # 检查每个包是否需要安装 diff --git a/src/app/css/styles.tcss b/src/app/css/styles.tcss index 19578663eb2862f121665955b54709fd3821ebe6..43004c173cc327b8a93268813d15fa79ca8944e6 100644 --- a/src/app/css/styles.tcss +++ b/src/app/css/styles.tcss @@ -35,7 +35,6 @@ Static { #input-container { height: auto; min-height: 3; - max-height: 12; dock: bottom; padding: 0 1; border-top: solid #688efd; @@ -261,17 +260,15 @@ BackendRequiredDialog { /* MCP 组件样式 */ #mcp-confirm, #mcp-parameter { height: auto; - min-height: 10; width: 100%; padding: 1; border: solid #ff9800; background: #1a1a1a; } -/* MCP 模式下的输入容器 - 确保按钮可见 */ +/* MCP 模式下的输入容器 */ #input-container.mcp-mode { height: auto; - min-height: 10; } /* 正常模式下的输入容器 */ @@ -285,7 +282,7 @@ BackendRequiredDialog { .confirm-info { text-align: left; color: #ffffff; - height: 1; + height: auto; padding: 0 1; margin-bottom: 1; } @@ -293,8 +290,7 @@ BackendRequiredDialog { .confirm-reason { text-align: left; color: #cccccc; - height: 1; - max-height: 2; + height: auto; padding: 0 1; margin-bottom: 1; text-style: italic; @@ -302,10 +298,18 @@ BackendRequiredDialog { .confirm-buttons { height: 3; - min-height: 3; align: center middle; - margin-top: 1; - dock: bottom; + margin-top: 0; +} + +/* MCP 组件内部容器样式 - 防止占用全部空间 */ +#mcp-confirm > Vertical, #mcp-parameter > Vertical { + height: auto; +} + +.mcp-content { + height: auto; + layout: vertical; } .help-text { @@ -331,15 +335,15 @@ BackendRequiredDialog { text-align: center; text-style: bold; color: #2196f3; - margin-bottom: 1; - height: 1; + margin-bottom: 0; + height: auto; padding: 0 1; } .param-tool { text-align: left; color: #4caf50; - height: 1; + height: auto; padding: 0 1; margin-bottom: 0; } @@ -349,7 +353,7 @@ BackendRequiredDialog { color: #ffffff; height: auto; padding: 0 1; - margin-bottom: 1; + margin-bottom: 0; } .param-input-compact { @@ -358,9 +362,9 @@ BackendRequiredDialog { } .param-buttons { - height: 4; + height: 3; align: center middle; - margin-top: 1; + margin-top: 0; } /* MCP 按钮样式 */ diff --git a/src/app/deployment/agent.py b/src/app/deployment/agent.py index de9788d7c06dcae7e01139bd0b44b33c537db46b..71887f909246adefe2db94c1f623c4946d82e7e7 100644 --- a/src/app/deployment/agent.py +++ b/src/app/deployment/agent.py @@ -388,16 +388,20 @@ class AgentManager: async def initialize_agents( self, + state: DeploymentState, progress_callback: Callable[[DeploymentState], None] | None = None, ) -> AgentInitStatus: """ 初始化智能体 + Args: + state: 主部署流程的状态对象 + progress_callback: 进度回调函数 + Returns: AgentInitStatus: 初始化状态 (SUCCESS/SKIPPED/FAILED) """ - state = DeploymentState() self._report_progress(state, "[bold blue]开始初始化智能体...[/bold blue]", progress_callback) try: diff --git a/src/app/deployment/service.py b/src/app/deployment/service.py index 1bb3580a5912e6b94eb3b6e023ba723a76b324b5..c772ddcd02eb05a574ceed0f7eb72d6c909d5afb 100644 --- a/src/app/deployment/service.py +++ b/src/app/deployment/service.py @@ -965,7 +965,7 @@ class DeploymentService: # 初始化 Agent 和 MCP 服务 agent_manager = AgentManager(server_ip=server_ip, server_port=server_port) - init_status = await agent_manager.initialize_agents(progress_callback) + init_status = await agent_manager.initialize_agents(self.state, progress_callback) if init_status == AgentInitStatus.SUCCESS: self.state.add_log("✓ Agent 初始化完成") diff --git a/src/app/mcp_widgets.py b/src/app/mcp_widgets.py index 9c930cc15637bfe849767d935a7d00ee98482f36..12cdd3840a99ae6717c95a3a8604473545ec346c 100644 --- a/src/app/mcp_widgets.py +++ b/src/app/mcp_widgets.py @@ -53,7 +53,7 @@ class MCPConfirmWidget(Container): risk_icon, risk_text = risk_info - with Vertical(): + with Vertical(classes="mcp-content"): # 紧凑的工具确认信息显示 yield Static( f"🔧 {step_name} {risk_icon} {risk_text}", @@ -162,7 +162,7 @@ class MCPParameterWidget(Container): message = content.get("message", "需要补充参数") params = content.get("params", {}) - with Vertical(): + with Vertical(classes="mcp-content"): # 紧凑的参数输入标题 yield Static("📝 参数输入", classes="param-header", markup=False) yield Static(f"🔧 {step_name}", classes="param-tool", markup=False)