diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..f63f5a9cf3498818a73068495709cceed67efd6a --- /dev/null +++ b/LICENSE @@ -0,0 +1,194 @@ +木兰宽松许可证,第2版 + +木兰宽松许可证,第2版 + +2020年1月 http://license.coscl.org.cn/MulanPSL2 + +您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第2版(“本许可证”)的如下条款的约束: + +0. 定义 + +“软件” 是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。 + +“贡献” 是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。 + +“贡献者” 是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。 + +“法人实体” 是指提交贡献的机构及其“关联实体”。 + +“关联实体” 是指,对“本许可证”下的行为方而言,控制、受控制或与其共同受控制的机构,此处的控制是 +指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。 + +1. 授予版权许可 + +每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可 +以复制、使用、修改、分发其“贡献”,不论修改与否。 + +2. 授予专利许可 + +每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定 +撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡 +献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软 +件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“ +关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或 +其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权 +行动之日终止。 + +3. 无商标许可 + +“本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定 +的声明义务而必须使用除外。 + +4. 分发限制 + +您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“ +本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。 + +5. 免责声明与责任限制 + +“软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对 +任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于 +何种法律理论,即使其曾被建议有此种损失的可能性。 + +6. 语言 + +“本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文 +版为准。 + +条款结束 + +如何将木兰宽松许可证,第2版,应用到您的软件 + +如果您希望将木兰宽松许可证,第2版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步: + +1, 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字; + +2, 请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中; + +3, 请将如下声明文本放入每个源文件的头部注释中。 + +Copyright (c) [Year] [name of copyright holder] +[Software Name] is licensed under Mulan PSL v2. +You can use this software according to the terms and conditions of the Mulan +PSL v2. +You may obtain a copy of Mulan PSL v2 at: + http://license.coscl.org.cn/MulanPSL2 +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +See the Mulan PSL v2 for more details. + +Mulan Permissive Software License,Version 2 + +Mulan Permissive Software License,Version 2 (Mulan PSL v2) + +January 2020 http://license.coscl.org.cn/MulanPSL2 + +Your reproduction, use, modification and distribution of the Software shall +be subject to Mulan PSL v2 (this License) with the following terms and +conditions: + +0. Definition + +Software means the program and related documents which are licensed under +this License and comprise all Contribution(s). + +Contribution means the copyrightable work licensed by a particular +Contributor under this License. + +Contributor means the Individual or Legal Entity who licenses its +copyrightable work under this License. + +Legal Entity means the entity making a Contribution and all its +Affiliates. + +Affiliates means entities that control, are controlled by, or are under +common control with the acting entity under this License, ‘control’ means +direct or indirect ownership of at least fifty percent (50%) of the voting +power, capital or other securities of controlled or commonly controlled +entity. + +1. Grant of Copyright License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to you a perpetual, worldwide, royalty-free, non-exclusive, +irrevocable copyright license to reproduce, use, modify, or distribute its +Contribution, with modification or not. + +2. Grant of Patent License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to you a perpetual, worldwide, royalty-free, non-exclusive, +irrevocable (except for revocation under this Section) patent license to +make, have made, use, offer for sale, sell, import or otherwise transfer its +Contribution, where such patent license is only limited to the patent claims +owned or controlled by such Contributor now or in future which will be +necessarily infringed by its Contribution alone, or by combination of the +Contribution with the Software to which the Contribution was contributed. +The patent license shall not apply to any modification of the Contribution, +and any other combination which includes the Contribution. If you or your +Affiliates directly or indirectly institute patent litigation (including a +cross claim or counterclaim in a litigation) or other patent enforcement +activities against any individual or entity by alleging that the Software or +any Contribution in it infringes patents, then any patent license granted to +you under this License for the Software shall terminate as of the date such +litigation or activity is filed or taken. + +3. No Trademark License + +No trademark license is granted to use the trade names, trademarks, service +marks, or product names of Contributor, except as required to fulfill notice +requirements in section 4. + +4. Distribution Restriction + +You may distribute the Software in any medium with or without modification, +whether in source or executable forms, provided that you provide recipients +with a copy of this License and retain copyright, patent, trademark and +disclaimer statements in the Software. + +5. Disclaimer of Warranty and Limitation of Liability + +THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY +KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR +COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT +LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING +FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO +MATTER HOW IT’S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGES. + +6. Language + +THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION +AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF +DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION +SHALL PREVAIL. + +END OF THE TERMS AND CONDITIONS + +How to Apply the Mulan Permissive Software License,Version 2 +(Mulan PSL v2) to Your Software + +To apply the Mulan PSL v2 to your work, for easy identification by +recipients, you are suggested to complete following three steps: + +i. Fill in the blanks in following statement, including insert your software +name, the year of the first publication of your software, and your name +identified as the copyright owner; + +ii. Create a file named "LICENSE" which contains the whole context of this +License in the first directory of your software package; + +iii. Attach the statement to the appropriate annotated syntax at the +beginning of each source file. + +Copyright (c) [Year] [name of copyright holder] +[Software Name] is licensed under Mulan PSL v2. +You can use this software according to the terms and conditions of the Mulan +PSL v2. +You may obtain a copy of Mulan PSL v2 at: + http://license.coscl.org.cn/MulanPSL2 +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +See the Mulan PSL v2 for more details. diff --git a/README.md b/README.md index a333a1a724d0891e62ee7d1492cc39041dfab182..112e128253ebacb511125e7a3fbf8cb2ef017135 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,351 @@ -# euler-copilot-shell +# openEuler Intelligence Smart Shell -#### 介绍 -CLI and desktop client applications that enables developers to interact with the operating system using natural language. +一个基于 Python Textual 构建的智能终端应用程序,提供 AI 驱动的命令行交互体验。支持多种 LLM 后端,集成 MCP 协议,提供现代化的 TUI 界面。 -#### 软件架构 -软件架构说明 +## 核心特性 +- **多后端支持**: 支持 OpenAI API 大模型和 openEuler Intelligence 后端 +- **智能终端界面**: 基于 Textual 的现代化 TUI 界面 +- **流式响应**: 实时显示 AI 回复内容 +- **部署助手**: 内置 openEuler Intelligence 自动部署功能 -#### 安装教程 +## 安装说明 -1. xxxx -2. xxxx -3. xxxx +### 方式一:从源码安装(推荐开发者) -#### 使用说明 +1. 克隆仓库: -1. xxxx -2. xxxx -3. xxxx + ```sh + git clone https://gitee.com/openeuler/euler-copilot-shell.git -b dev + cd euler-copilot-shell + ``` -#### 参与贡献 +2. 安装依赖(建议使用 Python 虚拟环境): -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request + ```sh + pip install -r requirements.txt + ``` +### 方式二:通过 RPM 包安装 -#### 特技 +注意:*仅适用于 openEuler 24.03 LTS SP2* -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +```sh +sudo dnf install openeuler-intelligence-cli +``` + +安装完成后,可以使用 `oi` 命令启动应用程序。 + +## 使用方法 + +安装 RPM 包后: + +```sh +oi +``` + +查看最新的日志内容: + +```sh +oi --logs +``` + +设置日志级别并验证: + +```sh +oi --log-level INFO +``` + +初始化 openEuler Intelligence 后端(仅支持 openEuler 操作系统): + +```sh +oi --init +``` + +选择和设置默认智能体(仅适用于 openEuler Intelligence 后端): + +```sh +oi --agent +``` + +应用启动后,您可以直接在输入框中输入命令。如果命令无效或无法执行,应用程序将基于您的输入提供智能建议。 + +### 界面操作快捷键 + +- **Ctrl+S**: 打开设置界面 +- **Ctrl+R**: 重置对话历史 +- **Ctrl+T**: 选择智能体 +- **Tab**: 在命令输入框和输出区域之间切换焦点 +- **Esc**: 退出应用程序 + +### MCP 工具交互 + +当使用支持 MCP (Model Context Protocol) 的后端时,应用程序会在需要工具确认或参数输入时: + +1. **工具执行确认**: 显示工具名称、风险级别和执行原因,用户可选择确认或取消 +2. **参数补全**: 动态生成参数输入表单,用户填写必要信息后提交 + +应用程序使用内联交互模式,不会打开模态对话框,确保流畅的用户体验。 + +### --init 命令说明 + +`--init` 命令用于在 openEuler 操作系统上自动安装和配置 openEuler Intelligence 后端,它将执行以下步骤: + +1. **系统检测**: 检测当前操作系统是否为 openEuler +2. **环境检查**: 验证 dnf 包管理器和管理员权限 +3. **包安装**: 通过 dnf 安装 `openeuler-intelligence-installer` RPM 包 +4. **服务部署**: 运行部署脚本完成系统初始化 + +**使用要求**: + +- 仅支持 openEuler 操作系统 +- 需要管理员权限(sudo) +- 需要网络连接以下载 RPM 包 + +**注意**: 此命令会自动安装系统服务,请在生产环境使用前仔细评估。 + +### --agent 命令说明 + +`--agent` 命令用于在命令行中选择和设置默认智能体,它提供了一个 TUI 界面来管理智能体配置: + +1. **智能体列表**: 自动获取并显示所有可用的智能体 +2. **可视化选择**: 通过图形化界面选择要设置为默认的智能体 +3. **配置保存**: 自动将选择保存到配置文件中的 `eulerintelli.default_app` 字段 +4. **即时反馈**: 设置完成后显示确认信息 + +**使用要求**: + +- 必须配置为 openEuler Intelligence 后端 +- 需要有效的服务器连接来获取智能体列表 +- 如果后端不是 openEuler Intelligence,会显示错误提示并引导切换 + +**功能特点**: + +- 包含"智能问答"选项(无智能体)作为默认选择 +- 支持取消操作,不会更改现有配置 +- 自动处理网络错误和异常情况 + +## 配置说明 + +应用程序支持两种后端配置,配置文件会自动保存在 `~/.config/eulerintelli/smart-shell.json`: + +### 后端类型 + +1. **OpenAI 兼容 API** (包括 LM Studio、vLLM、Ollama 等) +2. **openEuler Intelligence** + +### 配置示例 + +首次运行时,可通过设置界面 (Ctrl+S) 配置以下参数: + +**OpenAI 兼容 API 配置:** + +- Base URL: 如 `http://localhost:1234/v1` +- Model: 如 `qwen/qwen3-30b-a3b` +- API Key: 如 `sk-xxxxxx` + +**openEuler Intelligence 配置:** + +- Base URL: 如 `http://your-server:8002` +- API Key: 您的认证令牌 + +### 智能体管理 + +对于 openEuler Intelligence 后端,应用程序支持多智能体切换: + +1. **默认智能问答**: 通用 AI 助手 +2. **专业智能体**: 针对特定领域的专门助手 + +使用 `Ctrl+T` 可以在运行时切换不同的智能体。 + +#### 默认智能体配置 + +应用程序支持配置默认启动的智能体: + +- **默认智能体配置**: 决定应用启动时激活哪个智能体,持久保存 +- **运行时智能体切换**: 在当前会话中临时切换智能体,不影响默认配置 + +##### 方式一:命令行(修改默认配置) + +```sh +oi --agent +``` + +通过图形化界面选择默认智能体,选择会自动保存到配置文件。 + +##### 方式二:手动修改配置文件(不推荐) + +直接编辑配置文件 `~/.config/eulerintelli/smart-shell.json`,修改 `eulerintelli.default_app` 字段的值: + +- 设置为空字符串 `""` 或删除该字段:使用"智能问答"(没有调用工具的能力) +- 设置为有效的智能体ID:使用指定的智能体作为默认 +- 设置为无效的智能体ID:应用启动时会自动清理并回退到"智能问答" + +##### 配置详情 + +- **配置位置**: `~/.config/eulerintelli/smart-shell.json` 中的 `eulerintelli.default_app` 字段 +- **默认行为**: 如果未设置或为空,将默认使用"智能问答"(通用助手) +- **自动应用**: 应用启动时会自动加载配置的默认智能体 +- **自动清理**: 如果配置的智能体ID不存在(如服务器数据更改),会自动清理配置并回退到"智能问答" + +**配置示例**: + +```json +{ + "backend": "eulerintelli", + "eulerintelli": { + "base_url": "http://your-server:8002", + "api_key": "your-api-key", + "default_app": "your-preferred-agent-id" + } +} +``` + +### 日志配置 + +应用程序提供多级日志记录: + +- **DEBUG**: 详细调试信息(默认) +- **INFO**: 基本信息 +- **WARNING**: 警告信息 +- **ERROR**: 仅错误信息 + +## 日志功能 + +应用程序提供完整的日志记录功能: + +- **日志位置**: `~/.cache/openEuler Intelligence/logs/` +- **日志格式**: `smart-shell-YYYYMMDD-HHMMSS.log`(使用本地时区时间) +- **自动清理**: 每次启动时自动删除7天前的旧日志和空日志文件 +- **命令行查看**: 使用 `python src/main.py --logs` 查看最新日志内容 +- **记录内容**: + - 程序启动和退出 + - API请求详情(URL、状态码、耗时等) + - 异常和错误信息 + - 模块级别的操作日志 + +## 系统要求 + +### 基本要求 + +- **Python**: 3.11 或更高版本 +- **操作系统**: openEuler 24.03 LTS 或更高版本 +- **网络**: 访问配置的 LLM API 服务 + +### 依赖包 + +核心依赖: + +- **textual**: 5.3.0 - TUI 界面框架 +- **rich**: 14.1.0 - 富文本渲染 +- **httpx**: 0.28.1 - HTTP 客户端 +- **openai**: 1.99.6 - OpenAI API 客户端 + +开发依赖: + +- **ruff**: *Latest* - 代码检查器 + +### 特殊功能要求 + +**自动部署功能(`--init` 命令)**: + +- 仅支持 openEuler 操作系统 +- 需要管理员权限(sudo) +- 需要 dnf 包管理器 +- 需要网络连接 + +## 在 openEuler 系统下的 RPM 打包 + +以下步骤演示如何在 openEuler 24.03 LTS 或更高版本上,使用自带脚本打包生成 RPM 包。 + +前提条件: + +- 操作系统:openEuler 24.03 LTS 或更高版本 +- 工具依赖:rpmdevtools、git、bash +- 具有管理员权限(sudo) + +构建步骤: + +1. 克隆仓库并切换到对应分支: + + ```sh + git clone https://gitee.com/openeuler/euler-copilot-shell.git -b dev + cd euler-copilot-shell + ``` + +2. 为构建脚本添加可执行权限: + + ```sh + chmod +x scripts/build/create_tarball.sh scripts/build/build_rpm.sh + ``` + +3. 运行 RPM 构建脚本: + + ```sh + ./scripts/build/build_rpm.sh + ``` + + 脚本执行完成后,会在临时构建目录下的 `RPMS` 和 `SRPMS` 子目录中生成相应的二进制包和源码包,并在终端输出具体路径。 + +## 项目结构 + +```text +smart-shell/ +├── README.md # 项目说明文档 +├── requirements.txt # Python 依赖包列表 +├── setup.py # 包安装配置文件 +├── LICENSE # 开源许可证 +├── distribution/ # 发布相关文件 +├── docs/ # 项目文档目录 +│ └── development/ # 开发设计文档 +│ └── server-side/ # 服务端相关文档 +├── scripts/ # 部署脚本目录 +│ └── build/ # RPM 包构建脚本 +│ └── deploy/ # 自动化部署脚本 +├── tests/ # 测试文件目录 +└── src/ # 源代码目录 + ├── main.py # 应用程序入口点 + ├── app/ # TUI 应用模块 + │ ├── tui.py # 主界面应用类 + │ ├── mcp_widgets.py # MCP 交互组件 + │ ├── tui_mcp_handler.py # MCP 事件处理器 + │ ├── settings.py # 设置界面 + │ ├── css/ + │ │ └── styles.tcss # TUI 样式文件 + │ ├── deployment/ # 部署助手模块 + │ │ ├── models.py # 部署配置模型 + │ │ ├── service.py # 部署服务逻辑 + │ │ ├── ui.py # 部署界面组件 + │ │ └── validators.py # 配置验证器 + │ └── dialogs/ # 对话框组件 + │ ├── agent.py # 智能体选择对话框 + │ └── common.py # 通用对话框组件 + ├── backend/ # 后端适配模块 + │ ├── base.py # 后端客户端基类 + │ ├── factory.py # 后端工厂类 + │ ├── mcp_handler.py # MCP 事件处理接口 + │ ├── openai.py # OpenAI 兼容客户端 + │ └── hermes/ # openEuler Intelligence 客户端 + │ ├── client.py # Hermes API 客户端 + │ ├── constants.py # 常量定义 + │ ├── exceptions.py # 异常类定义 + │ ├── models.py # 数据模型 + │ ├── stream.py # 流式响应处理 + │ └── services/ # 服务层组件 + ├── config/ # 配置管理模块 + │ ├── manager.py # 配置管理器 + │ └── model.py # 配置数据模型 + ├── log/ # 日志管理模块 + │ └── manager.py # 日志管理器 + └── tool/ # 工具模块 + ├── command_processor.py # 命令处理器 + └── oi_backend_init.py # 后端初始化工具 +``` + +## 贡献 + +欢迎贡献代码!请随时提交 PR 或开启问题讨论任何功能增强或错误修复建议。 + +## 开源许可 + +本项目采用 MulanPSL-2.0 许可证。详细信息请参见 [LICENSE](LICENSE) 文件。 diff --git a/euler-copilot-shell-0.10.0.tar.gz b/euler-copilot-shell-0.10.0.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..4a4e027618a1fbab572449091483c881f02f7897 Binary files /dev/null and b/euler-copilot-shell-0.10.0.tar.gz differ diff --git a/euler-copilot-shell.spec b/euler-copilot-shell.spec new file mode 100644 index 0000000000000000000000000000000000000000..82859f10725932dffa07b21c3bf895bb087a30b6 --- /dev/null +++ b/euler-copilot-shell.spec @@ -0,0 +1,141 @@ +%global pypi_name oi-cli +%global shortcut_name oi +%global debug_package %{nil} + +Name: euler-copilot-shell +Version: 0.10.0 +Release: 4%{?dist} +Summary: openEuler Intelligence 智能命令行工具集 +License: MulanPSL-2.0 +URL: https://gitee.com/openeuler/euler-copilot-shell +Source0: %{name}-%{version}.tar.gz + +ExclusiveArch: x86_64 aarch64 riscv64 loongarch64 + +BuildRequires: python3-devel +BuildRequires: python3-virtualenv +BuildRequires: python3-pip + +%description +openEuler Intelligence 智能命令行工具集,包含智能 Shell 命令行程序和部署安装工具。 + +# 智能命令行工具子包 +%package -n openeuler-intelligence-cli +Summary: openEuler Intelligence 智能 Shell 命令行工具 +Requires: glibc +# 替换原来的 euler-copilot-shell 包 +Obsoletes: euler-copilot-shell < %{version}-%{release} +Provides: euler-copilot-shell = %{version}-%{release} + +%description -n openeuler-intelligence-cli +openEuler Intelligence 智能 Shell 是一个智能命令行程序。 +它允许用户输入命令,通过集成大语言模型提供命令建议,帮助用户更高效地使用命令行。 + +# 部署安装工具子包 +%package -n openeuler-intelligence-installer +Summary: openEuler Intelligence 部署安装脚本 +Requires: python3-aiohttp +Requires: python3-requests +BuildArch: noarch + +%description -n openeuler-intelligence-installer +openEuler Intelligence 部署安装工具包,包含部署脚本和相关资源文件。 + +%prep +%autosetup -n %{name}-%{version} + +%build +# 创建虚拟环境 +python3 -m venv %{_builddir}/venv +source %{_builddir}/venv/bin/activate + +# 升级 pip 和 setuptools +pip install -i https://mirrors.huaweicloud.com/repository/pypi/simple --upgrade pip setuptools wheel + +# 安装项目依赖 +pip install -i https://mirrors.huaweicloud.com/repository/pypi/simple -r requirements.txt + +# 安装 PyInstaller +pip install -i https://mirrors.huaweicloud.com/repository/pypi/simple pyinstaller + +# 使用虚拟环境中的 PyInstaller 创建单一可执行文件 +pyinstaller --noconfirm \ + --distpath dist \ + oi-cli.spec + +# 退出虚拟环境 +deactivate + +%install +# 安装智能命令行工具 +mkdir -p %{buildroot}%{_bindir} +install -m 0755 dist/%{pypi_name} %{buildroot}%{_bindir}/%{pypi_name} + +# 创建快捷链接 +ln -sf %{pypi_name} %{buildroot}%{_bindir}/%{shortcut_name} + +# 安装部署脚本和资源 +mkdir -p %{buildroot}/usr/lib/openeuler-intelligence/{scripts,resources} +mkdir -p %{buildroot}%{_bindir} + +# 复制部署脚本和资源 +install -m 755 scripts/deploy/deploy.sh %{buildroot}/usr/lib/openeuler-intelligence/scripts/deploy +cp -r scripts/deploy/0-one-click-deploy scripts/deploy/1-check-env scripts/deploy/2-install-dependency scripts/deploy/3-install-server scripts/deploy/4-other-script scripts/deploy/5-resource %{buildroot}/usr/lib/openeuler-intelligence/scripts/ +chmod -R +x %{buildroot}/usr/lib/openeuler-intelligence/scripts/ + +# 创建可执行文件的符号链接 +ln -sf /usr/lib/openeuler-intelligence/scripts/deploy %{buildroot}%{_bindir}/openeuler-intelligence-installer + +%files -n openeuler-intelligence-cli +%license LICENSE +%doc README.md +%{_bindir}/%{pypi_name} +%{_bindir}/%{shortcut_name} + +%files -n openeuler-intelligence-installer +%license LICENSE +%doc scripts/deploy/安装部署手册.md +/usr/lib/openeuler-intelligence +%{_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 版本 + +* Thu Aug 28 2025 openEuler - 0.10.0-2 +- 新增 openEuler Intelligence 部署功能 TUI +- 新增选择默认 Agent 功能 + +* Wed Aug 13 2025 openEuler - 0.10.0-1 +- 重构为子包形式:openeuler-intelligence-cli 和 openeuler-intelligence-installer +- openeuler-intelligence-cli 替换原 euler-copilot-shell 包 +- 新增 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