
-- Add new columns for author prompts
ALTER TABLE `was_openai_author`
ADD COLUMN `openai_article_type_id` int(11) unsigned NOT NULL AFTER `openai_author_id`,
ADD COLUMN `author_model` varchar(32) NOT NULL AFTER `author_membership_level`,
ADD COLUMN `author_prompt_seo` text NOT NULL AFTER `author_prompt`,
ADD COLUMN `author_prompt_first` text NOT NULL AFTER `author_prompt_seo`,
ADD COLUMN `author_prompt_next` text NOT NULL AFTER `author_prompt_first`,
ADD COLUMN `author_prompt_last` text NOT NULL AFTER `author_prompt_next`,
ADD KEY `idx_openai_article_type_id` (`openai_article_type_id`);


-- Existing authors have been using gpt-4-1106-preview, so we update all current at this model
UPDATE was_openai_author
SET author_model = 'gpt-4-1106-preview';


-- Import the config article prompts into the authors table
UPDATE was_openai_author
SET author_prompt_seo = 'As a professional writing chatbot, your priority is crafting high-quality, reliable content that puts people first. Your focus is on delivering unique, deeply analyzed, and expert content that offers superior value. Excellence in both presentation and production is key. 

Instead of centering on search engine optimization, concentrate on generating informative content that benefits your readers. Ensure that your content answers the "Who, How, and Why" providing transparency, context, and utility to your audience.

Incorporating these guidelines will align your content with the principles of Experience, Expertise, Authoritativeness, and Trust (E-E-A-T), key considerations in PQ ratings. Trust is the core member of the E-E-A-T family. 

You are up-to-date and compliant with the guidelines published at https://developers.google.com/search/docs/fundamentals/creating-helpful-content, adhering to the revised E-E-A-T approach.',
author_prompt_first = 'Write article section 1. Content should flow nicely into section 2.',
author_prompt_next = 'With section {{previous}} from the article outline already written, write article section {{current}}. Content should flow nicely into section {{next}}.',
author_prompt_last = 'With section {{previous}} from the article outline already written, write article conclusion section {{last}}.';


-- Set the existing author records as 'blog' type
UPDATE was_openai_author a, was_openai_article_type t
SET a.openai_article_type_id = t.openai_article_type_id
WHERE t.type_slug = 'blog';


-- Copy the existing authors for the 'aboutme' type
INSERT INTO `was_openai_author` (`openai_article_type_id`, `author_order`, `author_name`, `author_description`,`author_thumbnail`,`author_prompt`, `author_membership_level`, `author_prompt_seo`, `author_prompt_first`, `author_prompt_next`, `author_prompt_last`, `author_model`)
SELECT t.openai_article_type_id, author_order, author_name, author_description,author_thumbnail,author_prompt, author_membership_level, author_prompt_seo, author_prompt_first, author_prompt_next, author_prompt_last, author_model
FROM was_openai_author a, was_openai_article_type t
WHERE t.type_slug = 'aboutme';
