ngpt 3.5.2__tar.gz → 3.5.4__tar.gz
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.
- {ngpt-3.5.2 → ngpt-3.5.4}/PKG-INFO +2 -2
- {ngpt-3.5.2 → ngpt-3.5.4}/README.md +1 -1
- {ngpt-3.5.2 → ngpt-3.5.4}/docs/examples/basic.md +2 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/docs/index.md +2 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/docs/overview.md +2 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/docs/usage/cli_config.md +2 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/docs/usage/cli_usage.md +2 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/docs/usage/gitcommsg.md +2 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/docs/usage/web_search.md +2 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/cli/modes/code.py +6 -2
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/cli/modes/gitcommsg.py +4 -10
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/cli/modes/rewrite.py +3 -45
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/cli/ui.py +63 -0
- ngpt-3.5.4/previews/ngpt-g.png +0 -0
- ngpt-3.5.4/previews/ngpt-i.png +0 -0
- ngpt-3.5.4/previews/ngpt-s-c.png +0 -0
- ngpt-3.5.4/previews/ngpt-sh-c-a.png +0 -0
- ngpt-3.5.4/previews/ngpt-w-self.png +0 -0
- ngpt-3.5.4/previews/ngpt-w.png +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/pyproject.toml +1 -1
- {ngpt-3.5.2 → ngpt-3.5.4}/uv.lock +1 -1
- {ngpt-3.5.2 → ngpt-3.5.4}/.github/workflows/aur-publish.yml +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/.github/workflows/python-publish.yml +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/.gitignore +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/.python-version +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/COMMIT_GUIDELINES.md +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/CONTRIBUTING.md +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/LICENSE +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/PKGBUILD +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/docs/CONTRIBUTING.md +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/docs/LICENSE.md +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/docs/_config.yml +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/docs/_sass/custom/custom.scss +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/docs/configuration.md +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/docs/examples/advanced.md +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/docs/examples.md +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/docs/installation.md +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/docs/usage.md +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/__init__.py +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/__main__.py +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/cli/__init__.py +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/cli/args.py +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/cli/config_manager.py +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/cli/formatters.py +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/cli/main.py +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/cli/modes/__init__.py +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/cli/modes/chat.py +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/cli/modes/interactive.py +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/cli/modes/shell.py +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/cli/modes/text.py +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/cli/renderers.py +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/client.py +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/utils/__init__.py +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/utils/cli_config.py +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/utils/config.py +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/utils/log.py +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/ngpt/utils/web_search.py +0 -0
- {ngpt-3.5.2 → ngpt-3.5.4}/wiki.md +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ngpt
|
3
|
-
Version: 3.5.
|
3
|
+
Version: 3.5.4
|
4
4
|
Summary: Swiss army knife for LLMs: powerful CLI and interactive chatbot in one package. Seamlessly work with OpenAI, Ollama, Groq, Claude, Gemini, or any OpenAI-compatible API to generate code, craft git commits, rewrite text, and execute shell commands.
|
5
5
|
Project-URL: Homepage, https://github.com/nazdridoy/ngpt
|
6
6
|
Project-URL: Repository, https://github.com/nazdridoy/ngpt
|
@@ -54,7 +54,7 @@ Description-Content-Type: text/markdown
|
|
54
54
|
🤖 nGPT: A Swiss army knife for LLMs: powerful CLI and interactive chatbot in one package. Seamlessly work with OpenAI, Ollama, Groq, Claude, Gemini, or any OpenAI-compatible API to generate code, craft git commits, rewrite text, and execute shell commands. Fast, lightweight, and designed for both casual users and developers.
|
55
55
|
|
56
56
|
|
57
|
-

|
58
58
|
|
59
59
|
|
60
60
|
## Features
|
@@ -17,7 +17,7 @@
|
|
17
17
|
🤖 nGPT: A Swiss army knife for LLMs: powerful CLI and interactive chatbot in one package. Seamlessly work with OpenAI, Ollama, Groq, Claude, Gemini, or any OpenAI-compatible API to generate code, craft git commits, rewrite text, and execute shell commands. Fast, lightweight, and designed for both casual users and developers.
|
18
18
|
|
19
19
|
|
20
|
-

|
21
21
|
|
22
22
|
|
23
23
|
## Features
|
@@ -10,6 +10,8 @@ permalink: /examples/basic/
|
|
10
10
|
|
11
11
|
This page provides practical examples of common nGPT usage patterns. These examples demonstrate the basic capabilities and how to use the most frequent commands.
|
12
12
|
|
13
|
+

