@stellartech/voice-widget-directus 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +17 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -476,6 +476,9 @@ function splitMarkdownBySeparator(mdText, sep = "## ") {
|
|
|
476
476
|
if (sawHeader) sections.push(buffer.join("\n"));
|
|
477
477
|
return sections.filter((s) => s.trim().length > 0);
|
|
478
478
|
}
|
|
479
|
+
function audioFilesCollection(collection) {
|
|
480
|
+
return collection?.startsWith("NX_") ? "NX_AudioFiles" : "AudioFiles";
|
|
481
|
+
}
|
|
479
482
|
function useVoicingApi(api) {
|
|
480
483
|
async function fetchVoices(collection = "Voices") {
|
|
481
484
|
try {
|
|
@@ -558,8 +561,7 @@ function useVoicingApi(api) {
|
|
|
558
561
|
provider,
|
|
559
562
|
preprocessing: false,
|
|
560
563
|
title: `Voice Sample - ${voiceId}`,
|
|
561
|
-
audio_files_collection:
|
|
562
|
-
// Include lesson context for callback tracking
|
|
564
|
+
audio_files_collection: audioFilesCollection(collection),
|
|
563
565
|
lesson_id: lessonId || null,
|
|
564
566
|
collection,
|
|
565
567
|
voice_config: {
|
|
@@ -595,7 +597,7 @@ function useVoicingApi(api) {
|
|
|
595
597
|
}
|
|
596
598
|
console.log("[Voice Widget] Extracted audioFileId:", audioFileId);
|
|
597
599
|
if (audioFileId) {
|
|
598
|
-
const url = await resolveAudioFileUrl(audioFileId);
|
|
600
|
+
const url = await resolveAudioFileUrl(audioFileId, collection);
|
|
599
601
|
return { url, audioFileId };
|
|
600
602
|
}
|
|
601
603
|
console.log("[Voice Widget] Sample processing async, callback will update Voices.example");
|
|
@@ -645,8 +647,7 @@ function useVoicingApi(api) {
|
|
|
645
647
|
provider: request.provider,
|
|
646
648
|
preprocessing: request.preprocessing,
|
|
647
649
|
title: `Voiceover - ${lessonTitle}`,
|
|
648
|
-
audio_files_collection:
|
|
649
|
-
// Pass these so the flow can include them in callback_data
|
|
650
|
+
audio_files_collection: audioFilesCollection(collection),
|
|
650
651
|
lesson_id: request.lessonId,
|
|
651
652
|
collection,
|
|
652
653
|
voice_config: voiceConfig
|
|
@@ -689,9 +690,10 @@ function useVoicingApi(api) {
|
|
|
689
690
|
function getAudioUrl(fileId) {
|
|
690
691
|
return `/assets/${fileId}`;
|
|
691
692
|
}
|
|
692
|
-
async function resolveAudioFileUrl(audioFilesRecordId) {
|
|
693
|
+
async function resolveAudioFileUrl(audioFilesRecordId, collection) {
|
|
694
|
+
const afCollection = collection ? audioFilesCollection(collection) : "AudioFiles";
|
|
693
695
|
try {
|
|
694
|
-
const response = await api.get(`/items
|
|
696
|
+
const response = await api.get(`/items/${afCollection}/${audioFilesRecordId}`, {
|
|
695
697
|
params: { fields: ["file"] }
|
|
696
698
|
});
|
|
697
699
|
const fileField = response.data.data?.file;
|
|
@@ -1178,7 +1180,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1178
1180
|
for (const v of allVariants.value) {
|
|
1179
1181
|
if (v.audio_file_id) {
|
|
1180
1182
|
const isUuid = v.audio_file_id?.includes("-");
|
|
1181
|
-
v.audioUrl = isUuid ? getAudioUrl(v.audio_file_id) : await resolveAudioFileUrl(v.audio_file_id);
|
|
1183
|
+
v.audioUrl = isUuid ? getAudioUrl(v.audio_file_id) : await resolveAudioFileUrl(v.audio_file_id, props.collection);
|
|
1182
1184
|
}
|
|
1183
1185
|
}
|
|
1184
1186
|
currentVariantIndex.value = 0;
|
|
@@ -1357,7 +1359,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1357
1359
|
allVariants.value = variants;
|
|
1358
1360
|
for (const v of allVariants.value) {
|
|
1359
1361
|
const isUuid = v.audio_file_id?.includes("-");
|
|
1360
|
-
v.audioUrl = isUuid ? getAudioUrl(v.audio_file_id) : await resolveAudioFileUrl(v.audio_file_id);
|
|
1362
|
+
v.audioUrl = isUuid ? getAudioUrl(v.audio_file_id) : await resolveAudioFileUrl(v.audio_file_id, props.collection);
|
|
1361
1363
|
}
|
|
1362
1364
|
currentVariantIndex.value = 0;
|
|
1363
1365
|
hasExistingVoices.value = variants.length > 0;
|
|
@@ -1375,7 +1377,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1375
1377
|
const audioFileId = variant.audio_file_id;
|
|
1376
1378
|
generatedAudioId.value = audioFileId;
|
|
1377
1379
|
const isUuid = audioFileId.includes("-");
|
|
1378
|
-
generatedAudioUrl.value = isUuid ? getAudioUrl(audioFileId) : await resolveAudioFileUrl(audioFileId);
|
|
1380
|
+
generatedAudioUrl.value = isUuid ? getAudioUrl(audioFileId) : await resolveAudioFileUrl(audioFileId, props.collection);
|
|
1379
1381
|
const config = variant.voice_config;
|
|
1380
1382
|
if (config) {
|
|
1381
1383
|
isRestoringFromVariant.value = true;
|
|
@@ -1445,7 +1447,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1445
1447
|
allVariants.value = variants;
|
|
1446
1448
|
for (const v of allVariants.value) {
|
|
1447
1449
|
const isUuid = v.audio_file_id?.includes("-");
|
|
1448
|
-
v.audioUrl = isUuid ? getAudioUrl(v.audio_file_id) : await resolveAudioFileUrl(v.audio_file_id);
|
|
1450
|
+
v.audioUrl = isUuid ? getAudioUrl(v.audio_file_id) : await resolveAudioFileUrl(v.audio_file_id, props.collection);
|
|
1449
1451
|
}
|
|
1450
1452
|
currentVariantIndex.value = 0;
|
|
1451
1453
|
await loadVariantAtIndex(0);
|
|
@@ -1534,7 +1536,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1534
1536
|
for (const v of allVariants.value) {
|
|
1535
1537
|
if (v.audio_file_id) {
|
|
1536
1538
|
const isUuid = v.audio_file_id?.includes("-");
|
|
1537
|
-
v.audioUrl = isUuid ? getAudioUrl(v.audio_file_id) : await resolveAudioFileUrl(v.audio_file_id);
|
|
1539
|
+
v.audioUrl = isUuid ? getAudioUrl(v.audio_file_id) : await resolveAudioFileUrl(v.audio_file_id, props.collection);
|
|
1538
1540
|
}
|
|
1539
1541
|
}
|
|
1540
1542
|
currentVariantIndex.value = 0;
|
|
@@ -1584,7 +1586,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1584
1586
|
generatedAudioUrl.value = getAudioUrl(audioFileId);
|
|
1585
1587
|
} else {
|
|
1586
1588
|
generatedAudioId.value = audioFileId;
|
|
1587
|
-
generatedAudioUrl.value = await resolveAudioFileUrl(audioFileId);
|
|
1589
|
+
generatedAudioUrl.value = await resolveAudioFileUrl(audioFileId, props.collection);
|
|
1588
1590
|
}
|
|
1589
1591
|
}
|
|
1590
1592
|
}
|
|
@@ -2070,10 +2072,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2070
2072
|
}
|
|
2071
2073
|
});
|
|
2072
2074
|
|
|
2073
|
-
var css = "\n.voice-widget[data-v-
|
|
2075
|
+
var css = "\n.voice-widget[data-v-6d27bc73] {\n font-family: var(--theme--fonts--sans--font-family);\n padding: 16px;\n border: 1px solid var(--theme--form--field--input--border-color);\n border-radius: var(--theme--border-radius);\n background: var(--theme--background);\n}\n.widget__header[data-v-6d27bc73] {\n margin-bottom: 20px;\n}\n.widget__header-row[data-v-6d27bc73] {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 16px;\n}\n.widget__header-text[data-v-6d27bc73] {\n flex: 1;\n}\n.widget__title[data-v-6d27bc73] {\n display: flex;\n align-items: center;\n gap: 8px;\n margin: 0 0 4px 0;\n font-size: 18px;\n font-weight: 600;\n color: var(--theme--foreground);\n}\n.widget__collapse-btn[data-v-6d27bc73] {\n background: none;\n border: none;\n padding: 4px;\n cursor: pointer;\n color: var(--theme--foreground-subdued);\n border-radius: 4px;\n}\n.widget__collapse-btn[data-v-6d27bc73]:hover {\n background: var(--theme--background-accent);\n}\n.widget__subtitle[data-v-6d27bc73] {\n margin: 0;\n font-size: 14px;\n color: var(--theme--foreground-subdued);\n}\n.widget__header-controls[data-v-6d27bc73] {\n display: flex;\n gap: 16px;\n align-items: center;\n}\n.widget__url-input[data-v-6d27bc73] {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.widget__url-label[data-v-6d27bc73] {\n font-size: 12px;\n color: var(--theme--foreground-subdued);\n white-space: nowrap;\n}\n.widget__url-field[data-v-6d27bc73] {\n padding: 6px 10px;\n border: 1px solid var(--theme--form--field--input--border-color);\n border-radius: var(--theme--border-radius);\n font-size: 12px;\n width: 280px;\n background: var(--theme--form--field--input--background);\n color: var(--theme--foreground);\n}\n.widget__section[data-v-6d27bc73] {\n margin-bottom: 20px;\n}\n.widget__section-label[data-v-6d27bc73] {\n display: block;\n margin-bottom: 8px;\n font-size: 14px;\n font-weight: 500;\n color: var(--theme--foreground);\n}\n.widget__model-buttons[data-v-6d27bc73] {\n display: flex;\n gap: 8px;\n}\n.widget__model-btn[data-v-6d27bc73] {\n padding: 8px 16px;\n border: 1px solid var(--theme--form--field--input--border-color);\n border-radius: var(--theme--border-radius);\n background: var(--theme--background);\n color: var(--theme--foreground);\n cursor: pointer;\n font-size: 14px;\n transition: all 0.15s ease;\n}\n.widget__model-btn[data-v-6d27bc73]:hover {\n border-color: var(--theme--primary);\n}\n.widget__model-btn--active[data-v-6d27bc73] {\n background: var(--theme--primary);\n border-color: var(--theme--primary);\n color: var(--theme--primary-foreground, #fff);\n}\n.widget__voice-list[data-v-6d27bc73] {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.widget__section--toggle[data-v-6d27bc73] {\n padding: 12px;\n background: var(--theme--background-subdued);\n border-radius: var(--theme--border-radius);\n}\n.widget__toggle[data-v-6d27bc73] {\n display: flex;\n align-items: center;\n gap: 8px;\n cursor: pointer;\n}\n.widget__toggle input[data-v-6d27bc73] {\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n.widget__toggle-label[data-v-6d27bc73] {\n font-size: 14px;\n font-weight: 500;\n color: var(--theme--foreground);\n}\n.widget__toggle-note[data-v-6d27bc73] {\n margin: 4px 0 0 24px;\n font-size: 12px;\n color: var(--theme--foreground-subdued);\n}\n.widget__footer[data-v-6d27bc73] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding-top: 16px;\n border-top: 1px solid var(--theme--border-color-subdued);\n margin-top: 20px;\n}\n.widget__footer-left[data-v-6d27bc73],\n.widget__footer-right[data-v-6d27bc73] {\n display: flex;\n gap: 8px;\n}\n.widget__variant-nav[data-v-6d27bc73] {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 12px;\n margin-bottom: 16px;\n padding: 8px 0;\n}\n.widget__variant-counter[data-v-6d27bc73] {\n font-size: 14px;\n font-weight: 500;\n color: var(--theme--foreground-subdued);\n min-width: 60px;\n text-align: center;\n}\n.widget__btn--icon[data-v-6d27bc73] {\n padding: 6px;\n min-width: 32px;\n min-height: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.widget__result-date[data-v-6d27bc73] {\n margin-top: 8px;\n font-size: 12px;\n color: var(--theme--foreground-subdued);\n}\n.widget__btn[data-v-6d27bc73] {\n padding: 8px 16px;\n border: none;\n border-radius: var(--theme--border-radius);\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n.widget__btn[data-v-6d27bc73]:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n.widget__btn--primary[data-v-6d27bc73] {\n background: var(--theme--primary);\n color: var(--theme--primary-foreground, #fff);\n}\n.widget__btn--primary[data-v-6d27bc73]:hover:not(:disabled) {\n background: var(--theme--primary-accent);\n}\n.widget__btn--secondary[data-v-6d27bc73] {\n background: var(--theme--background-accent);\n color: var(--theme--foreground);\n border: 1px solid var(--theme--form--field--input--border-color);\n}\n.widget__btn--secondary[data-v-6d27bc73]:hover:not(:disabled) {\n background: var(--theme--background-normal);\n}\n\n/* Processing State */\n.widget__processing[data-v-6d27bc73] {\n padding: 40px 20px;\n text-align: center;\n}\n.widget__progress[data-v-6d27bc73] {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 12px;\n margin-bottom: 16px;\n font-size: 16px;\n color: var(--theme--foreground);\n}\n.widget__progress-bar[data-v-6d27bc73] {\n height: 8px;\n background: var(--theme--background-accent);\n border-radius: 4px;\n overflow: hidden;\n max-width: 400px;\n margin: 0 auto;\n}\n.widget__progress-fill[data-v-6d27bc73] {\n height: 100%;\n background: var(--theme--primary);\n transition: width 0.3s ease;\n}\n\n/* Error State */\n.widget__error[data-v-6d27bc73] {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 12px;\n padding: 20px;\n color: var(--theme--danger);\n text-align: center;\n}\n.widget__error-actions[data-v-6d27bc73] {\n display: flex;\n gap: 8px;\n margin-top: 8px;\n}\n.widget__retry[data-v-6d27bc73] {\n padding: 6px 12px;\n background: var(--theme--danger);\n color: #fff;\n border: none;\n border-radius: var(--theme--border-radius);\n cursor: pointer;\n}\n\n/* Loading State */\n.widget__loading[data-v-6d27bc73] {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 12px;\n padding: 40px 20px;\n color: var(--theme--foreground-subdued);\n}\n\n/* Result State */\n.widget__result[data-v-6d27bc73] {\n padding: 20px;\n background: var(--theme--background-subdued);\n border-radius: var(--theme--border-radius);\n margin-bottom: 20px;\n}\n.widget__result-info[data-v-6d27bc73] {\n margin-top: 16px;\n padding-top: 16px;\n border-top: 1px solid var(--theme--border-color-subdued);\n}\n.widget__result-info p[data-v-6d27bc73] {\n margin: 4px 0;\n font-size: 14px;\n color: var(--theme--foreground-subdued);\n}\n.widget__result-info strong[data-v-6d27bc73] {\n color: var(--theme--foreground);\n}\n\n/* Variants List View */\n.widget__variants-list[data-v-6d27bc73] {\n display: flex;\n flex-direction: column;\n gap: 8px;\n max-height: 400px;\n overflow-y: auto;\n margin-bottom: 16px;\n}\n.widget__variant-item[data-v-6d27bc73] {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 12px;\n border: 1px solid var(--theme--border-color-subdued);\n border-radius: var(--theme--border-radius);\n cursor: pointer;\n transition: all 0.15s ease;\n}\n.widget__variant-item[data-v-6d27bc73]:hover {\n border-color: var(--theme--primary);\n}\n.widget__variant-item--selected[data-v-6d27bc73] {\n border-color: var(--theme--primary);\n background: var(--theme--primary-background);\n}\n.widget__variant-radio[data-v-6d27bc73] {\n flex-shrink: 0;\n}\n.widget__variant-radio input[data-v-6d27bc73] {\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n.widget__variant-player[data-v-6d27bc73] {\n flex: 1;\n min-width: 200px;\n}\n.widget__variant-meta[data-v-6d27bc73] {\n display: flex;\n flex-direction: column;\n gap: 2px;\n min-width: 120px;\n}\n.widget__variant-voice[data-v-6d27bc73] {\n font-size: 13px;\n font-weight: 500;\n color: var(--theme--foreground);\n}\n.widget__variant-date[data-v-6d27bc73] {\n font-size: 11px;\n color: var(--theme--foreground-subdued);\n}\n.widget__btn--danger[data-v-6d27bc73] {\n color: var(--theme--danger);\n background: transparent;\n border: none;\n}\n.widget__btn--danger[data-v-6d27bc73]:hover {\n background: var(--theme--danger-background);\n}\n.widget__selected-info[data-v-6d27bc73] {\n padding: 12px;\n background: var(--theme--background-subdued);\n border-radius: var(--theme--border-radius);\n margin-bottom: 16px;\n}\n.widget__selected-info p[data-v-6d27bc73] {\n margin: 4px 0;\n font-size: 14px;\n color: var(--theme--foreground-subdued);\n}\n.widget__selected-info strong[data-v-6d27bc73] {\n color: var(--theme--foreground);\n}\n.widget__progress-status[data-v-6d27bc73] {\n text-align: center;\n font-size: 12px;\n color: var(--theme--foreground-subdued);\n margin-top: 8px;\n}\n\n/* Animations */\n.spinning[data-v-6d27bc73] {\n animation: spin-6d27bc73 1s linear infinite;\n}\n@keyframes spin-6d27bc73 {\nfrom { transform: rotate(0deg);\n}\nto { transform: rotate(360deg);\n}\n}\n";
|
|
2074
2076
|
n(css,{});
|
|
2075
2077
|
|
|
2076
|
-
var InterfaceComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
2078
|
+
var InterfaceComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6d27bc73"], ["__file", "interface.vue"]]);
|
|
2077
2079
|
|
|
2078
2080
|
var index = defineInterface({
|
|
2079
2081
|
id: "voice-widget",
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stellartech/voice-widget-directus",
|
|
3
3
|
"description": "Voice generation widget with model/voice selection and audio preview for Directus",
|
|
4
4
|
"icon": "mic",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.10",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"readme": "README.md",
|
|
8
8
|
"repository": {
|