ngpt 3.9.4__py3-none-any.whl → 3.9.6__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.
- ngpt/cli/modes/gitcommsg.py +20 -0
- ngpt/cli/modes/text.py +10 -2
- {ngpt-3.9.4.dist-info → ngpt-3.9.6.dist-info}/METADATA +1 -1
- {ngpt-3.9.4.dist-info → ngpt-3.9.6.dist-info}/RECORD +7 -7
- {ngpt-3.9.4.dist-info → ngpt-3.9.6.dist-info}/WHEEL +0 -0
- {ngpt-3.9.4.dist-info → ngpt-3.9.6.dist-info}/entry_points.txt +0 -0
- {ngpt-3.9.4.dist-info → ngpt-3.9.6.dist-info}/licenses/LICENSE +0 -0
ngpt/cli/modes/gitcommsg.py
CHANGED
@@ -998,6 +998,23 @@ def is_git_diff(content):
|
|
998
998
|
|
999
999
|
return False
|
1000
1000
|
|
1001
|
+
def strip_code_block_formatting(text):
|
1002
|
+
"""Strip code block formatting from the text if present.
|
1003
|
+
|
1004
|
+
Args:
|
1005
|
+
text: Text to strip code block formatting from
|
1006
|
+
|
1007
|
+
Returns:
|
1008
|
+
str: Text without code block formatting
|
1009
|
+
"""
|
1010
|
+
# Check if the text starts with ``` and ends with ```
|
1011
|
+
pattern = r'^```(?:.*?)\n(.*?)```$'
|
1012
|
+
match = re.search(pattern, text, re.DOTALL)
|
1013
|
+
if match:
|
1014
|
+
# Extract content between backticks and remove any trailing whitespace
|
1015
|
+
return match.group(1).rstrip()
|
1016
|
+
return text
|
1017
|
+
|
1001
1018
|
def gitcommsg_mode(client, args, logger=None):
|
1002
1019
|
"""Handle the Git commit message generation mode.
|
1003
1020
|
|
@@ -1183,6 +1200,9 @@ def gitcommsg_mode(client, args, logger=None):
|
|
1183
1200
|
print(f"{COLORS['red']}Failed to generate commit message.{COLORS['reset']}")
|
1184
1201
|
return
|
1185
1202
|
|
1203
|
+
# Strip any code block formatting
|
1204
|
+
result = strip_code_block_formatting(result)
|
1205
|
+
|
1186
1206
|
# Display the result
|
1187
1207
|
print(f"\n{COLORS['green']}✨ Generated Commit Message:{COLORS['reset']}\n")
|
1188
1208
|
print(result)
|
ngpt/cli/modes/text.py
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
from ..formatters import COLORS
|
2
2
|
from ..renderers import prettify_markdown, prettify_streaming_markdown, TERMINAL_RENDER_LOCK
|
3
|
-
from ..ui import get_multiline_input, spinner
|
3
|
+
from ..ui import get_multiline_input, spinner, copy_to_clipboard
|
4
4
|
from ...utils import enhance_prompt_with_web_search
|
5
5
|
import threading
|
6
6
|
import sys
|
7
|
+
import time
|
7
8
|
|
8
9
|
def text_mode(client, args, logger=None):
|
9
10
|
"""Handle the multi-line text input mode.
|
@@ -152,6 +153,8 @@ def text_mode(client, args, logger=None):
|
|
152
153
|
# Before stopping the live display, update with complete=True to show final formatted content
|
153
154
|
if stream_callback and response:
|
154
155
|
stream_callback(response, complete=True)
|
156
|
+
# Add a small delay to ensure terminal stability
|
157
|
+
time.sleep(0.2)
|
155
158
|
|
156
159
|
# Log the AI response if logging is enabled
|
157
160
|
if logger and response:
|
@@ -163,4 +166,9 @@ def text_mode(client, args, logger=None):
|
|
163
166
|
if args.prettify:
|
164
167
|
prettify_markdown(response, args.renderer)
|
165
168
|
else:
|
166
|
-
print(response)
|
169
|
+
print(response)
|
170
|
+
|
171
|
+
# Offer to copy to clipboard if not in a redirected output
|
172
|
+
if not args.no_stream and response:
|
173
|
+
with TERMINAL_RENDER_LOCK:
|
174
|
+
copy_to_clipboard(response)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ngpt
|
3
|
-
Version: 3.9.
|
3
|
+
Version: 3.9.6
|
4
4
|
Summary: A Swiss army knife for LLMs: A fast, lightweight CLI and interactive chat tool that brings the power of any OpenAI-compatible LLM (OpenAI, Ollama, Groq, Claude, Gemini, etc.) straight to your terminal. rewrite texts or refine code, craft git commit messages, generate and run OS-aware shell commands.
|
5
5
|
Project-URL: Homepage, https://github.com/nazdridoy/ngpt
|
6
6
|
Project-URL: Repository, https://github.com/nazdridoy/ngpt
|
@@ -12,19 +12,19 @@ ngpt/cli/ui.py,sha256=8-WyPMwgQiqLXWO0mGfBhKTRnIDDtPUtm_XCvOnqBJA,11334
|
|
12
12
|
ngpt/cli/modes/__init__.py,sha256=KP7VR6Xw9k1p5Jcu0F38RDxSFvFIzH3j1ThDLNwznUI,363
|
13
13
|
ngpt/cli/modes/chat.py,sha256=x1leClKq7UupA_CdW4tym0AivY2o_II123-I5IcAkxQ,7091
|
14
14
|
ngpt/cli/modes/code.py,sha256=Qj59xq6fZqgUDw7SbvmPKX_gdpc7DHJhNkn1sB5qgUU,12932
|
15
|
-
ngpt/cli/modes/gitcommsg.py,sha256=
|
15
|
+
ngpt/cli/modes/gitcommsg.py,sha256=21I3WZYa8Eb3BKPn6-aLMN7OhEmo1KHHnhTpnJkGesg,50242
|
16
16
|
ngpt/cli/modes/interactive.py,sha256=E0c38NA8xnuRKAce40F35uFYcohFDvaqSB8nf1ywS-4,17958
|
17
17
|
ngpt/cli/modes/rewrite.py,sha256=QQm453X9aoUQP9CAtmeghlMytMJPlsDZPKef9tGfj6g,11181
|
18
18
|
ngpt/cli/modes/shell.py,sha256=it1Brq1-LGeNfPKYBeVAwF-a78g9UP-KscofBZQkbr4,41589
|
19
|
-
ngpt/cli/modes/text.py,sha256=
|
19
|
+
ngpt/cli/modes/text.py,sha256=NOikaU9YVCBgyaCl6pwy9EVt-YY5Q4jBx0l47izpVTA,6986
|
20
20
|
ngpt/utils/__init__.py,sha256=_92f8eGMMOtQQA3uwgSRVwUEl1EIRFjWPUjcfGgI-eI,1244
|
21
21
|
ngpt/utils/cli_config.py,sha256=Ug8cECBTIuzOwkBWidLTfs-OAdOsCMJ2bNa70pOADfw,11195
|
22
22
|
ngpt/utils/config.py,sha256=wsArA4osnh8fKqOvtsPqqBxAz3DpdjtaWUFaRtnUdyc,10452
|
23
23
|
ngpt/utils/log.py,sha256=f1jg2iFo35PAmsarH8FVL_62plq4VXH0Mu2QiP6RJGw,15934
|
24
24
|
ngpt/utils/pipe.py,sha256=qRHF-Ma7bbU0cOcb1Yhe4S-kBavivtnnvLA3EYS4FY4,2162
|
25
25
|
ngpt/utils/web_search.py,sha256=w5ke4KJMRxq7r5jtbUXvspja6XhjoPZloVkZ0IvBXIE,30731
|
26
|
-
ngpt-3.9.
|
27
|
-
ngpt-3.9.
|
28
|
-
ngpt-3.9.
|
29
|
-
ngpt-3.9.
|
30
|
-
ngpt-3.9.
|
26
|
+
ngpt-3.9.6.dist-info/METADATA,sha256=ZuhiHI7b-ZzBTx1YUeWCdFlcGvzFTtgAVuTCQV2CaJo,31174
|
27
|
+
ngpt-3.9.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
28
|
+
ngpt-3.9.6.dist-info/entry_points.txt,sha256=SqAAvLhMrsEpkIr4YFRdUeyuXQ9o0IBCeYgE6AVojoI,44
|
29
|
+
ngpt-3.9.6.dist-info/licenses/LICENSE,sha256=mQkpWoADxbHqE0HRefYLJdm7OpdrXBr3vNv5bZ8w72M,1065
|
30
|
+
ngpt-3.9.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|