Parcourir la source

Update default AI prompt and image suggestions

master
nano il y a 4 jours
Parent
révision
0acd180055
1 fichiers modifiés avec 47 ajouts et 4 suppressions
  1. +47
    -4
      core/helpers.asp

+ 47
- 4
core/helpers.asp Voir le fichier

@@ -107,12 +107,38 @@ Public Function GetGenerationPromptTemplate()
prompt = Trim(CStr(GetAppSetting("AbacusGenerationPrompt")))

If Len(prompt) = 0 Or LCase(prompt) = "nothing" Then
prompt = "You write clear, engaging blog post content for a classic ASP blog. Return only valid JSON with two keys: summary and body. Summary must be 1 to 2 sentences. Body must be 3 to 5 short paragraphs separated by blank lines. Do not use markdown fences, bullets, or code blocks." & vbCrLf & vbCrLf & _
prompt = "You are a panel of 150 expert writers, researchers, editors, and subject-matter specialists on the topic: {TITLE}." & vbCrLf & vbCrLf & _
"Your task is to write a long, interesting, useful blog post for a general audience and suggest public domain or CC0 image ideas that would fit the article." & vbCrLf & vbCrLf & _
"Return only valid JSON with exactly three keys:" & vbCrLf & vbCrLf & _
"{""summary"":"""",""body"":"""",""images"":[]}" & vbCrLf & vbCrLf & _
"Rules:" & vbCrLf & _
"- Return only valid JSON." & vbCrLf & _
"- Do not use markdown fences." & vbCrLf & _
"- Do not use bullet points." & vbCrLf & _
"- Do not use numbered lists." & vbCrLf & _
"- Do not include anything outside the JSON object." & vbCrLf & _
"- Keep the title unchanged." & vbCrLf & _
"- The summary must be 1 to 2 clear, engaging sentences." & vbCrLf & _
"- The body must be 900 to 1,400 words." & vbCrLf & _
"- The body should be 8 to 12 short-to-medium paragraphs." & vbCrLf & _
"- Separate paragraphs with blank lines." & vbCrLf & _
"- Make the writing clear, helpful, and interesting." & vbCrLf & _
"- Use a warm, human, conversational tone." & vbCrLf & _
"- Avoid sounding like AI-generated content." & vbCrLf & _
"- Do not exaggerate or make unsupported claims." & vbCrLf & vbCrLf & _
"Image rules:" & vbCrLf & _
"- Include 3 to 5 image suggestions in the images array." & vbCrLf & _
"- Suggest only images that are likely to be available as public domain, CC0, or freely reusable images." & vbCrLf & _
"- Prefer image sources such as Wikimedia Commons, Library of Congress, NASA, National Archives, public domain museum collections, or official government archives." & vbCrLf & _
"- Do not invent exact image URLs unless they are already provided in the existing content." & vbCrLf & _
"- Do not use copyrighted stock photo sites." & vbCrLf & _
"- Do not suggest Unsplash as public domain." & vbCrLf & _
"- Each image object must include placement, search_query, suggested_source, caption, alt_text, and license_requirement." & vbCrLf & _
"- The license_requirement must say: Verify that the image is public domain or CC0 before publishing." & vbCrLf & vbCrLf & _
"Use the existing content as source material, but improve it significantly." & vbCrLf & vbCrLf & _
"Create blog content for this post title: {TITLE}" & vbCrLf & _
"Existing summary: {SUMMARY}" & vbCrLf & _
"Existing body: {BODY}" & vbCrLf & _
"Keep the title unchanged. Make the content readable and helpful for a general audience." & vbCrLf & _
"Also include an image_prompt field in the generated JSON output that describes a magazine-style feature image."
"Existing body: {BODY}"
End If

GetGenerationPromptTemplate = prompt
@@ -1012,6 +1038,23 @@ Function GetOrCreateAiImageUrl(ByVal prompt)
GetOrCreateAiImageUrl = remoteUrl
End Function

Function GetPostFeatureImageUrl(ByVal title, ByVal summary, ByVal body)
Dim existing, promptText
existing = ExtractFirstImageSrc(body)
If Len(Trim(CStr(existing))) > 0 Then
GetPostFeatureImageUrl = existing
Exit Function
End If

promptText = "A polished editorial feature image for a blog post titled '" & Trim(CStr(title)) & "'"
If Len(Trim(CStr(summary))) > 0 Then
promptText = promptText & ". " & Trim(CStr(summary))
End If
promptText = promptText & " Use a magazine-style composition with a clean, modern, photorealistic look."

GetPostFeatureImageUrl = GetOrCreateAiImageUrl(promptText)
End Function

Function Active(controllerName)
On Error Resume Next
If Replace(Lcase(router.Resolve(Request.ServerVariables("REQUEST_METHOD"), TrimQueryParams(Request.ServerVariables("HTTP_X_ORIGINAL_URL")))(0)),"controller","") = LCase(controllerName) Then


Chargement…
Annuler
Enregistrer

Powered by TurnKey Linux.