Skip to content

Commit 1b43ce9

Browse files
committed
fix fmt
1 parent 66441fb commit 1b43ce9

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

openai-gateway/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ graph LR
2626
## 快速开始
2727

2828
### 1. 运行
29+
2930
```bash
3031
# 必须:设置你的真实 OpenAI API Key
3132
export OPENAI_API_KEY="sk-..."
@@ -39,6 +40,7 @@ go run main.go
3940
### 2. 客户端配置
4041

4142
#### OpenAI Python SDK
43+
4244
网关已自动注入真实 API Key,你在客户端只需将 `base_url` 指向本地网关,并传入一个任意值的 `api_key` 即可。
4345

4446
```python
@@ -57,6 +59,7 @@ print(response.choices[0].message.content)
5759
```
5860

5961
#### Curl 测试
62+
6063
```bash
6164
# 请求 /chat/completions,转发至 {OPENAI_BASE_URL}/chat/completions
6265
curl http://localhost:8080/chat/completions \

shellgpt/CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
55
## 0.7.0 - 2026-02-23
66

77
### Added
8+
89
- **New Configuration System**: Introduced `~/.shellgpt/config.toml` as the primary configuration method.
910
- **Multiple Profiles**: Support for multiple API providers with `base_url`, `api_key`, `model`, and custom `headers`. Switch between them using the `-p / --profile` flag.
1011
- **Flexible Authentication**: Added `api_key_env` to profiles, allowing API keys to be read from environment variables.
@@ -19,6 +20,7 @@ All notable changes to this project will be documented in this file.
1920
- **Multilingual Docs**: Added `README_zh.md` and `CHANGELOG_zh.md`.
2021

2122
### Changed
23+
2224
- **Unified Terminology**: Standardized on `role` instead of `system_content` across the entire codebase and CLI (changed `-s` to `--role`).
2325
- **Backend Unification**: Switched to 100% OpenAI-compatible API handling; legacy native Ollama support has been removed.
2426
- **Strict Validation**: Resolved profile names and role names must now exist in the configuration, or the program will exit with an error.
@@ -28,10 +30,11 @@ All notable changes to this project will be documented in this file.
2830
- **Explicit Architecture**: Refactored `LLM` and `ShellGPT` classes to use explicit keyword arguments instead of generic `**kwargs` for better maintainability and clarity.
2931
- **Robust CI Support**: Improved configuration loading logic to prevent crashes in environments without a config file (like CI/CD runners).
3032
- **Architecture Refactoring**:
31-
- Moved initialization logic to `shellgpt/init.py`.
32-
- Eliminated dependencies on global variables.
33+
- Moved initialization logic to `shellgpt/init.py`.
34+
- Eliminated dependencies on global variables.
3335

3436
### Fixed
37+
3538
- **Process Exit Codes**: Non-REPL mode now correctly exits with a non-zero code on inference errors.
3639
- **Robust Error Handling**: Added explicit traceback printing for easier troubleshooting.
3740
- **History Management**: Fixed a bug where AI responses were not saved to history during streaming.

shellgpt/CHANGELOG_zh.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
## 0.7.0 - 2026-02-23
66

77
### 新增
8+
89
- **全新配置系统**: 引入 `~/.shellgpt/config.toml` 作为核心配置方式。
910
- **多 Profile 支持**: 支持配置多个 API 提供商,包含 `base_url``api_key``model` 和自定义 `headers`。使用 `-p / --profile` 快速切换。
1011
- **灵活的认证方式**: 在 Profile 中支持 `api_key_env`,允许从环境变量中读取 API Key。
@@ -19,6 +20,7 @@
1920
- **多语言文档**: 增加了中文版的 `README_zh.md``CHANGELOG_zh.md`
2021

2122
### 变更
23+
2224
- **术语统一**: 将整个代码库中的 `system_content` 统一重命名为 `role`(命令行参数由 `-s` 改为 `--role`)。
2325
- **后端统一**: 移除旧的原生 Ollama 支持,改为全面拥抱 OpenAI 兼容协议。
2426
- **严格校验**: 解析后的 Profile 名和 Role 名必须在配置中存在,否则程序将报错退出。
@@ -27,10 +29,11 @@
2729
- **显式架构**: 重构了 `LLM``ShellGPT` 类,将原本模糊的 `**kwargs` 替换为显式命名的关键字参数,提升了代码的可维护性。
2830
- **健壮的 CI 支持**: 优化了配置加载逻辑,防止在没有配置文件的环境(如 CI/CD 流水线)中运行测试时发生崩溃。
2931
- **架构重构**:
30-
- 将初始化逻辑迁移至独立的 `shellgpt/init.py` 模块。
31-
- 彻底消除了对全局变量的依赖。
32+
- 将初始化逻辑迁移至独立的 `shellgpt/init.py` 模块。
33+
- 彻底消除了对全局变量的依赖。
3234

3335
### 修复
36+
3437
- **退出码支持**: 非 REPL 模式在推断出错时现在会正确返回非零退出码。
3538
- **错误处理增强**: 增加了显式的堆栈轨迹打印,方便问题排查。
3639
- **历史记录丢失**: 修复了流式输出模式下 AI 回复无法存入对话历史的问题。

shellgpt/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ model = "gpt-4o"
7878
```
7979

8080
Usage:
81+
8182
```bash
8283
# Uses default_profile (ollama)
8384
sg How to center a div?
@@ -101,13 +102,15 @@ temperature = 0.8
101102
Roles allow you to define specific system prompts for different tasks. They are managed in the `[roles]` section of your config.
102103

103104
Built-in examples (created during `sg --init`):
105+
104106
- `shell`: Infer shell commands.
105107
- `typo`: Correct text typos.
106108
- `code`: Coding assistant.
107109
- `summary`: Summarize text in Markdown.
108110
- `polish`: Polish writing.
109111

110112
Usage:
113+
111114
```bash
112115
# List all available roles and their contents
113116
sg --list

shellgpt/README_zh.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ model = "gpt-4o"
7878
```
7979

8080
用法示例:
81+
8182
```bash
8283
# 使用默认配置 (ollama)
8384
sg 如何水平居中一个 div?
@@ -101,13 +102,15 @@ temperature = 0.8
101102
角色允许你为不同任务预定义系统提示词(System Prompts)。你可以在配置文件的 `[roles]` 部分进行管理。
102103

103104
内置示例(运行 `sg --init` 后自动生成):
105+
104106
- `shell`: 推理 Shell 命令。
105107
- `typo`: 纠正文本拼写错误。
106108
- `code`: 编程助手。
107109
- `summary`: 以 Markdown 格式总结文章。
108110
- `polish`: 润色文字。
109111

110112
用法示例:
113+
111114
```bash
112115
# 列出所有可用角色及其内容
113116
sg --list

0 commit comments

Comments
 (0)