2024-10-25 23:12:30 +00:00
|
|
|
import argparse
|
2024-10-25 23:30:51 +00:00
|
|
|
import logging
|
2024-10-25 22:34:53 +00:00
|
|
|
from pathlib import Path
|
|
|
|
|
2024-10-26 11:47:39 +00:00
|
|
|
from . import format_messages, merge_adjacent_messages, parse_messages_in_chat_folder
|
|
|
|
|
2024-10-25 22:34:53 +00:00
|
|
|
|
2024-10-25 23:12:30 +00:00
|
|
|
def parse_args():
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument('path', type=Path)
|
|
|
|
return parser.parse_args()
|
2024-10-25 22:34:53 +00:00
|
|
|
|
2024-10-26 11:47:39 +00:00
|
|
|
|
2024-10-25 22:34:53 +00:00
|
|
|
def main():
|
2024-10-25 23:30:51 +00:00
|
|
|
logging.basicConfig()
|
|
|
|
logging.getLogger().setLevel('INFO')
|
2024-10-25 23:12:30 +00:00
|
|
|
args = parse_args()
|
2024-10-25 22:34:53 +00:00
|
|
|
|
2024-10-25 23:12:30 +00:00
|
|
|
messages = parse_messages_in_chat_folder(args.path)
|
|
|
|
messages = merge_adjacent_messages(messages)
|
|
|
|
print(format_messages(messages))
|
2024-10-25 22:34:53 +00:00
|
|
|
|
2024-10-26 11:47:39 +00:00
|
|
|
|
2024-10-25 22:34:53 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|