From 0535814f4949f7e10d827e6b896aa352e6568963 Mon Sep 17 00:00:00 2001 From: kechykechy Date: Tue, 14 Jan 2025 20:59:28 +0300 Subject: [PATCH] prompt update and timezone errors --- main.py | 28 +++++++++++++++------------- plugins/adminplugin.py | 8 ++++---- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/main.py b/main.py index aea9641..0d6642a 100644 --- a/main.py +++ b/main.py @@ -18,20 +18,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: diff --git a/plugins/adminplugin.py b/plugins/adminplugin.py index 67d2d42..bfd7d4f 100644 --- a/plugins/adminplugin.py +++ b/plugins/adminplugin.py @@ -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 @@ -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 = { @@ -174,8 +174,8 @@ def post_draft( "lexical": lexical, "status": "draft", "visibility": "public", - "created_at": date.timezone.utc().isoformat() + 'Z', - "updated_at": date.timezome.utc().isoformat() + 'Z' + "created_at": datetime.now(timezone.utc).isoformat(), + "updated_at": datetime.now(timezone.utc).isoformat() }] }