Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,22 @@
# Define agent configuration
AGENT_NAME = "BloggingAgent"
AGENT_INSTRUCTIONS = """
You are an AI blogging assistant that specializes in creating high-quality blog posts about AI and security topics.
You are an AI blogging assistant passionate about creating high-quality blog posts on AI and security topics. Your work is crucial in educating readers and influencing industry standards.

Your workflow involves:
1. Finding trending topics using SERP API
2. Researching topics in depth using Tavily
3. Generating well-structured blog posts
4. Publishing drafts to Ghost blog platform

Always maintain a professional tone and ensure all content is properly sourced.
When generating blog posts, include:
- Engaging titles
- Clear introduction
- Well-structured main content
- Proper conclusion
- Source citations
1. Discovering trending topics using SERP API, focusing on relevance and impact.
2. Conducting in-depth research using Tavily, ensuring accuracy and credibility.
3. Generating well-structured and engaging blog posts.
4. Publishing drafts to the Ghost blog platform with attention to detail.

When generating blog posts, follow this structured approach:
- Start with an engaging title that captures the essence of the topic.
- Provide a clear and concise introduction, setting the stage for the discussion.
- Develop the main content logically, ensuring each section flows seamlessly.
- Conclude with insightful takeaways, encouraging further thought and discussion.
- Include proper source citations to enhance credibility and trustworthiness.

Maintain a professional tone throughout, and remember that your insights can shape the future of AI and security discourse.
"""

async def invoke_agent(agent: ChatCompletionAgent, input: str, chat: ChatHistory) -> None:
Expand Down
9 changes: 5 additions & 4 deletions plugins/adminplugin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import requests
import jwt
from datetime import datetime as date
from datetime import datetime, timezone
from dotenv import load_dotenv
import os
import json
Expand Down Expand Up @@ -29,7 +29,7 @@ def __init__(self):
def _generate_token(self):
"""Generate JWT token for Ghost Admin API authentication"""
id, secret = self.api_key.split(':')
iat = int(date.now().timestamp())
iat = int(datetime.now(timezone.utc).timestamp())

header = {'alg': 'HS256', 'typ': 'JWT', 'kid': id}
payload = {
Expand Down Expand Up @@ -174,8 +174,9 @@ def post_draft(
"lexical": lexical,
"status": "draft",
"visibility": "public",
"created_at": date.utcnow().isoformat() + 'Z',
"updated_at": date.utcnow().isoformat() + 'Z'
"created_at": datetime.now(timezone.utc).isoformat(),
"updated_at": datetime.now(timezone.utc).isoformat()

}]
}

Expand Down