Skip to main content

基于大语言模型的命令行代码助手

Project description

nezha

nezha 是一个命令行 AI 助手工具,支持模型选择、对话、计划生成、配置初始化等多种智能操作,适合开发者和 AI 爱好者快速集成和使用。

主要特性

  • 支持多种大语言模型(LLM),包括预置和用户自定义模型
  • 模型可配置、可切换
  • 命令行交互式体验,支持对话 (chat)、计划 (plan) 等多种命令
  • 支持通过 init 命令初始化或重置配置
  • 配置灵活,支持用户自定义模型参数和安全设置
  • 内置安全层,提供不同级别的操作确认和路径限制
  • 适合二次开发和集成

安装方法

通过 pip 安装(推荐)

pip install nezha-agent

源码安装

git clone https://github.com/echovic/nezha.git
cd nezha
pip install .

快速开始

初始化配置 (可选)

nezha init

查看和管理模型

# 查看所有可用模型
nezha models list

# 交互式选择并设置默认模型
nezha models select

# 添加新模型配置
nezha models add

启动对话

nezha chat

生成计划

nezha plan "帮我写一个发送邮件的 Python 脚本"

配置说明

  • 默认配置文件位于 ~/.config/nezha/config.yaml (路径可能因操作系统而异,请参考 platformdirs 文档)
  • 可通过 nezha init 命令生成或重置配置文件
  • 支持自定义模型列表及参数
  • 安全相关配置位于 config/security_config.yaml,详情请参考 安全层设计与使用指南

自动化发布流程

项目使用 GitHub Actions 实现了自动化的版本管理和发布流程,简化了发布过程。

自动版本管理

当代码推送到 main 分支时,系统会根据提交信息自动确定版本增量类型:

  • 提交包含 "BREAKING CHANGE" 或 "major" 时,增加主版本号
  • 提交包含 "feat"、"feature" 或 "minor" 时,增加次版本号
  • 其他情况增加修订版本号

自动发布过程

工作流程会自动执行以下操作:

  1. 自动更新 pyproject.toml 中的版本号
  2. 提交版本更新到仓库
  3. 创建并推送新版本的 git tag
  4. 构建 Python 包
  5. 发布到 PyPI

使用方法

只需正常开发和提交代码,在提交信息中使用关键词控制版本增量。当代码合并到 main 分支后,工作流程会自动执行所有步骤。

如果不希望某次提交触发发布,可以在提交信息中添加 "[skip ci]"。

贡献指南

欢迎提交 issue 和 PR!如需贡献代码,请遵循本项目的代码规范。

联系方式

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nezha_agent-0.1.5.tar.gz (31.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nezha_agent-0.1.5-py3-none-any.whl (35.9 kB view details)

Uploaded Python 3

File details

Details for the file nezha_agent-0.1.5.tar.gz.

File metadata

  • Download URL: nezha_agent-0.1.5.tar.gz
  • Upload date:
  • Size: 31.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for nezha_agent-0.1.5.tar.gz
Algorithm Hash digest
SHA256 85205188101e5701135bdc7ec2d9e3d8cc95549ca2a37a3be7329cce19607ef4
MD5 6b1774e9f1ab0c055812d683d122d6e7
BLAKE2b-256 90f14ed4fae46dd877de1696f0737264d61eb409159e5fd303397ce249f0a871

See more details on using hashes here.

Provenance

The following attestation bundles were made for nezha_agent-0.1.5.tar.gz:

Publisher: publish-to-pypi.yml on echoVic/nezha

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nezha_agent-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: nezha_agent-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 35.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for nezha_agent-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1ac12492a42546f5798b4ff20ade0b3043b7e6cf59981647d9f2a76f6edfbc02
MD5 6b59de8bc9d27168f37dbffcd9f40c54
BLAKE2b-256 52ccc87d92af6267be815beaf7c37b8689c680490548370dbc8e25eee5e2fd99

See more details on using hashes here.

Provenance

The following attestation bundles were made for nezha_agent-0.1.5-py3-none-any.whl:

Publisher: publish-to-pypi.yml on echoVic/nezha

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page