Compare commits
3 Commits
75823e7db8
..
pipes
| Author | SHA1 | Date | |
|---|---|---|---|
| dca1bc621f | |||
| 5f29f60168 | |||
| 3ea1f49027 |
@@ -106,6 +106,7 @@ celerybeat.pid
|
|||||||
.venv
|
.venv
|
||||||
env/
|
env/
|
||||||
venv/
|
venv/
|
||||||
|
.old/
|
||||||
ENV/
|
ENV/
|
||||||
env.bak/
|
env.bak/
|
||||||
venv.bak/
|
venv.bak/
|
||||||
|
|||||||
@@ -257,14 +257,14 @@ class Chat:
|
|||||||
def print(self, source_code_only: bool = False,
|
def print(self, source_code_only: bool = False,
|
||||||
with_metadata: bool = False,
|
with_metadata: bool = False,
|
||||||
paged: bool = True,
|
paged: bool = True,
|
||||||
dense: bool = False) -> None:
|
tight: bool = False) -> None:
|
||||||
output: list[str] = []
|
output: list[str] = []
|
||||||
for message in self.messages:
|
for message in self.messages:
|
||||||
if source_code_only:
|
if source_code_only:
|
||||||
output.append(message.to_str(source_code_only=True))
|
output.append(message.to_str(source_code_only=True))
|
||||||
continue
|
continue
|
||||||
output.append(message.to_str(with_metadata))
|
output.append(message.to_str(with_metadata))
|
||||||
if not dense:
|
if not tight:
|
||||||
output.append('\n' + ('-' * terminal_width()) + '\n')
|
output.append('\n' + ('-' * terminal_width()) + '\n')
|
||||||
if paged:
|
if paged:
|
||||||
print_paged('\n'.join(output))
|
print_paged('\n'.join(output))
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ def print_chat(args: argparse.Namespace, config: Config) -> None:
|
|||||||
chat.print(args.source_code_only,
|
chat.print(args.source_code_only,
|
||||||
args.with_metadata,
|
args.with_metadata,
|
||||||
paged=not args.no_paging,
|
paged=not args.no_paging,
|
||||||
dense=args.dense)
|
tight=args.tight)
|
||||||
|
|
||||||
|
|
||||||
def hist_cmd(args: argparse.Namespace, config: Config) -> None:
|
def hist_cmd(args: argparse.Namespace, config: Config) -> None:
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ def create_parser() -> argparse.ArgumentParser:
|
|||||||
action='store_true')
|
action='store_true')
|
||||||
hist_cmd_parser.add_argument('-A', '--answer', help='Print only answers with given substring', metavar='SUBSTRING')
|
hist_cmd_parser.add_argument('-A', '--answer', help='Print only answers with given substring', metavar='SUBSTRING')
|
||||||
hist_cmd_parser.add_argument('-Q', '--question', help='Print only questions with given substring', metavar='SUBSTRING')
|
hist_cmd_parser.add_argument('-Q', '--question', help='Print only questions with given substring', metavar='SUBSTRING')
|
||||||
hist_cmd_parser.add_argument('-d', '--dense', help='Print without message separators', action='store_true')
|
hist_cmd_parser.add_argument('-d', '--tight', help='Print without message separators', action='store_true')
|
||||||
hist_cmd_parser.add_argument('-P', '--no-paging', help='Print without paging', action='store_true')
|
hist_cmd_parser.add_argument('-P', '--no-paging', help='Print without paging', action='store_true')
|
||||||
|
|
||||||
# 'tags' command parser
|
# 'tags' command parser
|
||||||
|
|||||||
@@ -2,3 +2,4 @@ openai
|
|||||||
PyYAML
|
PyYAML
|
||||||
argcomplete
|
argcomplete
|
||||||
pytest
|
pytest
|
||||||
|
Jinja2
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ from setuptools import setup, find_packages
|
|||||||
|
|
||||||
with open("README.md", "r", encoding="utf-8") as fh:
|
with open("README.md", "r", encoding="utf-8") as fh:
|
||||||
long_description = fh.read()
|
long_description = fh.read()
|
||||||
|
with open("requirements.txt", "r") as fh:
|
||||||
|
install_requirements = [line.strip() for line in fh]
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="ChatMastermind",
|
name="ChatMastermind",
|
||||||
@@ -28,12 +30,7 @@ setup(
|
|||||||
"Topic :: Utilities",
|
"Topic :: Utilities",
|
||||||
"Topic :: Text Processing",
|
"Topic :: Text Processing",
|
||||||
],
|
],
|
||||||
install_requires=[
|
install_requires=install_requirements,
|
||||||
"openai",
|
|
||||||
"PyYAML",
|
|
||||||
"argcomplete",
|
|
||||||
"pytest",
|
|
||||||
],
|
|
||||||
python_requires=">=3.9",
|
python_requires=">=3.9",
|
||||||
test_suite="tests",
|
test_suite="tests",
|
||||||
entry_points={
|
entry_points={
|
||||||
|
|||||||
+2
-2
@@ -147,7 +147,7 @@ class TestChat(TestChatBase):
|
|||||||
@patch('sys.stdout', new_callable=StringIO)
|
@patch('sys.stdout', new_callable=StringIO)
|
||||||
def test_print(self, mock_stdout: StringIO) -> None:
|
def test_print(self, mock_stdout: StringIO) -> None:
|
||||||
self.chat.msg_add([self.message1, self.message2])
|
self.chat.msg_add([self.message1, self.message2])
|
||||||
self.chat.print(paged=False, dense=True)
|
self.chat.print(paged=False, tight=True)
|
||||||
expected_output = f"""{Question.txt_header}
|
expected_output = f"""{Question.txt_header}
|
||||||
Question 1
|
Question 1
|
||||||
{Answer.txt_header}
|
{Answer.txt_header}
|
||||||
@@ -162,7 +162,7 @@ Answer 2
|
|||||||
@patch('sys.stdout', new_callable=StringIO)
|
@patch('sys.stdout', new_callable=StringIO)
|
||||||
def test_print_with_metadata(self, mock_stdout: StringIO) -> None:
|
def test_print_with_metadata(self, mock_stdout: StringIO) -> None:
|
||||||
self.chat.msg_add([self.message1, self.message2])
|
self.chat.msg_add([self.message1, self.message2])
|
||||||
self.chat.print(paged=False, with_metadata=True, dense=True)
|
self.chat.print(paged=False, with_metadata=True, tight=True)
|
||||||
expected_output = f"""{TagLine.prefix} atag1 btag2
|
expected_output = f"""{TagLine.prefix} atag1 btag2
|
||||||
FILE: 0001{msg_suffix}
|
FILE: 0001{msg_suffix}
|
||||||
AI: FakeAI
|
AI: FakeAI
|
||||||
|
|||||||
Reference in New Issue
Block a user