ngpt 3.11.3__py3-none-any.whl → 3.12.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.
ngpt/cli/args.py CHANGED
@@ -30,9 +30,6 @@ def setup_argument_parser():
30
30
  # Version flag
31
31
  parser.add_argument('-v', '--version', action=ColoredVersionAction, nargs=0,
32
32
  help='Show version information and exit')
33
- # Language option for code mode
34
- parser.add_argument('--language', default="python",
35
- help='Programming language to generate code in (for code mode)')
36
33
 
37
34
  # Prompt argument
38
35
  parser.add_argument('prompt', nargs='?', default=None,
@@ -104,6 +101,11 @@ def setup_argument_parser():
104
101
  global_group.add_argument('--renderer', choices=['auto', 'rich', 'glow'], default='auto',
105
102
  help='Select which markdown renderer to use with --prettify or --stream-prettify (auto, rich, or glow)')
106
103
 
104
+ # Code Mode Options
105
+ code_group = parser.add_argument_group('Code Mode Options')
106
+ code_group.add_argument('--language', default="python",
107
+ help='Programming language to generate code in (for code mode)')
108
+
107
109
  # GitCommit message options
108
110
  gitcommsg_group = parser.add_argument_group('Git Commit Message Options')
109
111
  gitcommsg_group.add_argument('--rec-chunk', action='store_true',
@@ -124,6 +126,11 @@ def setup_argument_parser():
124
126
  rewrite_group.add_argument('--humanize', action='store_true',
125
127
  help='Transform AI-generated text into human-like content that passes AI detection tools')
126
128
 
129
+ # Interactive mode options
130
+ interactive_group = parser.add_argument_group('Interactive Mode Options')
131
+ interactive_group.add_argument('--multiline', action='store_true',
132
+ help='Enable multiline text input with the "ml" command in interactive mode')
133
+
127
134
  # Mode flags (mutually exclusive)
128
135
  mode_group = parser.add_argument_group('Modes (mutually exclusive)')
129
136
  mode_exclusive_group = mode_group.add_mutually_exclusive_group()
ngpt/cli/main.py CHANGED
@@ -63,29 +63,25 @@ def show_cli_config_help():
63
63
  # Print general options (available in all contexts)
64
64
  print(f" {COLORS['yellow']}General options (all modes):{COLORS['reset']}")
65
65
  for option in sorted(context_groups["all"]):
66
- meta = CLI_CONFIG_OPTIONS[option]
67
- default = f"(default: {meta['default']})" if meta['default'] is not None else ""
68
- exclusive = f" [exclusive with: {', '.join(meta['exclusive'])}]" if "exclusive" in meta else ""
69
- print(f" {COLORS['green']}{option}{COLORS['reset']} - {meta['type']} {default}{exclusive}")
70
-
71
- # Print mode-specific options
72
- for mode, options in [
73
- ("code", "Code generation mode"),
74
- ("interactive", "Interactive mode"),
75
- ("text", "Text mode"),
76
- ("shell", "Shell mode"),
77
- ("gitcommsg", "Git commit message mode") # Add gitcommsg mode
78
- ]:
79
- if context_groups[mode]:
80
- print(f"\n {COLORS['yellow']}Options for {options}:{COLORS['reset']}")
81
- for option in sorted(context_groups[mode]):
82
- # Skip if already listed in general options
83
- if option in context_groups["all"]:
84
- continue
85
- meta = CLI_CONFIG_OPTIONS[option]
86
- default = f"(default: {meta['default']})" if meta['default'] is not None else ""
87
- exclusive = f" [exclusive with: {', '.join(meta['exclusive'])}]" if "exclusive" in meta else ""
88
- print(f" {COLORS['green']}{option}{COLORS['reset']} - {meta['type']} {default}{exclusive}")
66
+ print(f" {option}")
67
+
68
+ # Print code options
69
+ if context_groups["code"]:
70
+ print(f"\n {COLORS['yellow']}Code mode options (-c/--code):{COLORS['reset']}")
71
+ for option in sorted(context_groups["code"]):
72
+ print(f" {option}")
73
+
74
+ # Print interactive mode options
75
+ if context_groups["interactive"]:
76
+ print(f"\n {COLORS['yellow']}Interactive mode options (-i/--interactive):{COLORS['reset']}")
77
+ for option in sorted(context_groups["interactive"]):
78
+ print(f" {option}")
79
+
80
+ # Print gitcommsg options
81
+ if context_groups["gitcommsg"]:
82
+ print(f"\n {COLORS['yellow']}Git commit message options (-g/--gitcommsg):{COLORS['reset']}")
83
+ for option in sorted(context_groups["gitcommsg"]):
84
+ print(f" {option}")
89
85
 
90
86
  print(f"\n {COLORS['cyan']}Example usage:{COLORS['reset']}")
91
87
  print(f" {COLORS['yellow']}ngpt --cli-config set language java{COLORS['reset']} - Set default language to java for code generation")
@@ -543,7 +539,8 @@ def main():
543
539
  prettify=args.prettify,
544
540
  renderer=args.renderer,
545
541
  stream_prettify=args.stream_prettify,
546
- logger=logger
542
+ logger=logger,
543
+ multiline_enabled=args.multiline
547
544
  )
548
545
  elif args.shell:
549
546
  # Apply CLI config for shell mode
@@ -6,7 +6,7 @@ import sys
6
6
  import time
7
7
  from ..formatters import COLORS
8
8
  from ..renderers import prettify_markdown, prettify_streaming_markdown, TERMINAL_RENDER_LOCK
9
- from ..ui import spinner
9
+ from ..ui import spinner, get_multiline_input
10
10
  from ...utils import enhance_prompt_with_web_search
11
11
 
12
12
  # Optional imports for enhanced UI
@@ -20,7 +20,7 @@ try:
20
20
  except ImportError:
21
21
  HAS_PROMPT_TOOLKIT = False
22
22
 
23
- def interactive_chat_session(client, web_search=False, no_stream=False, temperature=0.7, top_p=1.0, max_tokens=None, preprompt=None, prettify=False, renderer='auto', stream_prettify=False, logger=None):
23
+ def interactive_chat_session(client, web_search=False, no_stream=False, temperature=0.7, top_p=1.0, max_tokens=None, preprompt=None, prettify=False, renderer='auto', stream_prettify=False, logger=None, multiline_enabled=False):
24
24
  """Start an interactive chat session with the AI.
25
25
 
26
26
  Args:
@@ -35,6 +35,7 @@ def interactive_chat_session(client, web_search=False, no_stream=False, temperat
35
35
  renderer: Which markdown renderer to use
36
36
  stream_prettify: Whether to enable streaming with prettify
37
37
  logger: Logger instance for logging the conversation
38
+ multiline_enabled: Whether to enable the multiline input command
38
39
  """
39
40
  # Get terminal width for better formatting
40
41
  try:
@@ -60,6 +61,9 @@ def interactive_chat_session(client, web_search=False, no_stream=False, temperat
60
61
  print(f" {COLORS['yellow']}clear{COLORS['reset']} : Reset conversation")
61
62
  print(f" {COLORS['yellow']}exit{COLORS['reset']} : End session")
62
63
 
64
+ if multiline_enabled:
65
+ print(f" {COLORS['yellow']}ml{COLORS['reset']} : Open multiline editor")
66
+
63
67
  print(f"\n{separator}\n")
64
68
 
65
69
  # Show logging info if logger is available
@@ -184,6 +188,22 @@ def interactive_chat_session(client, web_search=False, no_stream=False, temperat
184
188
  if user_input.lower() == 'clear':
185
189
  clear_history()
186
190
  continue
191
+
192
+ if multiline_enabled and user_input.lower() == 'ml':
193
+ print(f"{COLORS['cyan']}Opening multiline editor. Press Ctrl+D to submit.{COLORS['reset']}")
194
+ multiline_input = get_multiline_input()
195
+ if multiline_input is None:
196
+ # Input was cancelled
197
+ print(f"{COLORS['yellow']}Multiline input cancelled.{COLORS['reset']}")
198
+ continue
199
+ elif not multiline_input.strip():
200
+ print(f"{COLORS['yellow']}Empty message skipped.{COLORS['reset']}")
201
+ continue
202
+ else:
203
+ # Use the multiline input as user_input
204
+ user_input = multiline_input
205
+ print(f"{user_header()}")
206
+ print(f"{COLORS['cyan']}│ {COLORS['reset']}{user_input}")
187
207
 
188
208
  # Skip empty messages but don't raise an error
189
209
  if not user_input.strip():
ngpt/utils/cli_config.py CHANGED
@@ -19,6 +19,8 @@ CLI_CONFIG_OPTIONS = {
19
19
  "renderer": {"type": "str", "default": "auto", "context": ["all"]},
20
20
  "config-index": {"type": "int", "default": 0, "context": ["all"], "exclusive": ["provider"]},
21
21
  "web-search": {"type": "bool", "default": False, "context": ["all"]},
22
+ # Interactive mode options
23
+ "interactive-multiline": {"type": "bool", "default": False, "context": ["interactive"]},
22
24
  # GitCommit message options
23
25
  "rec-chunk": {"type": "bool", "default": False, "context": ["gitcommsg"]},
24
26
  "diff": {"type": "str", "default": None, "context": ["gitcommsg"]},
@@ -243,6 +245,10 @@ def apply_cli_config(args: Any, mode: str) -> Any:
243
245
  # Convert dashes to underscores for argparse compatibility
244
246
  arg_name = option.replace("-", "_")
245
247
 
248
+ # Special case for interactive-multiline which maps to multiline argument
249
+ if option == "interactive-multiline":
250
+ arg_name = "multiline"
251
+
246
252
  # Skip if explicitly set via command line
247
253
  cli_option = f"--{option}"
248
254
  if cli_option in explicit_args:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ngpt
3
- Version: 3.11.3
3
+ Version: 3.12.1
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
@@ -281,14 +281,14 @@ For more examples and detailed usage, visit the [CLI Usage Guide](https://nazdri
281
281
  ```console
282
282
  ❯ ngpt -h
283
283
 
284
- usage: ngpt [-h] [-v] [--language LANGUAGE] [--config [CONFIG]] [--config-index CONFIG_INDEX] [--provider PROVIDER]
285
- [--remove] [--show-config] [--all] [--list-models] [--list-renderers] [--cli-config [COMMAND ...]]
286
- [--role-config [ACTION ...]] [--api-key API_KEY] [--base-url BASE_URL] [--model MODEL] [--web-search]
287
- [--pipe] [--temperature TEMPERATURE] [--top_p TOP_P] [--max_tokens MAX_TOKENS] [--log [FILE]]
284
+ usage: ngpt [-h] [-v] [--config [CONFIG]] [--config-index CONFIG_INDEX] [--provider PROVIDER] [--remove] [--show-config]
285
+ [--all] [--list-models] [--list-renderers] [--cli-config [COMMAND ...]] [--role-config [ACTION ...]]
286
+ [--api-key API_KEY] [--base-url BASE_URL] [--model MODEL] [--web-search] [--pipe]
287
+ [--temperature TEMPERATURE] [--top_p TOP_P] [--max_tokens MAX_TOKENS] [--log [FILE]]
288
288
  [--preprompt PREPROMPT | --role ROLE] [--no-stream | --prettify | --stream-prettify]
289
- [--renderer {auto,rich,glow}] [--rec-chunk] [--diff [FILE]] [--chunk-size CHUNK_SIZE]
289
+ [--renderer {auto,rich,glow}] [--language LANGUAGE] [--rec-chunk] [--diff [FILE]] [--chunk-size CHUNK_SIZE]
290
290
  [--analyses-chunk-size ANALYSES_CHUNK_SIZE] [--max-msg-lines MAX_MSG_LINES]
291
- [--max-recursion-depth MAX_RECURSION_DEPTH] [-i | -s | -c | -t | -r | -g] [--humanize]
291
+ [--max-recursion-depth MAX_RECURSION_DEPTH] [--humanize] [--multiline] [-i | -s | -c | -t | -r | -g]
292
292
  [prompt]
293
293
 
294
294
  nGPT - Interact with AI language models via OpenAI-compatible APIs
@@ -301,14 +301,15 @@ options::
301
301
 
302
302
  -h, --help show this help message and exit
303
303
  -v, --version Show version information and exit
304
- --language LANGUAGE Programming language to generate code in (for code mode)
305
304
 
306
305
  Configuration Options::
307
306
 
308
- --config [CONFIG] Path to a custom config file or, if no value provided, enter interactive configuration mode to create a new config
307
+ --config [CONFIG] Path to a custom config file or, if no value provided, enter interactive
308
+ configuration mode to create a new config
309
309
  --config-index CONFIG_INDEX Index of the configuration to use or edit (default: 0)
310
310
  --provider PROVIDER Provider name to identify the configuration to use
311
- --remove Remove the configuration at the specified index (requires --config and --config-index or --provider)
311
+ --remove Remove the configuration at the specified index (requires --config and
312
+ --config-index or --provider)
312
313
  --show-config Show the current configuration(s) and exit
313
314
  --all Show details for all configurations (requires --show-config)
314
315
  --list-models List all available models for the current configuration and exit
@@ -321,15 +322,21 @@ Global Options::
321
322
  --api-key API_KEY API key for the service
322
323
  --base-url BASE_URL Base URL for the API
323
324
  --model MODEL Model to use
324
- --web-search Enable web search capability using DuckDuckGo to enhance prompts with relevant information
325
- --pipe Read from stdin and use content with prompt. Use {} in prompt as placeholder for stdin content. Can be used with any mode option except --text and --interactive
325
+ --web-search Enable web search capability using DuckDuckGo to enhance prompts with relevant
326
+ information
327
+ --pipe Read from stdin and use content with prompt. Use {} in prompt as placeholder
328
+ for stdin content. Can be used with any mode option except --text and
329
+ --interactive
326
330
  --temperature TEMPERATURE Set temperature (controls randomness, default: 0.7)
327
331
  --top_p TOP_P Set top_p (controls diversity, default: 1.0)
328
332
  --max_tokens MAX_TOKENS Set max response length in tokens
329
- --log [FILE] Set filepath to log conversation to, or create a temporary log file if no path provided
333
+ --log [FILE] Set filepath to log conversation to, or create a temporary log file if no path
334
+ provided
330
335
  --preprompt PREPROMPT Set custom system prompt to control AI behavior
331
- --role ROLE Use a predefined role to set system prompt (mutually exclusive with --preprompt)
332
- --renderer {auto,rich,glow} Select which markdown renderer to use with --prettify or --stream-prettify (auto, rich, or glow)
336
+ --role ROLE Use a predefined role to set system prompt (mutually exclusive with
337
+ --preprompt)
338
+ --renderer {auto,rich,glow} Select which markdown renderer to use with --prettify or --stream-prettify
339
+ (auto, rich, or glow)
333
340
 
334
341
  Output Display Options (mutually exclusive)::
335
342
 
@@ -337,14 +344,30 @@ Output Display Options (mutually exclusive)::
337
344
  --prettify Render complete response with markdown and code formatting (non-streaming)
338
345
  --stream-prettify Stream response with real-time markdown rendering (default)
339
346
 
347
+ Code Mode Options::
348
+
349
+ --language LANGUAGE Programming language to generate code in (for code mode)
350
+
340
351
  Git Commit Message Options::
341
352
 
342
353
  --rec-chunk Process large diffs in chunks with recursive analysis if needed
343
- --diff [FILE] Use diff from specified file instead of staged changes. If used without a path, uses the path from CLI config.
354
+ --diff [FILE] Use diff from specified file instead of staged changes. If used without a path,
355
+ uses the path from CLI config.
344
356
  --chunk-size CHUNK_SIZE Number of lines per chunk when chunking is enabled (default: 200)
345
- --analyses-chunk-size ANALYSES_CHUNK_SIZE Number of lines per chunk when recursively chunking analyses (default: 200)
357
+ --analyses-chunk-size ANALYSES_CHUNK_SIZE
358
+ Number of lines per chunk when recursively chunking analyses (default: 200)
346
359
  --max-msg-lines MAX_MSG_LINES Maximum number of lines in commit message before condensing (default: 20)
347
- --max-recursion-depth MAX_RECURSION_DEPTH Maximum recursion depth for commit message condensing (default: 3)
360
+ --max-recursion-depth MAX_RECURSION_DEPTH
361
+ Maximum recursion depth for commit message condensing (default: 3)
362
+
363
+ Rewrite Mode Options::
364
+
365
+ --humanize Transform AI-generated text into human-like content that passes AI detection
366
+ tools
367
+
368
+ Interactive Mode Options::
369
+
370
+ --multiline Enable multiline text input with the "ml" command in interactive mode
348
371
 
349
372
  Modes (mutually exclusive)::
350
373
 
@@ -355,10 +378,6 @@ Modes (mutually exclusive)::
355
378
  -r, --rewrite Rewrite text from stdin to be more natural while preserving tone and meaning
356
379
  -g, --gitcommsg Generate AI-powered git commit messages from staged changes or diff file
357
380
 
358
- Rewrite Mode Options::
359
-
360
- --humanize Transform AI-generated text into human-like content that passes AI detection tools
361
-
362
381
  ```
363
382
 
364
383
  > **Note**: For better visualization of conventional commit messages on GitHub, you can use the [GitHub Commit Labels](https://greasyfork.org/en/scripts/526153-github-commit-labels) userscript, which adds colorful labels to your commits.
@@ -2,10 +2,10 @@ ngpt/__init__.py,sha256=kpKhViLakwMdHZkuLht2vWcjt0uD_5gR33gvMhfXr6w,664
2
2
  ngpt/__main__.py,sha256=j3eFYPOtCCFBOGh7NK5IWEnADnTMMSEB9GLyIDoW724,66
3
3
  ngpt/client.py,sha256=XjpA2UnvrRvzk6_DzVEddUTzoPlF8koQ-cZURpHoT7c,9041
4
4
  ngpt/cli/__init__.py,sha256=hebbDSMGiOd43YNnQP67uzr67Ue6rZPwm2czynr5iZY,43
5
- ngpt/cli/args.py,sha256=tHx5CwSzmynbdPV5D-ly3Hs7OInZXjrvnNodtW_Eypk,15048
5
+ ngpt/cli/args.py,sha256=LYz4MhJUg_4G0qps1QR22vp1_3riMbz6TdA85jL9aKQ,15400
6
6
  ngpt/cli/config_manager.py,sha256=NQQcWnjUppAAd0s0p9YAf8EyKS1ex5-0EB4DvKdB4dk,3662
7
7
  ngpt/cli/formatters.py,sha256=HBYGlx_7eoAKyzfy0Vq5L0yn8yVKjngqYBukMmXCcz0,9401
8
- ngpt/cli/main.py,sha256=36mi8uYDcl56IhTkt-TJTRRhwHeF157xMAYgufLRAMo,29256
8
+ ngpt/cli/main.py,sha256=P5ljHSRoWsmHBDKbY3WxMNNZB19ntZ3NURd7CWfHtOg,28811
9
9
  ngpt/cli/renderers.py,sha256=vAoDkpvgG2Fl81zkJDk_-zM1Fsw8E4Uv6m1AI81Fawo,17049
10
10
  ngpt/cli/roles.py,sha256=jtARS_XgZ1_UW8eAdLLMe7trpYhDnzEyCH9PYAiH-Og,9675
11
11
  ngpt/cli/ui.py,sha256=8-WyPMwgQiqLXWO0mGfBhKTRnIDDtPUtm_XCvOnqBJA,11334
@@ -13,18 +13,18 @@ ngpt/cli/modes/__init__.py,sha256=KP7VR6Xw9k1p5Jcu0F38RDxSFvFIzH3j1ThDLNwznUI,36
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
15
  ngpt/cli/modes/gitcommsg.py,sha256=qFOrll333ebFOkzLP_WD1Qw0VfpphYqeiuHumkP6OB4,54833
16
- ngpt/cli/modes/interactive.py,sha256=E0c38NA8xnuRKAce40F35uFYcohFDvaqSB8nf1ywS-4,17958
16
+ ngpt/cli/modes/interactive.py,sha256=bfXE7S3pSBgtazzmmOElbrRMZd7ahuZUB1uic1RDD-w,19073
17
17
  ngpt/cli/modes/rewrite.py,sha256=RaN4NOItKrGy5ilRrTa2amK4zmNo59j6K7plUf5SJPM,20290
18
18
  ngpt/cli/modes/shell.py,sha256=it1Brq1-LGeNfPKYBeVAwF-a78g9UP-KscofBZQkbr4,41589
19
19
  ngpt/cli/modes/text.py,sha256=NOikaU9YVCBgyaCl6pwy9EVt-YY5Q4jBx0l47izpVTA,6986
20
20
  ngpt/utils/__init__.py,sha256=_92f8eGMMOtQQA3uwgSRVwUEl1EIRFjWPUjcfGgI-eI,1244
21
- ngpt/utils/cli_config.py,sha256=Ug8cECBTIuzOwkBWidLTfs-OAdOsCMJ2bNa70pOADfw,11195
21
+ ngpt/utils/cli_config.py,sha256=2RX0PIiz9z6DCYe2fpWIPSRC8JQmzRLY4RTApJRVWe4,11491
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.11.3.dist-info/METADATA,sha256=V8jJuKwIMdwPM3PMxTuPhPldJJH-4IegwcIgx-NqBeU,31332
27
- ngpt-3.11.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
28
- ngpt-3.11.3.dist-info/entry_points.txt,sha256=SqAAvLhMrsEpkIr4YFRdUeyuXQ9o0IBCeYgE6AVojoI,44
29
- ngpt-3.11.3.dist-info/licenses/LICENSE,sha256=mQkpWoADxbHqE0HRefYLJdm7OpdrXBr3vNv5bZ8w72M,1065
30
- ngpt-3.11.3.dist-info/RECORD,,
26
+ ngpt-3.12.1.dist-info/METADATA,sha256=faQ_akxkNy8w9dORvyHQPMV8f1xtsVhOWn9nvoSkPxM,31935
27
+ ngpt-3.12.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
28
+ ngpt-3.12.1.dist-info/entry_points.txt,sha256=SqAAvLhMrsEpkIr4YFRdUeyuXQ9o0IBCeYgE6AVojoI,44
29
+ ngpt-3.12.1.dist-info/licenses/LICENSE,sha256=mQkpWoADxbHqE0HRefYLJdm7OpdrXBr3vNv5bZ8w72M,1065
30
+ ngpt-3.12.1.dist-info/RECORD,,
File without changes