Update OpenAI.php

This commit is contained in:
2023-10-04 16:45:19 +08:00
parent 97b5a7aedb
commit f219d60ca8

View File

@@ -15,29 +15,29 @@ public static function writeProductArticle($excerpt, $photos, $categories)
$category_str = implode("|", $categories);
$system_prompt = '
You are tasked with writing a comprehensive product introduction & review article using the provided excerpt. Write as if you are reviewing the product by a third party, but no pronouns.The emphasis should be on the performance, features, and notable aspects of the product. The review must not delve into marketplace-related information. Return the output in the following json format:\n\n
{"category": "('. $category_str .')","title": "(Article Title, start with product name, 60-70 characters)","excerpt": "(One sentence summary, 150-160 characters of an article, do not use start sentence with verb.)","cliffhanger": "(One sentence 70-80 characters of article, cliff-hanging sentence to attract readers)","body": "(Markdown format, 700-900 word count)"}\n\n
Mandatory Requirements:\n
- Write in US grade 8-9 English\n
- Use the following sections whenever applicable:\n
-- ### Introduction\n
-- ### Overview\n
-- ### Specifications (use valid Markdown table format with header and seperator) + explanation\n
-- ### Price (write in given local currency)\n
-- ### (Should I Buy? | Conclusion | Final Thoughts | Our Verdict)\n
- do not make up facts, use facts provided by excerpt only\n
- No article titles inside markdown\n
- All article sections use ###
- Pick the closest given category accurately
- Make sure JSON structure is minified and without new line
You are tasked with writing a product introduction & review article using the provided excerpt. Write as if you are reviewing the product by a third party, avoiding pronouns. Emphasize the product\'s performance, features, and notable aspects. Do not mention marketplace-related information. Return the output as a minified JSON in this format:
{"category": "($category_str)","title": "(Start with product name, 60-70 characters)","excerpt": "(150-160 characters, do not start with a verb)","cliffhanger": "(70-80 characters, enticing sentence)","body": "(Markdown, 700-900 words)"}
Mandatory Requirements:
- Language: US grade 8-9 English
- Use these sections when applicable:
-- ### Introduction
-- ### Overview
-- ### Specifications (use valid Markdown table. Two columns: Features and Specifications. Use `| --- | --- |` as a separator.)
-- ### Price (in given currency)
-- ### (Choose one: Should I Buy?, Conclusion, Final Thoughts, Our Verdict)
- Only use facts from the provided excerpt
- Don\'t use titles inside the markdown body
- Use \'###\' for all article sections
- Pick the closest provided category
- Do not use newline in the JSON structure
';
$user_prompt = "EXCERPT\n------------\n{$excerpt}\n";
if (count($photos) > 0) {
$system_prompt .= '- Add at least 3 markdown images with article title as caption in every section except for Introduction';
$user_prompt .= "\n\nPHOTOS\n------------\n";
$system_prompt .= '- Include 3 markdown images with the article title as caption in every section, excluding Introduction.\n';
$user_prompt .= "\n\MARKDOWN IMAGES\n------------\n";
foreach ($photos as $photo) {
$user_prompt .= "{$photo}\n";
}