gpt-shell-4o-mini 1.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chatgpt/__init__.py +24 -0
- chatgpt/__main__.py +8 -0
- chatgpt/api_client.py +244 -0
- chatgpt/checks.py +211 -0
- chatgpt/cleanup.py +143 -0
- chatgpt/main.py +548 -0
- chatgpt/terminal_context.py +48 -0
- chatgpt/uninstall.py +217 -0
- chatgpt/user_profile.py +84 -0
- gpt_shell_4o_mini-1.2.1.dist-info/METADATA +366 -0
- gpt_shell_4o_mini-1.2.1.dist-info/RECORD +15 -0
- gpt_shell_4o_mini-1.2.1.dist-info/WHEEL +5 -0
- gpt_shell_4o_mini-1.2.1.dist-info/entry_points.txt +4 -0
- gpt_shell_4o_mini-1.2.1.dist-info/licenses/LICENSE +21 -0
- gpt_shell_4o_mini-1.2.1.dist-info/top_level.txt +1 -0
chatgpt/uninstall.py
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Uninstall command for GPT-shell-4o-mini.
|
|
3
|
+
|
|
4
|
+
This module provides a command-line uninstaller that can be called via:
|
|
5
|
+
gpt-remove or python -m chatgpt.uninstall
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import os
|
|
9
|
+
import sys
|
|
10
|
+
import subprocess
|
|
11
|
+
import platform
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from rich.console import Console
|
|
14
|
+
|
|
15
|
+
console = Console()
|
|
16
|
+
|
|
17
|
+
# Files created by the package
|
|
18
|
+
FILES_TO_REMOVE = [
|
|
19
|
+
"~/.chatgpt_py_info", # User profile
|
|
20
|
+
"~/.chatgpt_py_history", # Chat history
|
|
21
|
+
"~/.chatgpt_py_sys_prompt", # Custom system prompt
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
# Shell profiles that might contain OPENAI_KEY
|
|
25
|
+
SHELL_PROFILES = [
|
|
26
|
+
"~/.bashrc",
|
|
27
|
+
"~/.zprofile",
|
|
28
|
+
"~/.zshrc",
|
|
29
|
+
"~/.bash_profile",
|
|
30
|
+
"~/.profile",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def remove_file(file_path):
|
|
35
|
+
"""Remove a single file if it exists."""
|
|
36
|
+
path = Path(file_path).expanduser()
|
|
37
|
+
if path.exists():
|
|
38
|
+
try:
|
|
39
|
+
path.unlink()
|
|
40
|
+
console.print(f"[green]✓[/green] Removed {file_path}")
|
|
41
|
+
return True
|
|
42
|
+
except Exception as e:
|
|
43
|
+
console.print(f"[red]✗[/red] Failed to remove {file_path}: {e}")
|
|
44
|
+
return False
|
|
45
|
+
else:
|
|
46
|
+
console.print(f"[yellow]-[/yellow] {file_path} not found")
|
|
47
|
+
return False
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def remove_openai_key_from_profiles():
|
|
51
|
+
"""Remove OPENAI_KEY from shell profile files."""
|
|
52
|
+
system = platform.system()
|
|
53
|
+
|
|
54
|
+
if system == "Windows":
|
|
55
|
+
# Remove Windows environment variable
|
|
56
|
+
try:
|
|
57
|
+
result = subprocess.run(
|
|
58
|
+
["reg", "delete", "HKCU\\Environment", "/v", "OPENAI_KEY", "/f"],
|
|
59
|
+
capture_output=True,
|
|
60
|
+
text=True,
|
|
61
|
+
)
|
|
62
|
+
if result.returncode == 0:
|
|
63
|
+
console.print(
|
|
64
|
+
"[green]✓[/green] Removed OPENAI_KEY from Windows environment"
|
|
65
|
+
)
|
|
66
|
+
else:
|
|
67
|
+
console.print(
|
|
68
|
+
"[yellow]-[/yellow] OPENAI_KEY not found in Windows environment"
|
|
69
|
+
)
|
|
70
|
+
except Exception as e:
|
|
71
|
+
console.print(
|
|
72
|
+
f"[red]✗[/red] Failed to remove Windows environment variable: {e}"
|
|
73
|
+
)
|
|
74
|
+
else:
|
|
75
|
+
# Unix-like systems - remove from shell profiles
|
|
76
|
+
for profile_file in SHELL_PROFILES:
|
|
77
|
+
profile_path = Path(profile_file).expanduser()
|
|
78
|
+
if profile_path.exists():
|
|
79
|
+
try:
|
|
80
|
+
with profile_path.open("r") as f:
|
|
81
|
+
lines = f.readlines()
|
|
82
|
+
|
|
83
|
+
# Filter out lines containing OPENAI_KEY for our package
|
|
84
|
+
filtered_lines = []
|
|
85
|
+
key_removed = False
|
|
86
|
+
in_our_section = False
|
|
87
|
+
|
|
88
|
+
for line in lines:
|
|
89
|
+
if "# OpenAI API Key for GPT-shell-4o-mini" in line:
|
|
90
|
+
in_our_section = True
|
|
91
|
+
key_removed = True
|
|
92
|
+
continue
|
|
93
|
+
elif in_our_section and line.strip().startswith(
|
|
94
|
+
"export OPENAI_KEY="
|
|
95
|
+
):
|
|
96
|
+
continue # Skip the export line
|
|
97
|
+
elif in_our_section and line.strip() == "":
|
|
98
|
+
in_our_section = False # End of our section
|
|
99
|
+
continue
|
|
100
|
+
elif in_our_section:
|
|
101
|
+
continue # Skip any other lines in our section
|
|
102
|
+
|
|
103
|
+
filtered_lines.append(line)
|
|
104
|
+
|
|
105
|
+
if key_removed:
|
|
106
|
+
with profile_path.open("w") as f:
|
|
107
|
+
f.writelines(filtered_lines)
|
|
108
|
+
console.print(
|
|
109
|
+
f"[green]✓[/green] Removed OPENAI_KEY from {profile_file}"
|
|
110
|
+
)
|
|
111
|
+
else:
|
|
112
|
+
console.print(
|
|
113
|
+
f"[yellow]-[/yellow] OPENAI_KEY not found in {profile_file}"
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
except Exception as e:
|
|
117
|
+
console.print(f"[red]✗[/red] Failed to update {profile_file}: {e}")
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def uninstall_package():
|
|
121
|
+
"""Uninstall the Python package via pip."""
|
|
122
|
+
try:
|
|
123
|
+
console.print(
|
|
124
|
+
"[cyan]Attempting to uninstall gpt-shell-4o-mini package...[/cyan]"
|
|
125
|
+
)
|
|
126
|
+
result = subprocess.run(
|
|
127
|
+
[sys.executable, "-m", "pip", "uninstall", "gpt-shell-4o-mini", "-y"],
|
|
128
|
+
capture_output=True,
|
|
129
|
+
text=True,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
if result.returncode == 0:
|
|
133
|
+
console.print("[green]✓[/green] Package uninstalled successfully")
|
|
134
|
+
return True
|
|
135
|
+
else:
|
|
136
|
+
console.print("[yellow]-[/yellow] Package not found or already uninstalled")
|
|
137
|
+
return False
|
|
138
|
+
except Exception as e:
|
|
139
|
+
console.print(f"[red]✗[/red] Failed to uninstall package: {e}")
|
|
140
|
+
return False
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def main():
|
|
144
|
+
"""Main uninstall function."""
|
|
145
|
+
console.print("\n" + "=" * 60)
|
|
146
|
+
console.print("[bold red]GPT-shell-4o-mini Uninstaller[/bold red]")
|
|
147
|
+
console.print("=" * 60)
|
|
148
|
+
console.print("\nThis will remove:")
|
|
149
|
+
console.print("• The gpt-shell-4o-mini Python package")
|
|
150
|
+
console.print("• All configuration files in your home directory")
|
|
151
|
+
console.print("• OPENAI_KEY from your shell profiles")
|
|
152
|
+
console.print("• Chat history and custom prompts\n")
|
|
153
|
+
|
|
154
|
+
# Confirmation
|
|
155
|
+
try:
|
|
156
|
+
confirm = (
|
|
157
|
+
console.input(
|
|
158
|
+
"[bold red]Are you sure you want to continue? (yes/no):[/bold red] "
|
|
159
|
+
)
|
|
160
|
+
.strip()
|
|
161
|
+
.lower()
|
|
162
|
+
)
|
|
163
|
+
if confirm not in ["yes", "y"]:
|
|
164
|
+
console.print("[yellow]Uninstall cancelled.[/yellow]")
|
|
165
|
+
sys.exit(0)
|
|
166
|
+
except (EOFError, KeyboardInterrupt):
|
|
167
|
+
console.print("\n[yellow]Uninstall cancelled.[/yellow]")
|
|
168
|
+
sys.exit(0)
|
|
169
|
+
|
|
170
|
+
console.print("\n[cyan]Starting uninstall process...[/cyan]\n")
|
|
171
|
+
|
|
172
|
+
# 1. Remove configuration files first (while package is still installed)
|
|
173
|
+
console.print("[cyan]Removing configuration files...[/cyan]")
|
|
174
|
+
files_removed = 0
|
|
175
|
+
for file_path in FILES_TO_REMOVE:
|
|
176
|
+
if remove_file(file_path):
|
|
177
|
+
files_removed += 1
|
|
178
|
+
|
|
179
|
+
# 2. Remove environment variables
|
|
180
|
+
console.print("\n[cyan]Removing environment variables...[/cyan]")
|
|
181
|
+
remove_openai_key_from_profiles()
|
|
182
|
+
|
|
183
|
+
# 3. Uninstall package last
|
|
184
|
+
console.print("\n[cyan]Uninstalling Python package...[/cyan]")
|
|
185
|
+
package_removed = uninstall_package()
|
|
186
|
+
|
|
187
|
+
# Summary
|
|
188
|
+
console.print("\n" + "=" * 60)
|
|
189
|
+
console.print("[bold green]Uninstall Complete![/bold green]")
|
|
190
|
+
console.print("=" * 60)
|
|
191
|
+
|
|
192
|
+
if files_removed > 0:
|
|
193
|
+
console.print(f"✓ {files_removed} configuration files removed")
|
|
194
|
+
console.print("✓ Environment variables cleaned")
|
|
195
|
+
if package_removed:
|
|
196
|
+
console.print("✓ Python package removed")
|
|
197
|
+
|
|
198
|
+
console.print("\n[yellow]Note:[/yellow] You may need to:")
|
|
199
|
+
console.print("• Restart your terminal to clear environment variables")
|
|
200
|
+
console.print("• Run 'source ~/.bashrc' (or your shell config) to reload")
|
|
201
|
+
|
|
202
|
+
console.print("\n[green]Thank you for using GPT-shell-4o-mini![/green]\n")
|
|
203
|
+
|
|
204
|
+
# Self-delete the uninstall script
|
|
205
|
+
try:
|
|
206
|
+
import __main__
|
|
207
|
+
|
|
208
|
+
script_path = Path(__main__.__file__)
|
|
209
|
+
if script_path.exists():
|
|
210
|
+
script_path.unlink()
|
|
211
|
+
console.print(f"[green]✓[/green] Removed uninstall script: {script_path}")
|
|
212
|
+
except:
|
|
213
|
+
pass # Silent fail if can't delete self
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
if __name__ == "__main__":
|
|
217
|
+
main()
|
chatgpt/user_profile.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""
|
|
2
|
+
User profile management functions for GPT-shell-4o-mini.
|
|
3
|
+
|
|
4
|
+
This module handles static user profile collection, storage, and formatting.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import json
|
|
8
|
+
import platform
|
|
9
|
+
import getpass
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
# Configuration
|
|
13
|
+
USER_PROFILE_FILE = Path.home() / ".chatgpt_py_info"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def collect_user_profile():
|
|
17
|
+
"""Collect static user profile information."""
|
|
18
|
+
profile = {
|
|
19
|
+
"username": getpass.getuser(),
|
|
20
|
+
"os": platform.system(),
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
# Add Linux distribution if applicable
|
|
24
|
+
if profile["os"] == "Linux":
|
|
25
|
+
try:
|
|
26
|
+
import distro
|
|
27
|
+
|
|
28
|
+
profile["distro"] = distro.name(pretty=True)
|
|
29
|
+
except ImportError:
|
|
30
|
+
try:
|
|
31
|
+
with open("/etc/os-release") as f:
|
|
32
|
+
for line in f:
|
|
33
|
+
if line.startswith("PRETTY_NAME="):
|
|
34
|
+
profile["distro"] = line.split("=")[1].strip().strip('"')
|
|
35
|
+
break
|
|
36
|
+
except:
|
|
37
|
+
profile["distro"] = "Unknown Linux"
|
|
38
|
+
|
|
39
|
+
return profile
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def save_user_profile(profile):
|
|
43
|
+
"""Save user profile to file."""
|
|
44
|
+
try:
|
|
45
|
+
with open(USER_PROFILE_FILE, "w") as f:
|
|
46
|
+
json.dump(profile, f, indent=2)
|
|
47
|
+
return True
|
|
48
|
+
except Exception:
|
|
49
|
+
return False
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def load_user_profile():
|
|
53
|
+
"""Load user profile from file, create if doesn't exist."""
|
|
54
|
+
if not USER_PROFILE_FILE.exists():
|
|
55
|
+
# Create profile if it doesn't exist
|
|
56
|
+
profile = collect_user_profile()
|
|
57
|
+
save_user_profile(profile)
|
|
58
|
+
return profile
|
|
59
|
+
|
|
60
|
+
try:
|
|
61
|
+
with open(USER_PROFILE_FILE, "r") as f:
|
|
62
|
+
return json.load(f)
|
|
63
|
+
except:
|
|
64
|
+
# If file is corrupted, recreate it
|
|
65
|
+
profile = collect_user_profile()
|
|
66
|
+
save_user_profile(profile)
|
|
67
|
+
return profile
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def format_user_profile():
|
|
71
|
+
"""Format static profile as string."""
|
|
72
|
+
profile = load_user_profile()
|
|
73
|
+
if not profile:
|
|
74
|
+
return ""
|
|
75
|
+
|
|
76
|
+
parts = [
|
|
77
|
+
f"User: {profile.get('username', 'unknown')}",
|
|
78
|
+
f"OS: {profile.get('os', 'unknown')}",
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
if profile.get("distro"):
|
|
82
|
+
parts.append(f"Distro: {profile['distro']}")
|
|
83
|
+
|
|
84
|
+
return "[Static Profile: " + " | ".join(parts) + "]"
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gpt-shell-4o-mini
|
|
3
|
+
Version: 1.2.1
|
|
4
|
+
Summary: A simple, lightweight CLI to use OpenAI's ChatGPT and DALL-E from the terminal
|
|
5
|
+
Author-email: wkdkavishka <w.k.d.kavishka@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/wkdkavishka/GPT-shell-4o-mini
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/wkdkavishka/GPT-shell-4o-mini/issues
|
|
9
|
+
Project-URL: Source Code, https://github.com/wkdkavishka/GPT-shell-4o-mini
|
|
10
|
+
Keywords: chatgpt,openai,cli,terminal,gpt,dalle,ai,assistant,wkdkavishka
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
14
|
+
Classifier: Topic :: Communications :: Chat
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Classifier: Environment :: Console
|
|
23
|
+
Requires-Python: >=3.7
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: openai>=1.0.0
|
|
27
|
+
Requires-Dist: rich>=10.0.0
|
|
28
|
+
Requires-Dist: requests>=2.25.0
|
|
29
|
+
Requires-Dist: distro>=1.5.0; sys_platform == "linux"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
### original work
|
|
33
|
+
|
|
34
|
+
https://github.com/0xacx/chatGPT-shell-cli
|
|
35
|
+
|
|
36
|
+
<div align=center>
|
|
37
|
+
I translated it to python, and added some features, Few things was not working for me, also updated to gpt 4o-mini
|
|
38
|
+
</div>
|
|
39
|
+
<div align=center>
|
|
40
|
+
** greate work from the original authour **
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div align="center">
|
|
44
|
+
|
|
45
|
+
<h1>GPT-shell-4o-mini</h1>
|
|
46
|
+
|
|
47
|
+
A simple, lightweight Python CLI to use OpenAI's ChatGPT and DALL-E from the terminal.
|
|
48
|
+
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
## Features ✨
|
|
52
|
+
|
|
53
|
+
### 🌍 **Cross-Platform Support**
|
|
54
|
+
|
|
55
|
+
- **Windows 10/11** - Full support with automatic environment variable setup
|
|
56
|
+
- **macOS** - Works seamlessly on all versions
|
|
57
|
+
- **Linux** - Supports all major distributions (Ubuntu, Fedora, Debian, Arch, etc.)
|
|
58
|
+
|
|
59
|
+
### 🧠 **Smart Terminal Context**
|
|
60
|
+
|
|
61
|
+
- **User Profile** - Remembers your OS, username, and distribution
|
|
62
|
+
- **Terminal Session Info** - Sends current working directory, shell type, and environment to ChatGPT
|
|
63
|
+
- **Intelligent Responses** - ChatGPT sees your context and environment for better assistance
|
|
64
|
+
|
|
65
|
+
### 🚀 **Easy Setup**
|
|
66
|
+
|
|
67
|
+
- **First-run wizard** - Automatic API key setup and verification
|
|
68
|
+
- **Python Package** - Installable via pip for easy management
|
|
69
|
+
- **Cross-platform** - Works on Windows, macOS, and Linux
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Getting Started
|
|
74
|
+
|
|
75
|
+
### Prerequisites
|
|
76
|
+
|
|
77
|
+
- **Python 3.7+** (usually pre-installed)
|
|
78
|
+
- **An OpenAI API key** - Get one free at [OpenAI](https://platform.openai.com/account/api-keys)
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### Installation
|
|
83
|
+
|
|
84
|
+
#### Installation
|
|
85
|
+
|
|
86
|
+
**Pip Installation (Recommended for all platforms):**
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
pip install gpt-shell-4o-mini
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
After installation, run `gpt` to start the setup wizard:
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
gpt
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The wizard will:
|
|
99
|
+
|
|
100
|
+
- Prompt for your OpenAI API key
|
|
101
|
+
- Verify the key with OpenAI
|
|
102
|
+
- Save it securely in your os environment
|
|
103
|
+
- Create your user profile
|
|
104
|
+
- Files Will be created at your home directory as chatgpt_py\*\*
|
|
105
|
+
|
|
106
|
+
### Uninstallation
|
|
107
|
+
|
|
108
|
+
#### **IMPORTANT: Command Order Matters**
|
|
109
|
+
|
|
110
|
+
**Always run `gpt-remove` BEFORE `pip uninstall`** - the `gpt-remove` command is part of the package and will be removed by `pip uninstall`.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
#### **Method 1: Complete Uninstall (Recommended)**
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
gpt-remove
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**What `gpt-remove` does:**
|
|
121
|
+
|
|
122
|
+
- **Interactive confirmation** - asks before proceeding
|
|
123
|
+
- **Removes configuration files** - deletes `~/.chatgpt_py_*` files
|
|
124
|
+
- **Cleans environment variables** - removes OPENAI_KEY from shell profiles
|
|
125
|
+
- **Uninstalls Python package** - runs `pip uninstall gpt-shell-4o-mini` automatically
|
|
126
|
+
- **Shows progress** - detailed feedback throughout the process
|
|
127
|
+
|
|
128
|
+
**Result:** Complete removal of all traces of the package
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
#### **Method 2: Basic Package Removal**
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
pip uninstall gpt-shell-4o-mini
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**What `pip uninstall` does:**
|
|
139
|
+
|
|
140
|
+
- **Removes Python package** - deletes package from site-packages
|
|
141
|
+
- **Removes commands** - deletes `gpt`, `chatgpt`, and `gpt-remove` commands
|
|
142
|
+
- **Leaves configuration files** - `~/.chatgpt_py_*` files remain
|
|
143
|
+
- **Leaves environment variables** - OPENAI_KEY in shell profiles remains
|
|
144
|
+
|
|
145
|
+
**Result:** Package removed but manual cleanup required
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
#### **Method 3: Manual Cleanup After Basic Uninstall**
|
|
150
|
+
|
|
151
|
+
If you already ran `pip uninstall` and need to clean up:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Download and run the uninstall module
|
|
155
|
+
curl -O https://raw.githubusercontent.com/wkdkavishka/GPT-shell-4o-mini/main/chatgpt/uninstall.py
|
|
156
|
+
python uninstall.py
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**What this does:**
|
|
160
|
+
|
|
161
|
+
- **Removes configuration files** - cleans up `~/.chatgpt_py_*` files
|
|
162
|
+
- **Cleans environment variables** - removes OPENAI_KEY from shell profiles
|
|
163
|
+
- **Cannot uninstall package** - package already removed
|
|
164
|
+
|
|
165
|
+
**Result:** Configuration cleanup only
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
### **Manual Cleanup Required After `pip uninstall`**
|
|
170
|
+
|
|
171
|
+
If you used `pip uninstall` without `gpt-remove`, manually remove:
|
|
172
|
+
|
|
173
|
+
- **Chat history**: `~/.chatgpt_py_history`
|
|
174
|
+
- **Custom system prompt**: `~/.chatgpt_py_sys_prompt`
|
|
175
|
+
- **User profile**: `~/.chatgpt_py_info`
|
|
176
|
+
- **Environment variables**: OPENAI_KEY from shell profiles (`~/.bashrc`, `~/.zshrc`, etc.)
|
|
177
|
+
|
|
178
|
+
## Usage
|
|
179
|
+
|
|
180
|
+
### Command Line Options
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
gpt [OPTIONS]
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
#### Basic Options
|
|
187
|
+
|
|
188
|
+
- `-h, --help` - Show help message and exit
|
|
189
|
+
- `-p, --prompt PROMPT` - Provide prompt directly instead of starting chat
|
|
190
|
+
- `--prompt-from-file FILE` - Provide prompt from a file
|
|
191
|
+
- `-l, --list` - List available OpenAI models
|
|
192
|
+
|
|
193
|
+
#### Model & Response Options
|
|
194
|
+
|
|
195
|
+
- `-m, --model MODEL` - Model to use (default: gpt-4o-mini)
|
|
196
|
+
- `-t, --temperature TEMPERATURE` - Sampling temperature (default: 0.7)
|
|
197
|
+
- `--max-tokens MAX_TOKENS` - Max tokens for completion (default: 1024)
|
|
198
|
+
- `-s, --size SIZE` - Image size for DALL-E (default: 512x512)
|
|
199
|
+
|
|
200
|
+
#### System Prompt Management
|
|
201
|
+
|
|
202
|
+
- `-i, --init-prompt PROMPT` - Provide initial system prompt (overrides default)
|
|
203
|
+
- `--init-prompt-from-file FILE` - Provide initial system prompt from file
|
|
204
|
+
- `--sys-prompt PROMPT` - Set or update custom system prompt (saved to ~/.chatgpt_py_sys_prompt)
|
|
205
|
+
- `--get-sys-prompt` - Show current custom system prompt
|
|
206
|
+
- `--reset-sys-prompt` - Remove custom system prompt and use default
|
|
207
|
+
|
|
208
|
+
#### Debug Options
|
|
209
|
+
|
|
210
|
+
- `--debug` - Print debug information including context sent to AI
|
|
211
|
+
|
|
212
|
+
### Usage Examples
|
|
213
|
+
|
|
214
|
+
#### Interactive Chat Mode
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
gpt
|
|
218
|
+
# Starts interactive chat with ChatGPT
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
#### Single Prompt Mode
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
gpt -p "What is the regex to match an email address?"
|
|
225
|
+
gpt --prompt "Translate to French: Hello World!"
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
#### Pipe Mode
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
echo "What is the command to get all pdf files created yesterday?" | gpt
|
|
232
|
+
ls -la | gpt -p "Explain these file permissions"
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
#### File Input
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
gpt --prompt-from-file my_prompt.txt
|
|
239
|
+
gpt --init-prompt-from-file custom_system_prompt.txt
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
#### Model Configuration
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
gpt --model gpt-4 --temperature 0.9 --max-tokens 2000
|
|
246
|
+
gpt -m gpt-4o -t 0.5
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
#### System Prompt Management
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
# Set custom system prompt
|
|
253
|
+
gpt --sys-prompt "You are a helpful Python programmer. Always provide code examples."
|
|
254
|
+
|
|
255
|
+
# View current system prompt
|
|
256
|
+
gpt --get-sys-prompt
|
|
257
|
+
|
|
258
|
+
# Reset to default
|
|
259
|
+
gpt --reset-sys-prompt
|
|
260
|
+
|
|
261
|
+
# Use temporary system prompt
|
|
262
|
+
gpt -i "You are a chef. Provide cooking advice." -p "How do I make pasta?"
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
#### Debug Mode
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
gpt --debug -p "Why is my script not working?"
|
|
269
|
+
gpt --debug # Starts interactive chat with debug info
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## 🧠 Terminal Context Feature
|
|
275
|
+
|
|
276
|
+
### How It Works
|
|
277
|
+
|
|
278
|
+
GPT-shell-4o-mini automatically sends contextual information with every prompt:
|
|
279
|
+
|
|
280
|
+
**User Profile** (`~/.chatgpt_py_info`):
|
|
281
|
+
|
|
282
|
+
- Your username
|
|
283
|
+
- Operating system and version
|
|
284
|
+
- Linux distribution (if applicable)
|
|
285
|
+
|
|
286
|
+
**Terminal Session** (captured in real-time):
|
|
287
|
+
|
|
288
|
+
- Current working directory
|
|
289
|
+
- Shell type (bash, zsh, PowerShell, etc.)
|
|
290
|
+
- Environment information
|
|
291
|
+
|
|
292
|
+
### Example
|
|
293
|
+
|
|
294
|
+
When you run `gpt`, ChatGPT sees:
|
|
295
|
+
|
|
296
|
+
```
|
|
297
|
+
[Static Profile: User: john | OS: Linux | Distro: Ubuntu 22.04]
|
|
298
|
+
[Terminal Session (Shell: bash | CWD: /home/john/project):
|
|
299
|
+
]
|
|
300
|
+
|
|
301
|
+
You: How do I fix this Python error?
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
ChatGPT response will be context-aware:
|
|
305
|
+
|
|
306
|
+
> "I see you're working in the `/home/john/project` directory on Ubuntu..."
|
|
307
|
+
|
|
308
|
+
### Debug Mode
|
|
309
|
+
|
|
310
|
+
Use `--debug` to see exactly what context is sent to ChatGPT:
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
gpt --debug -p "Help me debug this issue"
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
This will show:
|
|
317
|
+
|
|
318
|
+
- The full user profile
|
|
319
|
+
- Terminal session information
|
|
320
|
+
- Complete message history being sent
|
|
321
|
+
- Model parameters being used
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Support
|
|
326
|
+
|
|
327
|
+
For issues, questions, or contributions, please visit the
|
|
328
|
+
[GitHub Repository](https://github.com/wkdkavishka/GPT-shell-4o-mini)
|
|
329
|
+
|
|
330
|
+
## Interactive Commands
|
|
331
|
+
|
|
332
|
+
During interactive chat mode, you can use these special commands:
|
|
333
|
+
|
|
334
|
+
- `image:` Generate images - Start a prompt with `image:` followed by description
|
|
335
|
+
- Example: `image: a cute cat sitting on a laptop`
|
|
336
|
+
- `history` View your chat history
|
|
337
|
+
- `models` List available OpenAI models
|
|
338
|
+
- `model:` Get details on a specific model - Start with `model:` followed by model ID
|
|
339
|
+
- Example: `model: gpt-4o-mini`
|
|
340
|
+
- `command:` Generate and execute commands - Start with `command:` followed by description
|
|
341
|
+
- Example: `command: list all files larger than 100MB in current directory`
|
|
342
|
+
- `exit`, `quit`, `q` Exit the chat
|
|
343
|
+
|
|
344
|
+
### Image Generation
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
# In interactive mode
|
|
348
|
+
image: a beautiful sunset over mountains
|
|
349
|
+
|
|
350
|
+
# With specific size
|
|
351
|
+
gpt -s "1024x1024" -p "image: futuristic cityscape"
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
Available image sizes: `256x256`, `512x512`, `1024x1024`, `1792x1024`, `1024x1792`, `2048x2048`, `4096x4096`
|
|
355
|
+
|
|
356
|
+
### Command Generation
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
# In interactive mode
|
|
360
|
+
command: find all Python files with syntax errors
|
|
361
|
+
|
|
362
|
+
# As single prompt
|
|
363
|
+
gpt -p "command: compress all log files older than 30 days"
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
**⚠️ Safety Warning:** Generated commands are checked for dangerous patterns. You'll be asked to confirm before execution.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
chatgpt/__init__.py,sha256=ktX9tNoGM9InoUjJL43HBCzOaFxW4M1a3u321Z8kPPI,728
|
|
2
|
+
chatgpt/__main__.py,sha256=O4_eXDP45UchI01ejHa3nzbL7c-WqNzENIBfrapocMM,128
|
|
3
|
+
chatgpt/api_client.py,sha256=d5oxTf2aBvpz8CApiy3Dv2ALD7vqkEl9F-b6qvlbJzw,8243
|
|
4
|
+
chatgpt/checks.py,sha256=TSP-PC6FJkrf5ikLfKmusxU6-ROytv3iomyE70Jyofs,7403
|
|
5
|
+
chatgpt/cleanup.py,sha256=7UcX67q5NAnPfUHNRB9UMVUNvMNittEnR3jWtTRqCIY,4593
|
|
6
|
+
chatgpt/main.py,sha256=UF1ZSpBUoJXYPirQhJxQXV8pNSv64ZPLCboWUMG2YYE,20827
|
|
7
|
+
chatgpt/terminal_context.py,sha256=tKeSjR3xeCXHuUTrCCOK5IYZE28NM4bJDcaC0c4ukaU,1408
|
|
8
|
+
chatgpt/uninstall.py,sha256=hvZMdceBGftAPka2A3iCzSFX2_34BMYgZIlVd3gL9OY,7429
|
|
9
|
+
chatgpt/user_profile.py,sha256=oSAb1wCH0ziS2ur8TSwScXqM9ZlFuQ7NjAVps5zc5Ao,2197
|
|
10
|
+
gpt_shell_4o_mini-1.2.1.dist-info/licenses/LICENSE,sha256=fC2wgPkGoyEitWKciGFFxRWChmCggWGN7eG37VIFld0,1068
|
|
11
|
+
gpt_shell_4o_mini-1.2.1.dist-info/METADATA,sha256=jrmZBah2zDiWbIc0DwUvLYsmCyq6Vyp2ryYu_-Vop70,9902
|
|
12
|
+
gpt_shell_4o_mini-1.2.1.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
13
|
+
gpt_shell_4o_mini-1.2.1.dist-info/entry_points.txt,sha256=53oyN1rTTwXp56Eg-2aDjBm5OfUjuscYxDlK6jc430U,106
|
|
14
|
+
gpt_shell_4o_mini-1.2.1.dist-info/top_level.txt,sha256=ogfFw9mYdqL6TZsrlfGumrd61piUQvJzgEobqC7_tio,8
|
|
15
|
+
gpt_shell_4o_mini-1.2.1.dist-info/RECORD,,
|