|
@@ -1,5 +1,6 @@
|
|
|
import sys
|
|
import sys
|
|
|
import os
|
|
import os
|
|
|
|
|
+from datetime import datetime, timezone
|
|
|
from bs4 import BeautifulSoup, NavigableString
|
|
from bs4 import BeautifulSoup, NavigableString
|
|
|
|
|
|
|
|
|
|
|
|
@@ -130,7 +131,11 @@ def convert_chat_html_to_markdown(html_path: str) -> str:
|
|
|
message = f"**ChatGPT**\n\n{body}"
|
|
message = f"**ChatGPT**\n\n{body}"
|
|
|
messages.append(message)
|
|
messages.append(message)
|
|
|
|
|
|
|
|
- markdown = f"# {title}\n\n" + "\n\n---\n\n".join(messages)
|
|
|
|
|
|
|
+ dd_trace_time = int(int(soup.find("meta", {"name":"dd-trace-time"}).attrs["content"]) / 1000) # UTC time
|
|
|
|
|
+ timestamp = datetime.fromtimestamp(dd_trace_time).strftime("%c")
|
|
|
|
|
+ header = f"*ChatGPT conversation saved {timestamp} converted to Markdown*"
|
|
|
|
|
+
|
|
|
|
|
+ markdown = f"# {title}\n\n{header}\n\n---\n\n" + "\n\n---\n\n".join(messages)
|
|
|
return filename, markdown
|
|
return filename, markdown
|
|
|
|
|
|
|
|
|
|
|