Frames for describe increased to 32

This commit is contained in:
hbrain 2026-06-21 10:36:35 +02:00
parent 2ef84cf496
commit e1a54259df
3 changed files with 12 additions and 20 deletions

View file

@ -2,6 +2,8 @@
<script>document.querySelectorAll('textarea[data-counter]').forEach(function(t){var c=document.getElementById(t.dataset.counter);function u(){c.textContent=t.value.length+' / '+t.maxLength+' characters';}t.addEventListener('input',u);u();});</script> <script>document.querySelectorAll('textarea[data-counter]').forEach(function(t){var c=document.getElementById(t.dataset.counter);function u(){c.textContent=t.value.length+' / '+t.maxLength+' characters';}t.addEventListener('input',u);u();});</script>
<script> <script>
(function(){ (function(){
const DESCRIBE_MAX_FRAMES = 32;
function attachDescribeButtons(){ function attachDescribeButtons(){
document.querySelectorAll('.admin-video-row').forEach(function(row){ document.querySelectorAll('.admin-video-row').forEach(function(row){
if (row.querySelector('.describe-button')) return; if (row.querySelector('.describe-button')) return;
@ -159,7 +161,7 @@
function runDescribeRequest(job, articleId, additionalPrompt, selectedPersonality){ function runDescribeRequest(job, articleId, additionalPrompt, selectedPersonality){
showDescribeBusy(); showDescribeBusy();
var body = 'id=' + encodeURIComponent(articleId) + '&job=' + encodeURIComponent(job) + '&max_frames=16'; var body = 'id=' + encodeURIComponent(articleId) + '&job=' + encodeURIComponent(job) + '&max_frames=' + encodeURIComponent(DESCRIBE_MAX_FRAMES);
body += '&personality=' + encodeURIComponent(selectedPersonality || 'auto'); body += '&personality=' + encodeURIComponent(selectedPersonality || 'auto');
if (additionalPrompt && additionalPrompt.trim()) { if (additionalPrompt && additionalPrompt.trim()) {
body += '&additional_prompt=' + encodeURIComponent(additionalPrompt); body += '&additional_prompt=' + encodeURIComponent(additionalPrompt);

View file

@ -7,7 +7,7 @@ STATE_FILE="${SCRIPT_DIR}/.personality_index"
IN_DIR="${1:?Usage: $0 <input-dir> [\"Title\"] [\"Location\"] [max_frames] [additional_prompt]}" IN_DIR="${1:?Usage: $0 <input-dir> [\"Title\"] [\"Location\"] [max_frames] [additional_prompt]}"
TITLE="${2:-}" TITLE="${2:-}"
LOCATION="${3:-}" LOCATION="${3:-}"
MAX_FRAMES="${4:-12}" MAX_FRAMES="${4:-16}"
ADDITIONAL_PROMPT="${5:-}" ADDITIONAL_PROMPT="${5:-}"
SELECTED_PERSONALITY="${6:-}" SELECTED_PERSONALITY="${6:-}"
if [ "$ADDITIONAL_PROMPT" = "no-append" ]; then if [ "$ADDITIONAL_PROMPT" = "no-append" ]; then
@ -202,14 +202,6 @@ PROMPT=$(cat <<EOF
Look at these captured frames from a motorcycle trip. Look at these captured frames from a motorcycle trip.
You are writing as the main character of a motorcycle/travel blog. You are writing as the main character of a motorcycle/travel blog.
Style intensity:
Use the selected personality at maximum intensity.
Do not be subtle.
Do not merely sprinkle the style on top.
Every sentence should feel shaped by that personality.
The voice should be provocative, opinionated, funny, and slightly over the top.
Roast the situation, the road, the weather, the narrator, or visible absurdities.
Avoid generic travel-blog language.
Use the following personality style, but never mention the character name: Use the following personality style, but never mention the character name:
"$PERSONALITY" "$PERSONALITY"
@ -221,25 +213,22 @@ ${ADDITIONAL_PROMPT_BLOCK}
Create valid JSON only. Create valid JSON only.
Required fields: Required fields:
- personality: exactly "$PERSONALITY_KEY" - quote_da: Write exactly one sentence in Danish in the style of Anders Matthesen. The sentence should sound like a sharp, self-deprecating observation from a middle-aged motorcycle traveler who often ends up in absurd or unexpected situations.
- quote_da: exactly one natural Danish sentence - personality: exactly "$PERSONALITY_KEY", used for teaser and description generation.
- teaser: English, max 32 words - teaser: English, max 32 words
- description: English, up to 448 words - description: English, up to 448 words
- tags: 5 to 8 lowercase short tags - tags: 5 to 8 lowercase short tags
Content rules: Content rules:
- Do not simply summarize the trip. - Use the selected personality at maximum intensity.
- Try to be positive, unless the personality is inherently negative, in which case embrace that negativity fully. - Do not be subtle.
- The voice MUST BE provocative, opinionated, funny, and slightly over the top.
- Highlight the funniest, strangest, most beautiful, or most ridiculous visible aspect. - Highlight the funniest, strangest, most beautiful, or most ridiculous visible aspect.
- The description must have a beginning, middle, and end.
- Mention the overall experience, mood, road, weather, landscape, and travel feeling if visible.
- Include at least one memorable or amusing observation.
- End with a concluding thought.
- Be challenging, provocative, witty, and playful. - Be challenging, provocative, witty, and playful.
- Roasting is allowed. - Roasting is allowed.
- Profanity is allowed only if it fits the selected personality. - Profanity is allowed only if it fits the selected personality.
- Do not invent specific facts that are not visible or provided. - Do not invent specific facts that are not visible or provided.
- Description or teaser MUST contain at least one of the following words (preferably more): subscribe, contact, journal. It's ok to use the same word mutliple times. Don't use them in teaser, only in description. - Description or teaser MUST contain at least one of the following words (preferably more): subscribe, contact, journal. Don't use them in teaser, only in description.
JSON rules: JSON rules:
- Output JSON only. - Output JSON only.

View file

@ -5,11 +5,12 @@ require __DIR__ . '/../auth.php';
mvlog_require_login(); mvlog_require_login();
$MVLOG_ROOT = dirname(__DIR__); $MVLOG_ROOT = dirname(__DIR__);
const DESCRIBE_DEFAULT_MAX_FRAMES = 32;
header('Content-Type: application/json; charset=utf-8'); header('Content-Type: application/json; charset=utf-8');
$id = strtolower(trim((string)($_POST['id'] ?? ''))); $id = strtolower(trim((string)($_POST['id'] ?? '')));
$job = trim((string)($_POST['job'] ?? '')); $job = trim((string)($_POST['job'] ?? ''));
$max_frames = isset($_POST['max_frames']) ? intval($_POST['max_frames']) : 16; $max_frames = isset($_POST['max_frames']) ? intval($_POST['max_frames']) : DESCRIBE_DEFAULT_MAX_FRAMES;
$additional_prompt = trim((string)($_POST['additional_prompt'] ?? '')); $additional_prompt = trim((string)($_POST['additional_prompt'] ?? ''));
$personality = strtolower(trim((string)($_POST['personality'] ?? 'auto'))); $personality = strtolower(trim((string)($_POST['personality'] ?? 'auto')));
if (!preg_match('/^[a-z0-9_-]+$/', $personality)) $personality = 'auto'; if (!preg_match('/^[a-z0-9_-]+$/', $personality)) $personality = 'auto';