Added option '-W' to print chat history with filenames

This commit is contained in:
2023-08-05 08:09:35 +02:00
parent b57d78a875
commit 32bd17594b
4 changed files with 20 additions and 12 deletions
+6 -4
View File
@@ -55,7 +55,8 @@ def process_and_display_chat(args: argparse.Namespace,
question_parts.append(f"```\n{r.read().strip()}\n```")
full_question = '\n\n'.join(question_parts)
chat = create_chat(full_question, tags, extags, config, args.with_tags)
chat = create_chat(full_question, tags, extags, config,
args.with_tags, args.with_file)
display_chat(chat, dump, args.only_source_code)
return chat, full_question, tags
@@ -85,8 +86,8 @@ def create_parser() -> argparse.ArgumentParser:
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('-p', '--print', help='File to print')
group.add_argument('-q', '--question', nargs='*', help='Question to ask')
group.add_argument('-D', '--chat-dump', help="Print chat as Python structure", action='store_true')
group.add_argument('-d', '--chat', help="Print chat as readable text", action='store_true')
group.add_argument('-D', '--chat-dump', help="Print chat history as Python structure", action='store_true')
group.add_argument('-d', '--chat', help="Print chat history as readable text", action='store_true')
parser.add_argument('-c', '--config', help='Config file name.', default=default_config)
parser.add_argument('-m', '--max-tokens', help='Max tokens to use', type=int)
parser.add_argument('-T', '--temperature', help='Temperature to use', type=float)
@@ -94,7 +95,8 @@ def create_parser() -> argparse.ArgumentParser:
parser.add_argument('-n', '--number', help='Number of answers to produce', type=int, default=1)
parser.add_argument('-s', '--source', nargs='*', help='Source add content of a file to the query')
parser.add_argument('-S', '--only-source-code', help='Print only source code', action='store_true')
parser.add_argument('-w', '--with-tags', help="Print chat with tags.", action='store_true')
parser.add_argument('-w', '--with-tags', help="Print chat history with tags.", action='store_true')
parser.add_argument('-W', '--with-file', help="Print chat history with filename.", action='store_true')
tags_arg = parser.add_argument('-t', '--tags', nargs='*', help='List of tag names', metavar='TAGS')
tags_arg.completer = tags_completer # type: ignore
extags_arg = parser.add_argument('-e', '--extags', nargs='*', help='List of tag names to exclude', metavar='EXTAGS')