This commit is contained in:
Paul Gauthier 2023-07-22 09:50:41 -03:00
parent 6e03d2f214
commit c8e8967d45
2 changed files with 13 additions and 7 deletions

View file

@ -1,33 +1,34 @@
import argparse import argparse
import json import json
import markdown import markdown
import tiktoken import tiktoken
from prompt_toolkit.completion import Completion
from aider import prompts from aider import models, prompts
from aider.dump import dump # noqa: F401
from aider.sendchat import simple_send_with_retries
from .dump import dump # noqa: F401
def main(): def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("filename", help="Markdown file to parse") parser.add_argument("filename", help="Markdown file to parse")
args = parser.parse_args() args = parser.parse_args()
with open(args.filename, 'r') as f: with open(args.filename, "r") as f:
text = f.read() text = f.read()
md = markdown.Markdown() md = markdown.Markdown()
tree = md.parse(text) tree = md.parse(text)
for element in tree.getiterator(): for element in tree.getiterator():
if element.tag in ['h1', 'h4'] and element.text is not None: if element.tag in ["h1", "h4"] and element.text is not None:
print(element.text) print(element.text)
elif element.tag == 'blockquote': elif element.tag == "blockquote":
continue continue
else: else:
print(element.text) print(element.text)
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View file

@ -24,3 +24,8 @@ And got this output:
{output} {output}
""" """
# CHAT HISTORY
summarize = """
Summarize the conversation.
"""