Skip to content

Commit 68c212b

Browse files
committed
- Tabulate help info - h
- Increase version count prior to release - v0.2.3
1 parent f97d26c commit 68c212b

File tree

5 files changed

+76
-20
lines changed

5 files changed

+76
-20
lines changed

docs/CHANGELOG.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
**What's new?**
44

5-
- Initial release.
5+
- Initial release.
66

77
## v0.0.2
88

99
**What's new?**
10+
1011
- Enhanced response generation
1112
- Prompt optimizers added - *[code, shell_command]*
1213
- Prompt optimizers added - *Console*
@@ -15,30 +16,35 @@
1516
## v0.0.3
1617

1718
**What's new?**
19+
1820
- Busy bar index bug **fixed** - *(Console)*
1921
- Other minor fixed.
2022

2123
## v0.0.4
2224

2325
**What's new?**
26+
2427
- Minor fixes
2528

2629
## v0.0.5
2730

2831
**What's new?**
32+
2933
- Multiple variables renamed.
3034
- First release under `python-tgpt`
3135

3236
## v0.0.6
3337

3438
**What's new?**
39+
3540
- `generate` is the default command. Thanks to @sameedzahoor
3641
- Control response framing `--quiet`
3742
- `generate` based prompt optimizaion - `--code` & `--shell`
3843

3944
## v0.0.7
4045

4146
**What's new?**
47+
4248
- Chat conversationally - *(Experimental)*
4349
- Maintain chat history *.txt*
4450
- Load chat history from file
@@ -47,6 +53,7 @@
4753
## v0.0.8
4854

4955
**What's new?**
56+
5057
- Reading piped input as prompt - *(Console)*. Thanks to @sameedzahoor
5158
- Reset conversation - *(Console)*
5259
- View conversation history - *(Console)*
@@ -55,43 +62,62 @@
5562
## v0.0.9
5663

5764
**What's new?**
65+
5866
- Chatting conversationally - **Stable**
5967

6068
## v0.1.0
6169

6270
**What's new?**
71+
6372
- Chatting conversationally - **Default Mode**
6473

6574
## v0.1.1
6675

6776
**What's new?**
77+
6878
- Bug fixed - *file not found error*
6979

7080
## v0.1.2
7181

7282
**What's new?**
83+
7384
- Check version - `--version`
7485
- Minor fixes.
7586

7687
## v0.1.3
7788

7889
**What's new?**
90+
7991
- Invalid response - **fixed**
8092

8193
## v0.1.4
94+
8295
**What's new?**
96+
8397
- Incomplete response - **fixed**
8498

8599
## v0.2.0
100+
86101
**What's new?**
87-
- Multiple LLM providers
88102

103+
- Multiple LLM providers
89104

