Spaces:
Sleeping
Auto-enable topic segmentation when an API key is present
Browse filesTopic segmentation is the standout feature for users with an API key
but it sat as an opt-in toggle three groups deep in the form. Most
people never discovered it and walked away from a per-slide guide
thinking that was the tool's default story — when the JamWorks-style
topical breakdown they actually wanted was one checkbox away.
Auto-check the toggle the first time the API key field gains a value.
Pair the flip with a soft maroon banner under the section heading
("Auto-enabled. Claude will group the slides into topical sections…")
so the change is visible and the opt-out path is named. The first
manual toggle (in either direction) sets a userTouched flag on the
checkbox; from then on we never auto-flip again, even if the key is
later removed and re-entered — the user's explicit choice always
wins. Removing the key with no manual touch unchecks again so the
form's submitted state stays consistent with the key state.
- app/templates/index.html +56 -0
|
@@ -349,6 +349,21 @@
|
|
| 349 |
color: var(--color-text-muted);
|
| 350 |
line-height: 1.4;
|
| 351 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 352 |
/* Sub-toggle nested under its parent. Indented + left rail + lighter
|
| 353 |
background so the hierarchy is visually obvious — previously the
|
| 354 |
arrow "↳" prefix in the label was the only clue. */
|
|
@@ -941,6 +956,9 @@
|
|
| 941 |
|
| 942 |
<h4 class="vgm-llm-group-title vgm-llm-group-title--mt">Whole-document features</h4>
|
| 943 |
<p class="vgm-llm-group-intro">Run once for the whole video. Change the document's overall structure.</p>
|
|
|
|
|
|
|
|
|
|
| 944 |
<div class="vgm-llm-grid">
|
| 945 |
<label class="vgm-llm-toggle">
|
| 946 |
<input type="checkbox" name="llm_topic_segmentation" value="true" data-toggle="topic_seg">
|
|
@@ -1302,6 +1320,44 @@
|
|
| 1302 |
if (apiKeyInput) apiKeyInput.addEventListener('input', updatePreviewButtons);
|
| 1303 |
updatePreviewButtons();
|
| 1304 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1305 |
// Submit-button hint reflects what the user has turned on so the
|
| 1306 |
// "~30s per minute" baseline isn't a surprise once LLM toggles
|
| 1307 |
// and audio extraction add multiples on top of it.
|
|
|
|
| 349 |
color: var(--color-text-muted);
|
| 350 |
line-height: 1.4;
|
| 351 |
}
|
| 352 |
+
/* Inline note explaining that a toggle was auto-flipped on by an
|
| 353 |
+
upstream signal (e.g. topic segmentation defaults on once an API
|
| 354 |
+
key is supplied). Visually distinct from regular intros so the
|
| 355 |
+
user notices and can opt back out. */
|
| 356 |
+
.vgm-llm-auto-note {
|
| 357 |
+
margin: 0.2rem 0 var(--space-xs);
|
| 358 |
+
padding: 0.5rem 0.7rem;
|
| 359 |
+
border-radius: var(--radius-sm);
|
| 360 |
+
background: var(--color-primary-soft);
|
| 361 |
+
border: 1px solid var(--color-primary);
|
| 362 |
+
color: var(--color-primary-dark, var(--color-primary));
|
| 363 |
+
font-size: 0.82rem;
|
| 364 |
+
line-height: 1.4;
|
| 365 |
+
}
|
| 366 |
+
.vgm-llm-auto-note strong { font-weight: 700; }
|
| 367 |
/* Sub-toggle nested under its parent. Indented + left rail + lighter
|
| 368 |
background so the hierarchy is visually obvious — previously the
|
| 369 |
arrow "↳" prefix in the label was the only clue. */
|
|
|
|
| 956 |
|
| 957 |
<h4 class="vgm-llm-group-title vgm-llm-group-title--mt">Whole-document features</h4>
|
| 958 |
<p class="vgm-llm-group-intro">Run once for the whole video. Change the document's overall structure.</p>
|
| 959 |
+
<p class="vgm-llm-auto-note" id="topic-auto-note" hidden>
|
| 960 |
+
<strong>✨ Auto-enabled.</strong> With your API key, Claude will group the slides into topical sections (Introduction, Background, Method…). Uncheck below to fall back to one segment per slide.
|
| 961 |
+
</p>
|
| 962 |
<div class="vgm-llm-grid">
|
| 963 |
<label class="vgm-llm-toggle">
|
| 964 |
<input type="checkbox" name="llm_topic_segmentation" value="true" data-toggle="topic_seg">
|
|
|
|
| 1320 |
if (apiKeyInput) apiKeyInput.addEventListener('input', updatePreviewButtons);
|
| 1321 |
updatePreviewButtons();
|
| 1322 |
|
| 1323 |
+
// Topic segmentation is the standout feature when an API key is
|
| 1324 |
+
// available — but it's an opt-in toggle three groups down, so most
|
| 1325 |
+
// users with a key never discover it and end up with the one-
|
| 1326 |
+
// segment-per-slide flow. Auto-check the toggle the first time a
|
| 1327 |
+
// key arrives, mark a flag so a flipped state means "user took
|
| 1328 |
+
// ownership", and never re-flip it after. A small banner under
|
| 1329 |
+
// the AI section explains what's happening so it doesn't feel
|
| 1330 |
+
// surprising. Removing the key auto-unchecks again unless the
|
| 1331 |
+
// user already touched it.
|
| 1332 |
+
const topicCheckbox = form.querySelector('[name="llm_topic_segmentation"]');
|
| 1333 |
+
const topicAutoNote = document.getElementById('topic-auto-note');
|
| 1334 |
+
function maybeAutoEnableTopicSeg() {
|
| 1335 |
+
if (!topicCheckbox) return;
|
| 1336 |
+
// dataset.userTouched is set in the change-listener below the
|
| 1337 |
+
// first time the user clicks the checkbox themselves.
|
| 1338 |
+
if (topicCheckbox.dataset.userTouched === '1') return;
|
| 1339 |
+
const hasKey = !!(apiKeyInput && apiKeyInput.value.trim());
|
| 1340 |
+
const wasChecked = topicCheckbox.checked;
|
| 1341 |
+
topicCheckbox.checked = hasKey;
|
| 1342 |
+
if (wasChecked !== hasKey) {
|
| 1343 |
+
// Fire change so the existing data-toggle visibility code
|
| 1344 |
+
// (which shows/hides the "Also send slide images" sub-toggle)
|
| 1345 |
+
// updates with the auto-flip.
|
| 1346 |
+
topicCheckbox.dispatchEvent(new Event('change', { bubbles: true }));
|
| 1347 |
+
}
|
| 1348 |
+
if (topicAutoNote) {
|
| 1349 |
+
topicAutoNote.hidden = !hasKey;
|
| 1350 |
+
}
|
| 1351 |
+
}
|
| 1352 |
+
if (topicCheckbox) {
|
| 1353 |
+
topicCheckbox.addEventListener('change', () => {
|
| 1354 |
+
topicCheckbox.dataset.userTouched = '1';
|
| 1355 |
+
if (topicAutoNote) topicAutoNote.hidden = true;
|
| 1356 |
+
});
|
| 1357 |
+
}
|
| 1358 |
+
if (apiKeyInput) apiKeyInput.addEventListener('input', maybeAutoEnableTopicSeg);
|
| 1359 |
+
maybeAutoEnableTopicSeg();
|
| 1360 |
+
|
| 1361 |
// Submit-button hint reflects what the user has turned on so the
|
| 1362 |
// "~30s per minute" baseline isn't a surprise once LLM toggles
|
| 1363 |
// and audio extraction add multiples on top of it.
|