|
14
|
+
|
13
15
|
## Chat Examples
|
14
16
|
|
15
17
|
### Simple Question and Answer
|
@@ -26,6 +26,8 @@ Welcome to the nGPT documentation. This guide will help you get started with nGP
|
|
26
26
|
- [License](LICENSE.md)
|
27
27
|
|
28
28
|
|
29
|
+

|
30
|
+
|
29
31
|
## What is nGPT?
|
30
32
|
|
31
33
|
nGPT is a versatile command-line tool designed to interact with AI language models through various APIs. It provides a seamless interface for generating text, code, shell commands, and more, all from your terminal.
|
@@ -11,6 +11,8 @@ permalink: /overview/
|
|
11
11
|
|
12
12
|
nGPT is a Swiss army knife for LLMs: powerful CLI and interactive chatbot in one package. Seamlessly work with OpenAI, Ollama, Groq, Claude, Gemini, or any OpenAI-compatible API to generate code, craft git commits, rewrite text, and execute shell commands. Fast, lightweight, and designed for both casual users and developers.
|
13
13
|
|
14
|
+

|
15
|
+
|
14
16
|
## Key Features
|
15
17
|
|
16
18
|
- **Versatile**: Powerful and easy-to-use CLI tool for various AI tasks
|
@@ -10,6 +10,8 @@ permalink: /usage/cli_config/
|
|
10
10
|
|
11
11
|
nGPT offers a CLI configuration system that allows you to set persistent default values for command-line options. This guide explains how to use and manage CLI configurations.
|
12
12
|
|
13
|
+

|
14
|
+
|
13
15
|
## Overview
|
14
16
|
|
15
17
|
The CLI configuration system is separate from your API configuration (which stores API keys, base URLs, and models). Instead, it stores your preferred default values for CLI parameters like `temperature`, `language`, or `renderer`.
|
@@ -10,6 +10,8 @@ permalink: /usage/cli_usage/
|
|
10
10
|
|
11
11
|
This guide provides comprehensive documentation on how to use nGPT as a command-line interface (CLI) tool.
|
12
12
|
|
13
|
+

|
14
|
+
|
13
15
|
## Basic Usage
|
14
16
|
|
15
17
|
The most basic way to use nGPT from the command line is to provide a prompt:
|
@@ -10,6 +10,8 @@ permalink: /usage/gitcommsg/
|
|
10
10
|
|
11
11
|
nGPT offers a powerful feature for automatically generating conventional, detailed commit messages from git diffs. This guide explains how to use and customize this functionality.
|
12
12
|
|
13
|
+