90105
## v0.2.1
106+
91107
**What's new?**
108+
92109
- Fakeopen rendering issue fixed - [#7](https://github.com/Simatwa/python-tgpt/issues/7)
93110

94111
## v0.2.2
112+
95113
**What's new?**
114+
96115
- Package renamed to **pytgpt** - [#7](https://github.com/Simatwa/python-tgpt/issues/7)
97-
- Visible vertical overflow - [#7](https://github.com/Simatwa/python-tgpt/issues/7)
116+
- Visible vertical overflow - [#7](https://github.com/Simatwa/python-tgpt/issues/7)
117+
118+
## v0.2.3
119+
120+
**What's new?**
121+
122+
- Tabulated help info - `h`
123+
- Control response vertical overflow behaviour.

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<a href="https://github.com/Simatwa/python-tgpt/actions/workflows/python-test.yml"><img src="https://github.com/Simatwa/python-tgpt/actions/workflows/python-test.yml/badge.svg" alt="Python Test"/></a>
99
-->
1010
<a href="https://github.com/Simatwa/python-tgpt/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/static/v1?logo=GPL&color=Blue&message=MIT&label=License"/></a>
11-
<a href="https://pypi.org/project/python-tgpt"><img alt="PyPi" src="https://img.shields.io/static/v1?logo=pypi&label=Pypi&message=0.2.2&color=green"/></a>
11+
<a href="https://pypi.org/project/python-tgpt"><img alt="PyPi" src="https://img.shields.io/static/v1?logo=pypi&label=Pypi&message=0.2.3&color=green"/></a>
1212
<a href="https://github.com/psf/black"><img alt="Black" src="https://img.shields.io/static/v1?logo=Black&label=Code-style&message=Black"/></a>
1313
<a href="#"><img alt="Passing" src="https://img.shields.io/static/v1?logo=Docs&label=Docs&message=Passing&color=green"/></a>
1414
<a href="https://github.com/Simatwa/python-tgpt/actions/workflows/python-package.yml"><img src="https://github.com/Simatwa/python-tgpt/actions/workflows/python-package.yml/badge.svg"/></a>

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
setup(
1616
name="python-tgpt",
17-
version="0.2.2",
17+
version="0.2.3",
1818
license="MIT",
1919
author="Smartwa",
2020
maintainer="Smartwa",

src/pytgpt/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from .utils import appdir
22

3-
__version__ = "0.2.2"
3+
__version__ = "0.2.3"
44
__author__ = "Smartwa"
55
__repo__ = "https://github.com/Simatwa/python-tgpt"
66

src/pytgpt/console.py

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from rich.markdown import Markdown
2020
from rich.console import Console
2121
from rich.live import Live
22+
from rich.table import Table
2223
from rich.prompt import Prompt
2324
from typing import Iterator
2425
from pytgpt.utils import Optimizers
@@ -185,7 +186,7 @@ def main(*args, **kwargs):
185186

186187

187188
class Main(cmd.Cmd):
188-
intro = f"Welcome to AI Chat in terminal. Type 'help' or '?' for usage info \n Submit any bug at {pytgpt.__repo__}/issues/new"
189+
intro = f"Welcome to AI Chat in terminal. Type 'help' or 'h' for usage info \n Submit any bug at {pytgpt.__repo__}/issues/new"
189190
prompt = f"╭─[{getpass.getuser().capitalize()}@TGPT](v{pytgpt.__version__})\n╰─>"
190191

191192
def __init__(
@@ -368,11 +369,52 @@ def output_bond(
368369
json.dump(text, fh, indent=4)
369370
click.secho(f"Successfuly saved to `{save_to}`", fg="green")
370371

372+
def do_h(self, line):
373+
"""Show help info in tabular form"""
374+
table = Table(
375+
title="Help info",
376+
show_lines=True,
377+
)
378+
table.add_column("No.", style="white", justify="center")
379+
table.add_column("Command", style="yellow", justify="left")
380+
table.add_column("Function", style="cyan")
381+
command_methods = [
382+
getattr(self, method)
383+
for method in dir(self)
384+
if callable(getattr(self, method)) and method.startswith("do_")
385+
]
386+
command_methods.append(self.default)
387+
command_methods.reverse()
388+
for no, method in enumerate(command_methods):
389+
table.add_row(
390+
str(no + 1),
391+
method.__name__[3:] if not method == self.default else method.__name__,
392+
method.__doc__,
393+
)
394+
Console().print(table)
395+
371396
@busy_bar.run("Settings saved")
372397
def do_settings(self, line):
373398
"""Configre settings"""
399+
self.prettify = click.confirm(
400+
"\nPrettify markdown response", default=self.prettify
401+
)
402+
busy_bar.spin_index = click.prompt(
403+
"Spin bar index [0:/, 1:■█■■■, 2:⣻]",
404+
default=busy_bar.spin_index,
405+
type=click.IntRange(0, 2),
406+
)
407+
self.color = click.prompt("Response stdout font color", default=self.color)
408+
self.code_theme = Prompt.ask(
409+
"Enter code_theme", choices=rich_code_themes, default=self.code_theme
410+
)
411+
self.vertical_overflow = Prompt.ask(
412+
"\nVertical overflow behaviour",
413+
choices=["ellipsis", "visible", "crop"],
414+
default=self.vertical_overflow,
415+
)
374416
self.bot.max_tokens_to_sample = click.prompt(
375-
"Maximum tokens to sample",
417+
"\nMaximum tokens to sample",
376418
type=click.INT,
377419
default=self.bot.max_tokens_to_sample,
378420
)
@@ -392,18 +434,6 @@ def do_settings(self, line):
392434
self.bot.model = click.prompt(
393435
"Model name", type=click.STRING, default=self.bot.model
394436
)
395-
self.code_theme = Prompt.ask(
396-
"Enter code_theme", choices=rich_code_themes, default=self.code_theme
397-
)
398-
self.prettify = click.confirm(
399-
"\nPrettify markdown response", default=self.prettify
400-
)
401-
busy_bar.spin_index = click.prompt(
402-
"Spin bar index [0:/, 1:■█■■■, 2:⣻]",
403-
default=busy_bar.spin_index,
404-
type=click.IntRange(0, 2),
405-
)
406-
self.color = click.prompt("Response stdout font color", default=self.color)
407437

408438
@busy_bar.run(help="System error")
409439
def do_copy_this(self, line):

0 commit comments

Comments
 (0)