WIP- Try AI-Writer and Web research; working. Working on usuability aspects.

This commit is contained in:
AjaySi
2024-03-06 15:39:02 +05:30
parent 16e68c8959
commit 27f6952dd0
29 changed files with 399 additions and 602 deletions

View File

@@ -27,13 +27,13 @@ def get_blog_categories(blog_article):
The blog content is: '{blog_article}'"
"""
logger.info("Generating blog categories for the given blog.")
if 'google' in gpt_providers:
if 'google' in gpt_providers.lower():
try:
response = gemini_text_response(prompt)
return response
except Exception as err:
logger.error(f"Failed to get response from gemini: {err}")
elif 'openai' in gpt_providers:
elif 'openai' in gpt_providers.lower():
try:
response = openai_chatgpt(prompt)
return response

View File

@@ -27,13 +27,13 @@ def generate_blog_description(blog_content):
Respond with only one of your best effort and do not include your explanations.
Blog Content: '{blog_content}'"""
if 'google' in gpt_providers:
if 'google' in gpt_providers.lower():
try:
response = gemini_text_response(prompt)
return response
except Exception as err:
logger.error("Failed to get response from gemini.")
elif 'openai' in gpt_providers:
elif 'openai' in gpt_providers.lower():
try:
response = openai_chatgpt(prompt)
return response

View File

@@ -42,13 +42,22 @@ def generate_blog_title(blog_article, keywords=None, example_titles=None, num_ti
Blog Keywords: '{keywords}'
Example Titles: '{example_titles}'
"""
if 'google' in gpt_providers:
elif not example_titles:
prompt = prompt = f"""As a SEO expert, I will provide you with my blog article.
Your task is to write {num_titles} blog title.
Follow SEO best practises to suggest the blog title.
Please keep the titles concise, not exceeding 60 words.
Respond with only {num_titles} title and no explanations.
Negative Keywords: Unvieling, unleash, power of. Dont use such words in your title.
Blog Article: '{keywords}'
"""
if 'google' in gpt_providers.lower():
try:
response = gemini_text_response(prompt)
return response
except Exception as err:
logger.error(f"Failed to get response from gemini: {err}")
elif 'openai' in gpt_providers:
elif 'openai' in gpt_providers.lower():
try:
logger.info("Calling OpenAI LLM.")
response = openai_chatgpt(prompt)

View File

@@ -25,13 +25,13 @@ def get_blog_tags(blog_article):
for the given blog content. Only reply with comma separated values.
Blog content: {blog_article}."""
logger.info("Generating Blog tags for the given blog post.")
if 'google' in gpt_providers:
if 'google' in gpt_providers.lower():
try:
response = gemini_text_response(prompt)
return response
except Exception as err:
logger.error("Failed to get response from gemini.")
elif 'openai' in gpt_providers:
elif 'openai' in gpt_providers.lower():
try:
response = openai_chatgpt(prompt)
return response