|
14
|
+
|
13
15
|
## Overview
|
14
16
|
|
15
17
|
The git commit message generation feature (`-g` or `--gitcommsg` flag) analyzes your staged changes (or a provided diff file) and generates a comprehensive commit message following the [Conventional Commits](https://www.conventionalcommits.org/) format.
|
@@ -15,6 +15,8 @@ nGPT includes a powerful web search capability that enhances your prompts with r
|
|
15
15
|
- Providing context for questions about current events
|
16
16
|
- Fact-checking and verification
|
17
17
|
|
18
|
+

|
19
|
+
|
18
20
|
## Using Web Search
|
19
21
|
|
20
22
|
To enable web search in nGPT, use the `--web-search` or `--web` flag:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from ..formatters import COLORS
|
2
2
|
from ..renderers import prettify_markdown, prettify_streaming_markdown, has_markdown_renderer, show_available_renderers
|
3
|
-
from ..ui import spinner
|
3
|
+
from ..ui import spinner, copy_to_clipboard
|
4
4
|
from ...utils import enhance_prompt_with_web_search
|
5
5
|
import sys
|
6
6
|
import threading
|
@@ -298,4 +298,8 @@ def code_mode(client, args, logger=None):
|
|
298
298
|
prettify_markdown(generated_code, args.renderer)
|
299
299
|
else:
|
300
300
|
# Should only happen if --no-stream was used without prettify
|
301
|
-
print(f"\nGenerated code:\n{generated_code}")
|
301
|
+
print(f"\nGenerated code:\n{generated_code}")
|
302
|
+
|
303
|
+
# Offer to copy to clipboard
|
304
|
+
if generated_code and not args.no_stream:
|
305
|
+
copy_to_clipboard(generated_code)
|
@@ -8,7 +8,7 @@ import threading
|
|
8
8
|
from datetime import datetime
|
9
9
|
import logging
|
10
10
|
from ..formatters import COLORS
|
11
|
-
from ..ui import spinner
|
11
|
+
from ..ui import spinner, copy_to_clipboard
|
12
12
|
from ...utils.log import create_gitcommsg_logger
|
13
13
|
from ...utils.cli_config import get_cli_config_option
|
14
14
|
|
@@ -1128,15 +1128,9 @@ def gitcommsg_mode(client, args, logger=None):
|
|
1128
1128
|
active_logger.log_content("INFO", "FINAL_COMMIT_MESSAGE", result)
|
1129
1129
|
|
1130
1130
|
# Try to copy to clipboard
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
print(f"\n{COLORS['green']}(Copied to clipboard){COLORS['reset']}")
|
1135
|
-
if active_logger:
|
1136
|
-
active_logger.info("Commit message copied to clipboard")
|
1137
|
-
except ImportError:
|
1138
|
-
if active_logger:
|
1139
|
-
active_logger.debug("pyperclip not available, couldn't copy to clipboard")
|
1131
|
+
copy_to_clipboard(result)
|
1132
|
+
if active_logger:
|
1133
|
+
active_logger.info("Offered to copy commit message to clipboard")
|
1140
1134
|
|
1141
1135
|
except Exception as e:
|
1142
1136
|
print(f"{COLORS['red']}Error: {str(e)}{COLORS['reset']}")
|
@@ -1,10 +1,9 @@
|
|
1
1
|
import sys
|
2
|
-
import platform
|
3
2
|
import threading
|
4
3
|
import time
|
5
4
|
from ..formatters import COLORS
|
6
5
|
from ..renderers import prettify_markdown, prettify_streaming_markdown
|
7
|
-
from ..ui import get_multiline_input, spinner
|
6
|
+
from ..ui import get_multiline_input, spinner, copy_to_clipboard
|
8
7
|
from ...utils import enhance_prompt_with_web_search
|
9
8
|
|
10
9
|
# System prompt for rewriting text
|
@@ -71,28 +70,6 @@ ORIGINAL: "The user interface, which is built using React, Redux, and various ot
|
|
71
70
|
BETTER: "The React/Redux user interface needs redesigning to accommodate our planned new features."
|
72
71
|
"""
|
73
72
|
|
74
|
-
def get_terminal_input():
|
75
|
-
"""Get input from terminal in a cross-platform way, even when stdin is redirected."""
|
76
|
-
if platform.system() == 'Windows':
|
77
|
-
# Windows-specific solution
|
78
|
-
try:
|
79
|
-
import msvcrt
|
80
|
-
sys.stdout.flush()
|
81
|
-
# Wait for a keypress
|
82
|
-
char = msvcrt.getch().decode('utf-8').lower()
|
83
|
-
print(char) # Echo the character
|
84
|
-
return char
|
85
|
-
except ImportError:
|
86
|
-
# Fallback if msvcrt is not available
|
87
|
-
return None
|
88
|
-
else:
|
89
|
-
# Unix-like systems (Linux, macOS)
|
90
|
-
try:
|
91
|
-
with open('/dev/tty', 'r') as tty:
|
92
|
-
return tty.readline().strip().lower()
|
93
|
-
except (IOError, OSError):
|
94
|
-
return None
|
95
|
-
|
96
73
|
def rewrite_mode(client, args, logger=None):
|
97
74
|
"""Handle the text rewriting mode.
|
98
75
|
|
@@ -267,24 +244,5 @@ def rewrite_mode(client, args, logger=None):
|
|
267
244
|
print(response)
|
268
245
|
|
269
246
|
# Offer to copy to clipboard if not in a redirected output
|
270
|
-
if not args.no_stream and
|
271
|
-
|
272
|
-
# Make sure to flush output before asking for input
|
273
|
-
# Make the prompt more visible with colors and formatting
|
274
|
-
clipboard_prompt = f"{COLORS['cyan']}{COLORS['bold']}Copy to clipboard? (y/n){COLORS['reset']} "
|
275
|
-
print(clipboard_prompt, end="")
|
276
|
-
sys.stdout.flush()
|
277
|
-
|
278
|
-
# Cross-platform terminal input
|
279
|
-
answer = get_terminal_input()
|
280
|
-
|
281
|
-
if answer == 'y':
|
282
|
-
try:
|
283
|
-
import pyperclip
|
284
|
-
pyperclip.copy(response)
|
285
|
-
print(f"{COLORS['green']}Copied to clipboard.{COLORS['reset']}")
|
286
|
-
except ImportError:
|
287
|
-
print(f"{COLORS['yellow']}pyperclip not installed. Try: pip install \"ngpt[clipboard]\" {COLORS['reset']}")
|
288
|
-
|
289
|
-
except (KeyboardInterrupt, EOFError):
|
290
|
-
pass
|
247
|
+
if not args.no_stream and response:
|
248
|
+
copy_to_clipboard(response)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import sys
|
2
2
|
import time
|
3
3
|
import shutil
|
4
|
+
import platform
|
4
5
|
from .formatters import COLORS
|
5
6
|
|
6
7
|
# Optional imports for enhanced UI
|
@@ -155,6 +156,68 @@ def get_multiline_input():
|
|
155
156
|
print("\nInput cancelled by user. Exiting gracefully.")
|
156
157
|
return None
|
157
158
|
|
159
|
+
def get_terminal_input():
|
160
|
+
"""Get input from terminal in a cross-platform way, even when stdin is redirected."""
|
161
|
+
if platform.system() == 'Windows':
|
162
|
+
# Windows-specific solution
|
163
|
+
try:
|
164
|
+
import msvcrt
|
165
|
+
sys.stdout.flush()
|
166
|
+
# Wait for a keypress
|
167
|
+
char = msvcrt.getch().decode('utf-8').lower()
|
168
|
+
print(char) # Echo the character
|
169
|
+
return char
|
170
|
+
except ImportError:
|
171
|
+
# Fallback if msvcrt is not available
|
172
|
+
return None
|
173
|
+
else:
|
174
|
+
# Unix-like systems (Linux, macOS)
|
175
|
+
try:
|
176
|
+
with open('/dev/tty', 'r') as tty:
|
177
|
+
return tty.readline().strip().lower()
|
178
|
+
except (IOError, OSError):
|
179
|
+
return None
|
180
|
+
|
181
|
+
def copy_to_clipboard(content, prompt_message=None):
|
182
|
+
"""Copy content to clipboard with user confirmation.
|
183
|
+
|
184
|
+
Args:
|
185
|
+
content: The text content to copy to clipboard
|
186
|
+
prompt_message: Optional custom message for the prompt (default: "Copy to clipboard? (y/n)")
|
187
|
+
|
188
|
+
Returns:
|
189
|
+
bool: True if copied to clipboard successfully, False otherwise
|
190
|
+
"""
|
191
|
+
# Only prompt if stdout is connected to a terminal
|
192
|
+
if not sys.stdout.isatty():
|
193
|
+
return False
|
194
|
+
|
195
|
+
try:
|
196
|
+
# Default prompt message
|
197
|
+
if prompt_message is None:
|
198
|
+
prompt_message = "Copy to clipboard? (y/n)"
|
199
|
+
|
200
|
+
# Make the prompt more visible with colors and formatting
|
201
|
+
clipboard_prompt = f"{COLORS['cyan']}{COLORS['bold']}{prompt_message}{COLORS['reset']} "
|
202
|
+
print(clipboard_prompt, end="")
|
203
|
+
sys.stdout.flush()
|
204
|
+
|
205
|
+
# Cross-platform terminal input
|
206
|
+
answer = get_terminal_input()
|
207
|
+
|
208
|
+
if answer == 'y':
|
209
|
+
try:
|
210
|
+
import pyperclip
|
211
|
+
pyperclip.copy(content)
|
212
|
+
print(f"{COLORS['green']}Copied to clipboard.{COLORS['reset']}")
|
213
|
+
return True
|
214
|
+
except ImportError:
|
215
|
+
print(f"{COLORS['yellow']}pyperclip not installed. Try: pip install \"ngpt[clipboard]\" {COLORS['reset']}")
|
216
|
+
return False
|
217
|
+
return False
|
218
|
+
except (KeyboardInterrupt, EOFError):
|
219
|
+
return False
|
220
|
+
|
158
221
|
def spinner(message, duration=5, spinner_chars="⣾⣽⣻⢿⡿⣟⣯⣷", color=None, stop_event=None, clean_exit=False):
|
159
222
|
"""Display a spinner animation with a message.
|
160
223
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "ngpt"
|
3
|
-
version = "3.5.
|
3
|
+
version = "3.5.4"
|
4
4
|
description = "Swiss army knife for LLMs: powerful CLI and interactive chatbot in one package. Seamlessly work with OpenAI, Ollama, Groq, Claude, Gemini, or any OpenAI-compatible API to generate code, craft git commits, rewrite text, and execute shell commands."
|
5
5
|
authors = [
|
6
6
|
{name = "nazDridoy", email = "nazdridoy399@gmail.com"},
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|