fixed filepath/filename issues, should upload now
This commit is contained in:
parent
d0c2e969fe
commit
aab023af62
1 changed files with 5 additions and 4 deletions
|
|
@ -244,8 +244,9 @@ class PhixxyCom(commands.Cog):
|
||||||
topic = ''
|
topic = ''
|
||||||
#filename = f"{self.data_dir}ai-blog/index.html"
|
#filename = f"{self.data_dir}ai-blog/index.html"
|
||||||
#filename format year-month-day ie: 2021-01-01.md
|
#filename format year-month-day ie: 2021-01-01.md
|
||||||
filename = f"{self.data_dir}ai-blog/{time.strftime('%Y-%m-%d')}.md"
|
filename = f"{time.strftime('%Y-%m-%d')}.md"
|
||||||
if os.path.exists(filename) and not force:
|
filepath = f"{self.data_dir}ai-blog/{time.strftime('%Y-%m-%d')}.md"
|
||||||
|
if os.path.exists(filepath) and not force:
|
||||||
return
|
return
|
||||||
date = time.strftime("%B %d, %Y")
|
date = time.strftime("%B %d, %Y")
|
||||||
blogpost_file = f"{self.data_dir}blog_topics.txt"
|
blogpost_file = f"{self.data_dir}blog_topics.txt"
|
||||||
|
|
@ -269,9 +270,9 @@ class PhixxyCom(commands.Cog):
|
||||||
content = await self.answer_question(prompt, model="gpt-4-turbo-preview")
|
content = await self.answer_question(prompt, model="gpt-4-turbo-preview")
|
||||||
if title in content[:len(title)]:
|
if title in content[:len(title)]:
|
||||||
content = content.replace(title, '', 1)
|
content = content.replace(title, '', 1)
|
||||||
with open(filename, 'w') as f:
|
with open(filepath, 'w') as f:
|
||||||
f.write(f"# {title}\n\n*{date}*\n\n{content}")
|
f.write(f"# {title}\n\n*{date}*\n\n{content}")
|
||||||
await self.upload_sftp(filename, (os.getenv('ftp_public_html') + 'ai-blog/'), filename)
|
await self.upload_sftp(filepath, (os.getenv('ftp_public_html') + 'ai-blog/'), filename)
|
||||||
run_time = time.time() - start_time
|
run_time = time.time() - start_time
|
||||||
self.logger.debug("It took " + str(run_time) + " seconds to generate the blog post!")
|
self.logger.debug("It took " + str(run_time) + " seconds to generate the blog post!")
|
||||||
output = f"Blog Updated! ({run_time} seconds) {title} https://ai.phixxy.com/ai-blog"
|
output = f"Blog Updated! ({run_time} seconds) {title} https://ai.phixxy.com/ai-blog"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue