From 3a28ecc50d2b50e5120f7274fcbae96f38780558 Mon Sep 17 00:00:00 2001 From: AjaySi Date: Tue, 12 Mar 2024 15:58:42 +0530 Subject: [PATCH] WIP- AI-Writer and Web research, Working on packaging. --- README.md | 89 +++++++++++++------ lib/ai_web_researcher/google_serp_search.py | 2 +- .../google_trends_researcher.py | 2 +- .../metaphor_basic_neural_web_search.py | 2 +- lib/ai_web_researcher/tavily_ai_search.py | 4 +- 5 files changed, 69 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index d37e3353..b83b1c0c 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,81 @@ -# AI Blog Creation and Management Toolkit +--- +# AI Blog Writer and Management Toolkit ## Introduction -This toolkit automates and enhances the process of blog creation, optimization, and management. Leveraging AI technologies, it assists content creators and digital marketers in generating, formatting, and uploading blog content efficiently. The toolkit integrates advanced AI models for text generation, image creation, and data analysis, streamlining the content creation pipeline. - -## Getting Started - -To use this tool, follow one of the Options below: ---- - -### Option 1: Cloud install: (I just want to write blogs..) - -Step 1). Make efforts to fork this present repo into your own account. - -Step 2). Follow this guide:
-https://docs.replit.com/programming-ide/using-git-on-replit/running-github-repositories-replit +This toolkit automates and enhances the process of blog creation, optimization, and management. +Leveraging AI technologies, it assists content creators and digital marketers in generating, formatting, and uploading blog content efficiently. The toolkit integrates advanced AI models for text generation, image creation, and data analysis, streamlining the content creation pipeline. --- -### Option 2: Local laptop Install: (I know what I am doing..) +## Getting Started 🚀 🤞🤞🤞 -Step 1. Clone this repository to your local machine. +To start using this tool, simply follow one of the options below: +--- -Step 2. Install the required dependencies using:
-On your local machine's command prompt, navigate to the folder where you completed Step 1. -Now Run the below command:
-`pip install -r requirements.txt` +### Option 1: Local Laptop Install 💻 (Recommended) -Step 3. Run the script by executing:
-`python alwrity.py`. +**Step 0**️⃣: **Pre-requisites:** Git, Python3 -Step 4. Once the tools is running it will guide/ask for your APIs. It will provide you with links to sign for APIs. +**Installing Python on Windows:** +- Open PowerShell as admin: Press `Windows Key + X`, then select "Windows PowerShell (Admin)". + +- Type `python`. If Python is not installed, Windows will prompt you to 'Get Python'. +- If Python is installed, you should see '>>>>>'. + +**Installing Git on Windows:** +- Open PowerShell or Windows Terminal: Press `Windows Key + X`, then select "Windows Terminal". + +- Paste or type and press enter:⏎.⏎.
+`winget install --id Git.Git -e --source winget` +- Wait for download bars to finish + +*Note for Linux Users:* If you're on Linux and can't install these, get lost 🧙♂️ + + +**Step 1**️⃣: Clone this repository to your local machine. + +``` +To clone the repository to your local machine, perform the following steps: + +1. **Open Windows PowerShell as Administrator:** Press `Windows Key + X` and select "Windows PowerShell (Admin)" from the menu. + +2. **Navigate to the Desired Directory:** Use the `cd` command to move to the directory where you want to clone the repository. + +3. **Clone the Repository:** Run the following command in PowerShell to clone the repository: +`git clone https://github.com/AJaySi/AI-Blog-Writer.git` +This command will download all the files from the repository to your local machine. + +4. **Verify the Clone:** After the cloning process is complete, navigate into the newly created directory using: +`cd AI-Blog-Writer` + +``` +Once you've cloned the repository, you can proceed with the next steps for installation and setup. + + +**Step 2**️⃣: Install required dependencies: +- Open command prompt on your local machine: Press `Windows Key + R`, type `cmd`, then press Enter. +- Navigate to the folder from Step 1 +- Run: `python -m pip install -r requirements.txt` + +**Step 3**️⃣: Run the script: +- Execute: `python alwrity.py` + +**Step 4**️⃣: The tool will guide you through setting up your APIs. --- -### Option 3: Web URL: (Clickty Clickty Website, Free..) +### Option 2: Replit: Cloud Install ☁️☁️☁️ ☁️ ☁️ ....☁️ + +**Step 1**️⃣: Fork this repository to your own GitHub account. + +**Step 2**️⃣: Follow this guide: [Running GitHub Repositories on Replit](https://docs.replit.com/programming-ide/using-git-on-replit/running-github-repositories-replit) 📖 + +--- +### Option 3: Web URL 🌐 *(For easy access)* + +**Step 1**️⃣: Error 404: Page not found. 😅 -Step 1). Error 404: Page not found. --- diff --git a/lib/ai_web_researcher/google_serp_search.py b/lib/ai_web_researcher/google_serp_search.py index fa061f5e..d36d3571 100644 --- a/lib/ai_web_researcher/google_serp_search.py +++ b/lib/ai_web_researcher/google_serp_search.py @@ -304,7 +304,7 @@ def save_in_file(table_content): file_path = os.environ.get('SEARCH_SAVE_FILE') try: # Save the content to the file - with open(file_path, "a") as file: + with open(file_path, "a+") as file: file.write(table_content) file.write("\n" * 3) # Add three newlines at the end logger.info(f"Search content saved to {file_path}") diff --git a/lib/ai_web_researcher/google_trends_researcher.py b/lib/ai_web_researcher/google_trends_researcher.py index d0e4d832..53a14743 100644 --- a/lib/ai_web_researcher/google_trends_researcher.py +++ b/lib/ai_web_researcher/google_trends_researcher.py @@ -482,7 +482,7 @@ def save_in_file(table_content): file_path = os.environ.get('SEARCH_SAVE_FILE') try: # Save the content to the file - with open(file_path, "w") as file: + with open(file_path, "a+") as file: file.write(table_content) file.write("\n" * 3) # Add three newlines at the end logger.info(f"Search content saved to {file_path}") diff --git a/lib/ai_web_researcher/metaphor_basic_neural_web_search.py b/lib/ai_web_researcher/metaphor_basic_neural_web_search.py index 38ad6003..a9baa9aa 100644 --- a/lib/ai_web_researcher/metaphor_basic_neural_web_search.py +++ b/lib/ai_web_researcher/metaphor_basic_neural_web_search.py @@ -205,7 +205,7 @@ def save_in_file(table_content): file_path = os.environ.get('SEARCH_SAVE_FILE') try: # Save the content to the file - with open(file_path, "a") as file: + with open(file_path, "a+") as file: file.write(table_content) file.write("\n" * 3) # Add three newlines at the end logger.info(f"Search content saved to {file_path}") diff --git a/lib/ai_web_researcher/tavily_ai_search.py b/lib/ai_web_researcher/tavily_ai_search.py index b4a86995..d40b676c 100644 --- a/lib/ai_web_researcher/tavily_ai_search.py +++ b/lib/ai_web_researcher/tavily_ai_search.py @@ -73,7 +73,7 @@ def get_tavilyai_results(keywords, include_urls, search_depth="advanced"): client = TavilyClient(api_key=api_key) except Exception as err: logger.error(f"Failed to create Tavily client. Check TAVILY_API_KEY: {err}") - exit(1) + try: if include_urls: tavily_search_result = client.search(keywords, search_depth, include_answer=True, include_domains=include_urls) @@ -147,7 +147,7 @@ def save_in_file(table_content): file_path = os.environ.get('SEARCH_SAVE_FILE') try: # Save the content to the file - with open(file_path, "a") as file: + with open(file_path, "a+") as file: file.write(table_content) file.write("\n" * 3) # Add three newlines at the end logger.info(f"Search content saved to {file_path}")