From 34e99b636a59e99cf2596e52399d99d5103638e8 Mon Sep 17 00:00:00 2001 From: Leonid Medovyy Date: Sat, 20 May 2023 09:49:26 -0700 Subject: [PATCH 1/3] more readme updates --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 353f8a3..a7d8e5f 100644 --- a/README.md +++ b/README.md @@ -196,4 +196,23 @@ Add the database and redis addons using the following commands: ```bash heroku addons:create heroku-redis:mini heroku addons:create heroku-postgresql:basic +``` + +### Step 7. Enable background worker +Enable the background worker with the following command `heroku ps:scale worker=1` + +### Step 8. Create an account & give it access +Head over to `https://www.yourcustomdomain.com` and create a user account. +Afterwards log into the Heroku console and pull up the account you've just created. + +```bash +heroku run rails c +``` + +Now that you logged into the console, you can give the account access privileges by running the following commands: + +```ruby +user = User.last +user.give_access +user.make_admin ``` \ No newline at end of file From 3c53f0200cb9ad0b9a81bc1365ece1b636527c47 Mon Sep 17 00:00:00 2001 From: Leonid Medovyy Date: Sat, 20 May 2023 11:41:25 -0700 Subject: [PATCH 2/3] readme updates --- README.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a7d8e5f..1bad337 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,35 @@ Our goal is to empower journalists, publishers, and content creators with the mo By harnessing the power of AI and these innovative integrations, Enterprise not only enhances the efficiency of your newsroom but also elevates the quality and impact of your content. Join us on this exciting journey as we redefine the future of journalism together! # Step-by-Step Setup Instructions +### Step 0: Prerequisites + +Ensure that you have the following installed on your machine: +#### System Requirements +- Node 18.15.0 +- Ruby 3.2.2 +- Postgres SQL +- Redis + +You will need to have the following services for Enterprise to function: + +#### Services Needed +- [Feedly](https://feedly.com/i/welcome) – RSS Feeds + AI Intelligence ($12/month for Pro+ Plan) +- [OpenAI](https://beta.openai.com/) – AI Content Generation (We are using gpt-3.5-turbo which costs $0.002 per 1000/tokens) +- [NexLeg](https://nexleg.com/) – Midjourney API ($40/month for API Acccess + $30/month from Midjourney) +- [StoryPro](https://storypro.io/) – The Publishing Platform ($99/month for Basic Plan) +- [Ayrshare](https://www.ayrshare.com/) – Social Media Publishing ($99/month for Premium Plan + +__TOTAL COST:__ $280/month + OpenAI Costs + + + ### Step 1: Fork the repository Start by cloning the repository to your local machine. You can do this by using the `git clone` command followed by the URL of the repository. -Once cloned, navigate into the repository by using the `cd` command, and install the necessary dependencies by running the `bundle install` command. +Once cloned, navigate into the repository by using the `cd` command, and install the necessary dependencies by running the following commands: +```bash +bundle install +yarn install +``` ### Step 2: Create a customization branch Establish a customization branch through the command `git checkout -b customizations`. This particular branch will serve as the base for your modifications to the Enterprise. From c024d39e1b1b868971578e40d1c4fd9a4d09561d Mon Sep 17 00:00:00 2001 From: Leonid Medovyy Date: Sat, 20 May 2023 13:22:36 -0700 Subject: [PATCH 3/3] updated readme and added dynamic thottling --- README.md | 13 ++++++++++++- app/jobs/images/imagine_image_job.rb | 18 +++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1bad337..197550f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,15 @@ -

Enterprise 🛸

+[//]: # (

Enterprise 🛸

) +
+ _______  _       _________ _______  _______  _______  _______ _________ _______  _______ 
+(  ____ \( (    /|\__   __/(  ____ \(  ____ )(  ____ )(  ____ )\__   __/(  ____ \(  ____ \
+| (    \/|  \  ( |   ) (   | (    \/| (    )|| (    )|| (    )|   ) (   | (    \/| (    \/
+| (__    |   \ | |   | |   | (__    | (____)|| (____)|| (____)|   | |   | (_____ | (__    
+|  __)   | (\ \) |   | |   |  __)   |     __)|  _____)|     __)   | |   (_____  )|  __)   
+| (      | | \   |   | |   | (      | (\ (   | (      | (\ (      | |         ) || (      
+| (____/\| )  \  |   | |   | (____/\| ) \ \__| )      | ) \ \_____) (___/\____) || (____/\
+(_______/|/    )_)   )_(   (_______/|/   \__/|/       |/   \__/\_______/\_______)(_______/
+
+

“Logic is the beginning of wisdom, not the end.”

---- diff --git a/app/jobs/images/imagine_image_job.rb b/app/jobs/images/imagine_image_job.rb index d92455c..9721795 100644 --- a/app/jobs/images/imagine_image_job.rb +++ b/app/jobs/images/imagine_image_job.rb @@ -31,12 +31,20 @@ def create_imagination(image, prompt_extra, aspect_ratio, ratio_value) def throttle_requests pending_imaginations = Imagination.where(status: :pending).count - if pending_imaginations > 3 - sleep(300) - elsif pending_imaginations > 2 - sleep(180) + if ENV('DYNAMIC_THROTTLE') + if pending_imaginations > 3 + puts "Sleeping for 300 seconds" + sleep(300) + elsif pending_imaginations > 2 + puts "Sleeping for 180 seconds" + sleep(180) + else + puts "Sleeping for 120 seconds" + sleep(120) + end else - sleep(120) + puts "Sleeping for 60 seconds" + sleep(60) end end end