@vibedev-si/dsh-vibedev 0.11.3 → 0.11.4
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/README.md +16 -0
- package/THIRD-PARTY-NOTICES.txt +1 -1
- package/client/client.account-center.js +496 -184
- package/client/client.js +36 -2
- package/lib/audio/voice-profiles.d.ts +23 -0
- package/lib/index.js +65 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
本插件由 `dsh-media` 改名而来,见下面的「从 dsh-media 升级」。
|
|
12
12
|
|
|
13
|
+
## 0.11.4 用户可见更新
|
|
14
|
+
|
|
15
|
+
**较长的音色样本不再被误判失败,「我的音色」页面重新排版。**
|
|
16
|
+
|
|
17
|
+
- **创建最长可能需要 2–3 分钟,超时后会继续确认**:创建音色的请求单独给了 3 分钟超时(其它请求不变)。如果网关仍没有及时回复(超时、504 或网络中断),插件不会直接报失败,而是继续读音色列表最多 3 分钟,找创建前没有的新音色;找到就当作创建成功。3 分钟内仍没出现,提示「网关处理超时。可能已在网关侧创建,请稍后刷新列表确认;若列表没有,再重试。」(错误码 `VOICE_PROFILE_UNCONFIRMED`,可重试、未扣费)。真正的参数错误(4xx)照旧立即报出。
|
|
18
|
+
- **重试不重复创建**:创建请求的 `Idempotency-Key` 改由样本内容和名称算出(同一份样本 + 同一名称始终相同,换名称就不同)。是否真的去重取决于网关;网关不去重时,靠上面的列表确认兜底。
|
|
19
|
+
- **「我的音色」页面**:页面收窄到和「兑换」页一致的宽度;文件选择改成虚线拖拽区(点击或拖入),选中后显示文件名、时长、大小和「重新选择」;「创建音色」是主色按钮,不能点时在下方说明原因;列表改成标准行(图标、名称、状态胶囊、「时长 · 创建时间」、删除);空列表、读取中、读取失败、网关未开放都有完整的占位。创建等待超过 15 秒会切到「网关处理中」并显示已等待秒数;超时转入「可能已创建,正在确认」,不再直接显示红色报错。
|
|
20
|
+
|
|
13
21
|
## 0.11.3 用户可见更新
|
|
14
22
|
|
|
15
23
|
**音色管理与 Suno 翻唱**:可以用自己的人声建「音色」,再用它做音色翻唱;也可以上传一首歌做翻唱。
|
|
@@ -487,6 +495,14 @@ npm run build
|
|
|
487
495
|
|
|
488
496
|
## English
|
|
489
497
|
|
|
498
|
+
### What changes in 0.11.4
|
|
499
|
+
|
|
500
|
+
**Longer voice samples are no longer reported as failed, and 「我的音色」 (My voices) has a new layout.**
|
|
501
|
+
|
|
502
|
+
- **Creation can take up to 2–3 minutes, and a timeout is followed by a check**: the voice-profile creation request has its own 3-minute timeout (other requests are unchanged). When the gateway still does not answer in time (a timeout, a 504 or a lost connection), the plugin does not report a failure: it reads the voice list for up to 3 more minutes for a profile that was not there before and, when one appears, returns it as created. When none appears it reports "The gateway timed out. The voice may have been created there: refresh the list in a little while to check, and try again only if it is not there." (`VOICE_PROFILE_UNCONFIRMED`, retryable, nothing charged). Real input errors (4xx) still fail at once.
|
|
503
|
+
- **Retrying does not create twice**: the creation's `Idempotency-Key` is now derived from the sample and the name (the same sample under the same name always sends the same key; another name sends another). Whether it deduplicates is up to the gateway; when it does not, the list check above is the fallback.
|
|
504
|
+
- **「我的音色」 page**: narrowed to the width of the Redeem page; the file picker is a dashed drop area (click or drop), showing the file name, length, size and "Choose another" once chosen; "Create voice" is the primary button and says why it is disabled; the list is made of standard rows (icon, name, status pill, "length · created", delete); the empty, loading, failed and unsupported states all have proper placeholders. After 15 s a creation shows "processing" with the seconds waited; a timeout turns into "may already exist, checking" instead of a red error.
|
|
505
|
+
|
|
490
506
|
### What changes in 0.11.3
|
|
491
507
|
|
|
492
508
|
**Voice profiles and Suno covers**: make a voice profile from your own singing voice and use it for voice covers, or cover an uploaded song.
|
package/THIRD-PARTY-NOTICES.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
THIRD-PARTY NOTICES · @vibedev-si/dsh-vibedev 0.11.
|
|
1
|
+
THIRD-PARTY NOTICES · @vibedev-si/dsh-vibedev 0.11.4
|
|
2
2
|
|
|
3
3
|
This package bundles code from the projects below. Each is used under the licence that
|
|
4
4
|
follows its name; the licence texts are reproduced as the projects ship them.
|
|
@@ -1597,7 +1597,24 @@ window.__ModuleLoader__.load({
|
|
|
1597
1597
|
voiceErrorCode: "错误码 {code}",
|
|
1598
1598
|
voiceRejectSimilar: "这段样本和已有录音太像,请换一段干净、独特的人声。",
|
|
1599
1599
|
voiceRejectNotClean: "这不是干净的人声:请换一段只有一个人声、不带伴奏和杂音的录音。",
|
|
1600
|
-
voiceRejectOriginal: "原始原因:{reason}"
|
|
1600
|
+
voiceRejectOriginal: "原始原因:{reason}",
|
|
1601
|
+
voiceDropTitle: "点击或拖入音频文件",
|
|
1602
|
+
voiceFileAdvice: "建议 10–60 秒、只有一个人声的干净录音,不带伴奏和杂音。",
|
|
1603
|
+
voiceDropActive: "松开即可添加",
|
|
1604
|
+
voiceDropFormats: "mp3 · wav · m4a · aac · flac · ogg,6–60 秒,不超过 10 MB",
|
|
1605
|
+
voiceChangeFile: "重新选择",
|
|
1606
|
+
voiceMeasuring: "正在测量时长…",
|
|
1607
|
+
voicePickFile: "选择音频文件",
|
|
1608
|
+
voiceNameHint: "最多 {max} 个字,只用来在列表里区分音色。",
|
|
1609
|
+
voiceNeedFile: "请先选择一个音频文件",
|
|
1610
|
+
voiceNeedName: "请填写音色名称",
|
|
1611
|
+
voiceListCount: "共 {count} 个",
|
|
1612
|
+
voiceLoadFailed: "音色列表没有读到",
|
|
1613
|
+
voiceUnsupportedTitle: "暂未开放音色管理",
|
|
1614
|
+
voiceRetry: "重试",
|
|
1615
|
+
voiceWaitingGateway: "网关处理中,已等待 {seconds} 秒。较长的样本可能需要 1–3 分钟,请不要关闭页面。",
|
|
1616
|
+
voiceConfirming: "网关没有及时回复,音色可能已经创建,正在确认(已等待 {seconds} 秒)…",
|
|
1617
|
+
voiceUnconfirmed: "网关处理超时。可能已在网关侧创建,请稍后刷新列表确认;若列表没有,再重试。"
|
|
1601
1618
|
};
|
|
1602
1619
|
const voiceProfileEn = {
|
|
1603
1620
|
centerVoiceProfiles: "My voices",
|
|
@@ -1663,7 +1680,24 @@ window.__ModuleLoader__.load({
|
|
|
1663
1680
|
voiceErrorCode: "Error code {code}",
|
|
1664
1681
|
voiceRejectSimilar: "This sample is too similar to an existing recording. Use a different clean, original vocal.",
|
|
1665
1682
|
voiceRejectNotClean: "This is not a clean solo vocal. Use a recording of one voice without accompaniment or background noise.",
|
|
1666
|
-
voiceRejectOriginal: "Original reason: {reason}"
|
|
1683
|
+
voiceRejectOriginal: "Original reason: {reason}",
|
|
1684
|
+
voiceDropTitle: "Click or drop an audio file here",
|
|
1685
|
+
voiceFileAdvice: "A clean recording of one voice, 10–60 s, without accompaniment or background noise, works best.",
|
|
1686
|
+
voiceDropActive: "Release to add it",
|
|
1687
|
+
voiceDropFormats: "mp3 · wav · m4a · aac · flac · ogg, 6–60 s, up to 10 MB",
|
|
1688
|
+
voiceChangeFile: "Choose another",
|
|
1689
|
+
voiceMeasuring: "Measuring length…",
|
|
1690
|
+
voicePickFile: "Choose an audio file",
|
|
1691
|
+
voiceNameHint: "Up to {max} characters, only to tell your voices apart.",
|
|
1692
|
+
voiceNeedFile: "Choose an audio file first",
|
|
1693
|
+
voiceNeedName: "Enter a name for the voice",
|
|
1694
|
+
voiceListCount: "{count} in total",
|
|
1695
|
+
voiceLoadFailed: "The voice list could not be read",
|
|
1696
|
+
voiceUnsupportedTitle: "Voice profiles are not available yet",
|
|
1697
|
+
voiceRetry: "Try again",
|
|
1698
|
+
voiceWaitingGateway: "The gateway is processing, {seconds} s so far. A longer sample can take 1–3 minutes; keep this page open.",
|
|
1699
|
+
voiceConfirming: "The gateway did not answer in time. The voice may already exist; checking ({seconds} s so far)…",
|
|
1700
|
+
voiceUnconfirmed: "The gateway timed out. The voice may have been created there: refresh the list in a little while to check, and try again only if it is not there."
|
|
1667
1701
|
};
|
|
1668
1702
|
//#endregion
|
|
1669
1703
|
//#region src/client/AccountCenter/center-locales.ts
|
|
@@ -2963,22 +2997,39 @@ window.__ModuleLoader__.load({
|
|
|
2963
2997
|
`;
|
|
2964
2998
|
//#endregion
|
|
2965
2999
|
//#region src/client/AccountCenter/voice-profile-styles.ts
|
|
2966
|
-
/**
|
|
3000
|
+
/**
|
|
3001
|
+
* 「我的音色」 styles, scoped under `.center-voices`. The page sits inside `.member-polish` (the 兑换 page's shell), so
|
|
3002
|
+
* it takes that shell's width, section padding and `--member-*` tokens (surface, inset, border, muted, accent) and its
|
|
3003
|
+
* dashed empty state (`.member-polish-empty`); every other color is a DSH theme token with the same fallbacks the
|
|
3004
|
+
* other account-center pages use, so light and dark themes both come from the host.
|
|
3005
|
+
*/
|
|
2967
3006
|
const VOICE_PROFILE_STYLES = `
|
|
2968
|
-
.center-voices{
|
|
2969
|
-
.center-voices-free{display:inline-flex;align-items:center;
|
|
2970
|
-
.center-voices-form{display:grid;gap:
|
|
2971
|
-
.center-voices-
|
|
2972
|
-
.center-voices-
|
|
2973
|
-
.center-voices-
|
|
2974
|
-
.center-voices-
|
|
2975
|
-
|
|
2976
|
-
.center-voices-
|
|
2977
|
-
.center-voices-
|
|
2978
|
-
.center-voices-
|
|
2979
|
-
.center-voices-
|
|
2980
|
-
.center-voices-
|
|
2981
|
-
|
|
3007
|
+
.member-polish.center-voices{max-width:880px;--voice-success:var(--dsw-alias-state-success-primary,#15803d);--voice-danger:var(--dsw-alias-state-error-primary,#c0392b);--voice-warn:var(--dsw-alias-state-warn-primary,#b77700)}
|
|
3008
|
+
.center-voices-intro>p{display:flex;flex-wrap:wrap;align-items:center;gap:8px;font-size:12px}.center-voices-free{display:inline-flex;align-items:center;padding:2px 9px;border-radius:999px;font-size:11px;font-weight:500;color:var(--member-accent);background:color-mix(in srgb,var(--member-accent) 9%,transparent)}
|
|
3009
|
+
.center-voices-form{display:grid;gap:18px;max-width:560px;min-width:0}.center-voices-form .center-field{display:grid;gap:8px;min-width:0;flex:none}.center-voices-form .center-field>label{font-size:12px;font-weight:500;color:var(--dsw-alias-label-primary,#202124)}
|
|
3010
|
+
.center-voices-hint{display:block;margin:0;font-size:11px;line-height:1.6;color:var(--member-muted)}
|
|
3011
|
+
.center-voices-drop{display:grid;justify-items:center;gap:6px;width:100%;padding:26px 16px;border:1.5px dashed var(--member-border);border-radius:10px;background:var(--member-inset);color:inherit;font:inherit;text-align:center;cursor:pointer;transition:border-color .15s,background-color .15s}.center-voices-drop strong{font-size:13px;font-weight:600}.center-voices-drop .center-muted{font-size:11px}
|
|
3012
|
+
.center-voices-drop:hover:not(:disabled),.center-voices-drop[data-over]{border-color:var(--member-accent);background:color-mix(in srgb,var(--member-accent) 6%,var(--member-surface))}.center-voices-drop:disabled{cursor:not-allowed;opacity:.55}
|
|
3013
|
+
.center-voices-drop-icon,.center-voices-avatar{display:inline-flex;align-items:center;justify-content:center;flex:none;border-radius:10px;color:var(--member-accent);background:color-mix(in srgb,var(--member-accent) 9%,var(--member-surface))}.center-voices-drop-icon{width:40px;height:40px}.center-voices-avatar{width:36px;height:36px;border-radius:9px}.center-voices-avatar svg{width:18px;height:18px}
|
|
3014
|
+
.center-voices-file-chip{display:flex;align-items:center;gap:12px;min-width:0;padding:10px 10px 10px 12px;border:1px solid var(--member-border);border-radius:10px;background:var(--member-inset)}.center-voices-file-chip[data-over]{border-color:var(--member-accent)}.center-voices-file-chip>button{flex:none}
|
|
3015
|
+
.center-voices-row-main{display:grid;gap:3px;flex:1;min-width:0}.center-voices-row-main strong{font-size:13px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.center-voices-row-meta{font-size:11px;color:var(--member-muted);font-variant-numeric:tabular-nums}
|
|
3016
|
+
.center-voices-submit{display:grid;justify-items:start;gap:6px}.center-voices-submit>button{min-height:38px;padding-inline:20px;font-weight:600}
|
|
3017
|
+
.center-voices-steps{display:flex;gap:8px;flex-wrap:wrap;margin:0;padding:0;list-style:none;font-size:11px}.center-voices-steps li{display:flex;align-items:center;gap:6px;padding:3px 10px;border-radius:999px;border:1px solid var(--member-border);color:var(--member-muted)}
|
|
3018
|
+
.center-voices-steps li[data-state=active]{color:var(--member-accent);border-color:var(--member-accent);font-weight:600}.center-voices-steps li[data-state=done]{color:var(--voice-success);border-color:color-mix(in srgb,var(--voice-success) 40%,transparent)}
|
|
3019
|
+
.center-voices-progress-box{display:grid;gap:8px}.center-voices-progress-box p{font-size:12px}.center-voices-progress{height:4px;border-radius:2px;background:var(--member-border);overflow:hidden}.center-voices-progress>span{display:block;height:100%;width:40%;background:var(--member-accent);animation:center-voices-bar 1.4s ease-in-out infinite}
|
|
3020
|
+
@keyframes center-voices-bar{0%{transform:translateX(-100%)}100%{transform:translateX(250%)}}@keyframes center-voices-spin{to{transform:rotate(360deg)}}@keyframes center-voices-pulse{50%{opacity:.45}}
|
|
3021
|
+
.center-voices-notice{margin:0;padding:10px 12px;border-radius:8px;font-size:12px;line-height:1.6}.center-voices-notice[data-tone=success]{color:var(--voice-success);background:color-mix(in srgb,var(--voice-success) 9%,transparent)}.center-voices-notice[data-tone=warn]{color:var(--voice-warn);background:color-mix(in srgb,var(--voice-warn) 10%,transparent)}.center-voices-notice[data-tone=danger]{color:var(--voice-danger);background:color-mix(in srgb,var(--voice-danger) 8%,transparent)}
|
|
3022
|
+
.center-voices-count{font-size:11px;color:var(--member-muted)}
|
|
3023
|
+
.center-voices-list{display:grid;margin:0;padding:0;list-style:none}.center-voices-row{display:flex;align-items:center;gap:12px;min-width:0;padding:12px 2px;border-bottom:1px solid var(--member-border)}.center-voices-row:last-child{border-bottom:0}.center-voices-row-title{display:flex;align-items:center;gap:8px;min-width:0}
|
|
3024
|
+
.center-voices-status{display:inline-flex;align-items:center;gap:5px;flex:none;padding:1px 8px;border-radius:999px;font-size:11px;font-weight:500;line-height:18px}
|
|
3025
|
+
.center-voices-status[data-status=ready]{color:var(--voice-success);background:color-mix(in srgb,var(--voice-success) 11%,transparent)}.center-voices-status[data-status=processing]{color:var(--member-accent);background:color-mix(in srgb,var(--member-accent) 11%,transparent)}.center-voices-status[data-status=failed]{color:var(--voice-danger);background:color-mix(in srgb,var(--voice-danger) 10%,transparent)}
|
|
3026
|
+
.center-voices-spinner{width:9px;height:9px;border:1.5px solid currentColor;border-right-color:transparent;border-radius:50%;animation:center-voices-spin .8s linear infinite}
|
|
3027
|
+
.center-voices-reason{font-size:11px;line-height:1.55;color:var(--voice-danger);overflow-wrap:anywhere}
|
|
3028
|
+
.center-voices .center-voices-delete{flex:none;color:var(--member-muted)}.center-voices-row:hover .center-voices-delete:not(:disabled),.center-voices .center-voices-delete:focus-visible{color:var(--voice-danger)}.center-voices .center-voices-delete:hover:not(:disabled){background:color-mix(in srgb,var(--voice-danger) 8%,transparent)}
|
|
3029
|
+
.member-polish-empty.center-voices-empty{width:100%;max-width:440px;margin:6px auto;padding:28px 20px}.center-voices-empty>strong{font-size:13px;font-weight:600}.center-voices-empty>span{color:var(--member-accent);opacity:1}.center-voices-empty[data-tone=warn]>span{color:var(--voice-warn)}.center-voices-empty>p{max-width:340px}
|
|
3030
|
+
.center-voices-skeleton{display:grid}.center-voices-skeleton-row{display:flex;align-items:center;gap:12px;padding:12px 2px;border-bottom:1px solid var(--member-border)}.center-voices-skeleton-row:last-of-type{border-bottom:0}.center-voices-skeleton-row>span{width:36px;height:36px;flex:none;border-radius:9px;background:var(--dsw-alias-bg-layer-3,#f2f4f7);animation:center-voices-pulse 1.4s ease-in-out infinite}.center-voices-skeleton-row>div{display:grid;gap:7px;flex:1}.center-voices-skeleton-row i{display:block;height:9px;border-radius:5px;background:var(--dsw-alias-bg-layer-3,#f2f4f7);animation:center-voices-pulse 1.4s ease-in-out infinite}.center-voices-skeleton-row i:first-child{width:38%}.center-voices-skeleton-row i:last-child{width:22%}
|
|
3031
|
+
.center-voices-confirm{display:grid;gap:8px;margin-bottom:12px;padding:14px;border:1px solid color-mix(in srgb,var(--voice-danger) 45%,transparent);border-radius:10px;background:color-mix(in srgb,var(--voice-danger) 5%,var(--member-surface))}.center-voices-confirm h3{margin:0;font-size:13px}.center-voices-confirm p{margin:0;font-size:12px}
|
|
3032
|
+
@container(max-width:560px){.center-voices-row{flex-wrap:wrap}.center-voices-row-main{flex-basis:calc(100% - 48px)}.center-voices .center-voices-delete{margin-left:48px;padding-inline:6px}.center-voices-drop{padding:20px 12px}.center-voices-submit>button{width:100%}.center-voices-submit{justify-items:stretch}}
|
|
2982
3033
|
`;
|
|
2983
3034
|
//#endregion
|
|
2984
3035
|
//#region src/client/AccountCenter/shared.tsx
|
|
@@ -14101,7 +14152,8 @@ window.__ModuleLoader__.load({
|
|
|
14101
14152
|
VOICE_TITLE_REQUIRED: "voiceErrTitle",
|
|
14102
14153
|
VOICE_TITLE_INVALID: "voiceErrTitle",
|
|
14103
14154
|
VOICE_TITLE_TOO_LONG: "voiceErrTitle",
|
|
14104
|
-
ACCOUNT_CHANGED: "voiceErrAccountChanged"
|
|
14155
|
+
ACCOUNT_CHANGED: "voiceErrAccountChanged",
|
|
14156
|
+
VOICE_PROFILE_UNCONFIRMED: "voiceUnconfirmed"
|
|
14105
14157
|
};
|
|
14106
14158
|
/** Everything else, by the error category — the account center's own words (`centerError*`). */
|
|
14107
14159
|
const CATEGORY_KEYS = {
|
|
@@ -14207,6 +14259,27 @@ window.__ModuleLoader__.load({
|
|
|
14207
14259
|
5e3
|
|
14208
14260
|
][round] ?? 8e3;
|
|
14209
14261
|
}
|
|
14262
|
+
/**
|
|
14263
|
+
* Which of the four steps (0 check, 1 upload and submit, 2 processing, 3 ready) a creation is at.
|
|
14264
|
+
* @param phase - the page's phase.
|
|
14265
|
+
* @param waitedSeconds - how long the creation has run.
|
|
14266
|
+
*/
|
|
14267
|
+
function voiceStepOf(phase, waitedSeconds) {
|
|
14268
|
+
if (phase === "checking") return 0;
|
|
14269
|
+
if (phase === "uploading") return waitedSeconds >= 15 ? 2 : 1;
|
|
14270
|
+
if (phase === "confirming" || phase === "processing") return 2;
|
|
14271
|
+
return phase === "ready" ? 3 : -1;
|
|
14272
|
+
}
|
|
14273
|
+
/**
|
|
14274
|
+
* The voice a creation without an answer made: one listed now that was not listed before, under the same title first.
|
|
14275
|
+
* @param items - the list now.
|
|
14276
|
+
* @param before - the ids listed before the creation.
|
|
14277
|
+
* @param title - the title it was created under.
|
|
14278
|
+
*/
|
|
14279
|
+
function findConfirmedVoice(items, before, title) {
|
|
14280
|
+
const fresh = items.filter((item) => !before.has(item.id));
|
|
14281
|
+
return fresh.find((item) => item.title === title) ?? fresh[0];
|
|
14282
|
+
}
|
|
14210
14283
|
/** The signed-in user the page shows, from the account center's identity (`[origin, source, userId]`). */
|
|
14211
14284
|
function expectedUserOf(identity) {
|
|
14212
14285
|
try {
|
|
@@ -14317,13 +14390,8 @@ window.__ModuleLoader__.load({
|
|
|
14317
14390
|
return profile.failureReason ?? t("voiceFailedUnknown");
|
|
14318
14391
|
}
|
|
14319
14392
|
/** The four steps of a creation and where it stands. */
|
|
14320
|
-
function VoiceSteps({ phase, t }) {
|
|
14321
|
-
const at = phase === "failed" || phase === "idle" ? -1 :
|
|
14322
|
-
"checking",
|
|
14323
|
-
"uploading",
|
|
14324
|
-
"processing",
|
|
14325
|
-
"ready"
|
|
14326
|
-
].indexOf(phase);
|
|
14393
|
+
function VoiceSteps({ phase, waited = 0, t }) {
|
|
14394
|
+
const at = phase === "failed" || phase === "idle" ? -1 : voiceStepOf(phase, waited);
|
|
14327
14395
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
|
|
14328
14396
|
className: "center-voices-steps",
|
|
14329
14397
|
"aria-label": t("voiceNewTitle"),
|
|
@@ -14343,88 +14411,258 @@ window.__ModuleLoader__.load({
|
|
|
14343
14411
|
}, label))
|
|
14344
14412
|
});
|
|
14345
14413
|
}
|
|
14346
|
-
/**
|
|
14414
|
+
/** Line icons in the account center's style (1.5 stroke, currentColor). */
|
|
14415
|
+
const ICON = {
|
|
14416
|
+
width: 20,
|
|
14417
|
+
height: 20,
|
|
14418
|
+
viewBox: "0 0 24 24",
|
|
14419
|
+
fill: "none",
|
|
14420
|
+
stroke: "currentColor",
|
|
14421
|
+
strokeWidth: 1.5,
|
|
14422
|
+
strokeLinecap: "round",
|
|
14423
|
+
strokeLinejoin: "round",
|
|
14424
|
+
"aria-hidden": true
|
|
14425
|
+
};
|
|
14426
|
+
function MicIcon() {
|
|
14427
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
14428
|
+
...ICON,
|
|
14429
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
14430
|
+
x: "9",
|
|
14431
|
+
y: "3",
|
|
14432
|
+
width: "6",
|
|
14433
|
+
height: "11",
|
|
14434
|
+
rx: "3"
|
|
14435
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21M8.5 21h7" })]
|
|
14436
|
+
});
|
|
14437
|
+
}
|
|
14438
|
+
function UploadIcon() {
|
|
14439
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
14440
|
+
...ICON,
|
|
14441
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 16V4M7 9l5-5 5 5M4 16v2.5A1.5 1.5 0 0 0 5.5 20h13a1.5 1.5 0 0 0 1.5-1.5V16" })
|
|
14442
|
+
});
|
|
14443
|
+
}
|
|
14444
|
+
function WaveIcon() {
|
|
14445
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
14446
|
+
...ICON,
|
|
14447
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4 10v4M8 7v10M12 4v16M16 8v8M20 11v2" })
|
|
14448
|
+
});
|
|
14449
|
+
}
|
|
14450
|
+
function AlertIcon() {
|
|
14451
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
14452
|
+
...ICON,
|
|
14453
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 4 2.8 19.5h18.4L12 4ZM12 10v4.5M12 17.2v.3" })
|
|
14454
|
+
});
|
|
14455
|
+
}
|
|
14456
|
+
function RefreshIcon() {
|
|
14457
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
14458
|
+
width: "14",
|
|
14459
|
+
height: "14",
|
|
14460
|
+
viewBox: "0 0 20 20",
|
|
14461
|
+
fill: "none",
|
|
14462
|
+
stroke: "currentColor",
|
|
14463
|
+
strokeWidth: "1.5",
|
|
14464
|
+
"aria-hidden": "true",
|
|
14465
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M16 8a6 6 0 1 0-1 7M16 3v5h-5" })
|
|
14466
|
+
});
|
|
14467
|
+
}
|
|
14468
|
+
/** One row's status as a pill (ready green, creating blue with a spinner, failed red), with the failure reason under a failed one. */
|
|
14347
14469
|
function VoiceStatus({ profile, t }) {
|
|
14348
14470
|
const label = profile.status === "ready" ? "voiceStatusReady" : profile.status === "failed" ? "voiceStatusFailed" : "voiceStatusProcessing";
|
|
14349
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
14471
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
14350
14472
|
className: "center-voices-status",
|
|
14351
14473
|
"data-status": profile.status,
|
|
14352
|
-
children:
|
|
14353
|
-
|
|
14354
|
-
|
|
14355
|
-
|
|
14356
|
-
})
|
|
14474
|
+
children: [profile.status === "processing" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
14475
|
+
className: "center-voices-spinner",
|
|
14476
|
+
"aria-hidden": "true"
|
|
14477
|
+
}), t(label)]
|
|
14478
|
+
});
|
|
14357
14479
|
}
|
|
14358
|
-
/** The list:
|
|
14359
|
-
function VoiceTable({ items, t, busy, onDelete }) {
|
|
14480
|
+
/** The list as rows: icon, name and status, 「时长 · 创建时间」, and delete on the right. */
|
|
14481
|
+
function VoiceTable({ items, t, busy, onDelete, onPick }) {
|
|
14360
14482
|
if (items.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14361
|
-
className: "center-voices-empty",
|
|
14483
|
+
className: "member-polish-empty center-voices-empty",
|
|
14362
14484
|
"data-voice-empty": true,
|
|
14363
|
-
children: [
|
|
14364
|
-
|
|
14365
|
-
children: t("
|
|
14366
|
-
|
|
14485
|
+
children: [
|
|
14486
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MicIcon, {}) }),
|
|
14487
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("voiceEmpty") }),
|
|
14488
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14489
|
+
className: "center-muted",
|
|
14490
|
+
children: t("voiceEmptyHint")
|
|
14491
|
+
}),
|
|
14492
|
+
onPick !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
14493
|
+
type: "button",
|
|
14494
|
+
variant: "primary",
|
|
14495
|
+
size: "sm",
|
|
14496
|
+
"data-voice-empty-pick": true,
|
|
14497
|
+
onClick: onPick,
|
|
14498
|
+
children: t("voicePickFile")
|
|
14499
|
+
})
|
|
14500
|
+
]
|
|
14367
14501
|
});
|
|
14368
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
14369
|
-
className: "center-
|
|
14370
|
-
|
|
14371
|
-
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
|
|
14375
|
-
|
|
14376
|
-
|
|
14377
|
-
|
|
14378
|
-
|
|
14379
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
14380
|
-
|
|
14381
|
-
children:
|
|
14382
|
-
}),
|
|
14383
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
14384
|
-
scope: "col",
|
|
14385
|
-
children: t("voiceColStatus")
|
|
14386
|
-
}),
|
|
14387
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
14388
|
-
scope: "col",
|
|
14389
|
-
children: t("voiceColDuration")
|
|
14502
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
14503
|
+
className: "center-voices-list",
|
|
14504
|
+
"aria-label": t("voiceList"),
|
|
14505
|
+
"data-voice-table": true,
|
|
14506
|
+
children: items.map((profile) => {
|
|
14507
|
+
const facts = [profile.durationSeconds === void 0 ? void 0 : fill$1(t("voiceSeconds"), { seconds: seconds(profile.durationSeconds) }), profile.createdAt === void 0 ? void 0 : dateTime(profile.createdAt, t)].filter((item) => item !== void 0);
|
|
14508
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
14509
|
+
className: "center-voices-row",
|
|
14510
|
+
"data-voice-id": profile.id,
|
|
14511
|
+
"data-status": profile.status,
|
|
14512
|
+
children: [
|
|
14513
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
14514
|
+
className: "center-voices-avatar",
|
|
14515
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MicIcon, {})
|
|
14390
14516
|
}),
|
|
14391
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
14392
|
-
|
|
14393
|
-
children:
|
|
14517
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14518
|
+
className: "center-voices-row-main",
|
|
14519
|
+
children: [
|
|
14520
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14521
|
+
className: "center-voices-row-title",
|
|
14522
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: profile.title ?? t("voiceUntitled") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceStatus, {
|
|
14523
|
+
profile,
|
|
14524
|
+
t
|
|
14525
|
+
})]
|
|
14526
|
+
}),
|
|
14527
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
14528
|
+
className: "center-voices-row-meta",
|
|
14529
|
+
children: facts.length === 0 ? "—" : facts.join(" · ")
|
|
14530
|
+
}),
|
|
14531
|
+
profile.status === "failed" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
14532
|
+
className: "center-voices-reason",
|
|
14533
|
+
children: failureText(profile, t)
|
|
14534
|
+
})
|
|
14535
|
+
]
|
|
14394
14536
|
}),
|
|
14395
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
14396
|
-
|
|
14397
|
-
|
|
14537
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
14538
|
+
type: "button",
|
|
14539
|
+
variant: "ghost",
|
|
14540
|
+
size: "sm",
|
|
14541
|
+
className: "center-voices-delete",
|
|
14542
|
+
disabled: busy,
|
|
14543
|
+
"data-voice-delete": profile.id,
|
|
14544
|
+
"aria-label": `${t("voiceDelete")} ${profile.title ?? t("voiceUntitled")}`,
|
|
14545
|
+
onClick: () => onDelete(profile),
|
|
14546
|
+
children: t("voiceDelete")
|
|
14398
14547
|
})
|
|
14399
|
-
]
|
|
14400
|
-
|
|
14401
|
-
"data-voice-id": profile.id,
|
|
14402
|
-
children: [
|
|
14403
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
14404
|
-
scope: "row",
|
|
14405
|
-
children: profile.title ?? t("voiceUntitled")
|
|
14406
|
-
}),
|
|
14407
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceStatus, {
|
|
14408
|
-
profile,
|
|
14409
|
-
t
|
|
14410
|
-
}) }),
|
|
14411
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: profile.durationSeconds === void 0 ? "—" : fill$1(t("voiceSeconds"), { seconds: seconds(profile.durationSeconds) }) }),
|
|
14412
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: dateTime(profile.createdAt, t) }),
|
|
14413
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
14414
|
-
type: "button",
|
|
14415
|
-
variant: "ghost",
|
|
14416
|
-
size: "sm",
|
|
14417
|
-
disabled: busy,
|
|
14418
|
-
"data-voice-delete": profile.id,
|
|
14419
|
-
onClick: () => onDelete(profile),
|
|
14420
|
-
children: t("voiceDelete")
|
|
14421
|
-
}) })
|
|
14422
|
-
]
|
|
14423
|
-
}, profile.id)) })
|
|
14424
|
-
]
|
|
14548
|
+
]
|
|
14549
|
+
}, profile.id);
|
|
14425
14550
|
})
|
|
14426
14551
|
});
|
|
14427
14552
|
}
|
|
14553
|
+
/** A loading, failed or unsupported list, as a placeholder of the list's own shape rather than one line of text. */
|
|
14554
|
+
function VoicePlaceholder({ kind, t, failure, onRetry }) {
|
|
14555
|
+
if (kind === "loading") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14556
|
+
className: "center-voices-skeleton",
|
|
14557
|
+
role: "status",
|
|
14558
|
+
"aria-label": t("voiceLoading"),
|
|
14559
|
+
"data-voice-loading": true,
|
|
14560
|
+
children: [[
|
|
14561
|
+
0,
|
|
14562
|
+
1,
|
|
14563
|
+
2
|
|
14564
|
+
].map((index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14565
|
+
className: "center-voices-skeleton-row",
|
|
14566
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", {})] })]
|
|
14567
|
+
}, index)), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
14568
|
+
className: "center-sr-only",
|
|
14569
|
+
children: t("voiceLoading")
|
|
14570
|
+
})]
|
|
14571
|
+
});
|
|
14572
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14573
|
+
className: "member-polish-empty center-voices-empty",
|
|
14574
|
+
"data-tone": kind === "failed" ? "warn" : void 0,
|
|
14575
|
+
role: kind === "failed" ? "alert" : "status",
|
|
14576
|
+
"data-voice-placeholder": kind,
|
|
14577
|
+
children: [
|
|
14578
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: kind === "failed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertIcon, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WaveIcon, {}) }),
|
|
14579
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t(kind === "failed" ? "voiceLoadFailed" : "voiceUnsupportedTitle") }),
|
|
14580
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14581
|
+
className: "center-muted",
|
|
14582
|
+
children: kind === "failed" && failure !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailureText, {
|
|
14583
|
+
failure,
|
|
14584
|
+
t
|
|
14585
|
+
}) : t("voiceUnsupported")
|
|
14586
|
+
}),
|
|
14587
|
+
kind === "failed" && onRetry !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
14588
|
+
type: "button",
|
|
14589
|
+
variant: "outline",
|
|
14590
|
+
size: "sm",
|
|
14591
|
+
onClick: onRetry,
|
|
14592
|
+
children: t("voiceRetry")
|
|
14593
|
+
})
|
|
14594
|
+
]
|
|
14595
|
+
});
|
|
14596
|
+
}
|
|
14597
|
+
/** The recording picker: a dashed drop area until a file is chosen, then a pill with its name, length and size. */
|
|
14598
|
+
function VoiceDropzone({ file, fileSeconds, disabled, t, onPick, onChoose }) {
|
|
14599
|
+
const [over, setOver] = (0, react.useState)(false);
|
|
14600
|
+
const drop = {
|
|
14601
|
+
onDragOver: (event) => {
|
|
14602
|
+
if (disabled) return;
|
|
14603
|
+
event.preventDefault();
|
|
14604
|
+
setOver(true);
|
|
14605
|
+
},
|
|
14606
|
+
onDragLeave: () => setOver(false),
|
|
14607
|
+
onDrop: (event) => {
|
|
14608
|
+
event.preventDefault();
|
|
14609
|
+
setOver(false);
|
|
14610
|
+
if (!disabled) onChoose(event.dataTransfer.files[0]);
|
|
14611
|
+
}
|
|
14612
|
+
};
|
|
14613
|
+
if (file === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
14614
|
+
type: "button",
|
|
14615
|
+
className: "center-voices-drop",
|
|
14616
|
+
"data-over": over || void 0,
|
|
14617
|
+
disabled,
|
|
14618
|
+
onClick: onPick,
|
|
14619
|
+
"data-voice-drop": true,
|
|
14620
|
+
...drop,
|
|
14621
|
+
children: [
|
|
14622
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
14623
|
+
className: "center-voices-drop-icon",
|
|
14624
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UploadIcon, {})
|
|
14625
|
+
}),
|
|
14626
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t(over ? "voiceDropActive" : "voiceDropTitle") }),
|
|
14627
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
14628
|
+
className: "center-muted",
|
|
14629
|
+
children: t("voiceDropFormats")
|
|
14630
|
+
})
|
|
14631
|
+
]
|
|
14632
|
+
});
|
|
14633
|
+
const facts = [typeof fileSeconds === "number" ? fill$1(t("voiceSeconds"), { seconds: seconds(fileSeconds) }) : fileSeconds === "measuring" ? t("voiceMeasuring") : void 0, megabytes(file.size)].filter((item) => item !== void 0);
|
|
14634
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14635
|
+
className: "center-voices-file-chip",
|
|
14636
|
+
"data-over": over || void 0,
|
|
14637
|
+
"data-voice-file": true,
|
|
14638
|
+
...drop,
|
|
14639
|
+
children: [
|
|
14640
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
14641
|
+
className: "center-voices-avatar",
|
|
14642
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WaveIcon, {})
|
|
14643
|
+
}),
|
|
14644
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14645
|
+
className: "center-voices-row-main",
|
|
14646
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
|
|
14647
|
+
title: file.name,
|
|
14648
|
+
children: file.name
|
|
14649
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
14650
|
+
className: "center-voices-row-meta",
|
|
14651
|
+
children: facts.join(" · ")
|
|
14652
|
+
})]
|
|
14653
|
+
}),
|
|
14654
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
14655
|
+
type: "button",
|
|
14656
|
+
variant: "ghost",
|
|
14657
|
+
size: "sm",
|
|
14658
|
+
disabled,
|
|
14659
|
+
onClick: onPick,
|
|
14660
|
+
"data-voice-repick": true,
|
|
14661
|
+
children: t("voiceChangeFile")
|
|
14662
|
+
})
|
|
14663
|
+
]
|
|
14664
|
+
});
|
|
14665
|
+
}
|
|
14428
14666
|
/** The confirmation in front of a deletion. */
|
|
14429
14667
|
function VoiceDeleteConfirm({ profile, t, busy, onConfirm, onCancel }) {
|
|
14430
14668
|
const titleId = (0, react.useId)();
|
|
@@ -14479,6 +14717,8 @@ window.__ModuleLoader__.load({
|
|
|
14479
14717
|
const [createFailure, setCreateFailure] = (0, react.useState)();
|
|
14480
14718
|
const [created, setCreated] = (0, react.useState)();
|
|
14481
14719
|
const [startedAt, setStartedAt] = (0, react.useState)(0);
|
|
14720
|
+
/** The ids listed before the last creation, to recognise the new one when the creation ended without an answer. */
|
|
14721
|
+
const [beforeIds, setBeforeIds] = (0, react.useState)(() => /* @__PURE__ */ new Set());
|
|
14482
14722
|
const [now, setNow] = (0, react.useState)(() => Date.now());
|
|
14483
14723
|
const [formKey, setFormKey] = (0, react.useState)(0);
|
|
14484
14724
|
const [confirming, setConfirming] = (0, react.useState)();
|
|
@@ -14511,7 +14751,7 @@ window.__ModuleLoader__.load({
|
|
|
14511
14751
|
reload,
|
|
14512
14752
|
reportActivity
|
|
14513
14753
|
]);
|
|
14514
|
-
const processing = items?.some((item) => item.status === "processing") === true || phase === "processing";
|
|
14754
|
+
const processing = items?.some((item) => item.status === "processing") === true || phase === "processing" || phase === "confirming";
|
|
14515
14755
|
(0, react.useEffect)(() => {
|
|
14516
14756
|
if (!processing) {
|
|
14517
14757
|
poll.current = {
|
|
@@ -14534,10 +14774,23 @@ window.__ModuleLoader__.load({
|
|
|
14534
14774
|
return () => clearTimeout(timer);
|
|
14535
14775
|
}, [processing, items]);
|
|
14536
14776
|
(0, react.useEffect)(() => {
|
|
14537
|
-
if (phase !== "processing") return;
|
|
14777
|
+
if (phase !== "processing" && phase !== "uploading" && phase !== "confirming") return;
|
|
14538
14778
|
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
14539
14779
|
return () => clearInterval(timer);
|
|
14540
14780
|
}, [phase]);
|
|
14781
|
+
(0, react.useEffect)(() => {
|
|
14782
|
+
if (phase !== "confirming") return;
|
|
14783
|
+
const found = findConfirmedVoice(items ?? [], beforeIds, title.trim());
|
|
14784
|
+
if (found === void 0) return;
|
|
14785
|
+
setCreated(found);
|
|
14786
|
+
setCreateFailure(void 0);
|
|
14787
|
+
setPhase(found.status === "ready" ? "ready" : found.status === "failed" ? "failed" : "processing");
|
|
14788
|
+
}, [
|
|
14789
|
+
items,
|
|
14790
|
+
phase,
|
|
14791
|
+
beforeIds,
|
|
14792
|
+
title
|
|
14793
|
+
]);
|
|
14541
14794
|
(0, react.useEffect)(() => {
|
|
14542
14795
|
if (created === void 0 || phase !== "processing") return;
|
|
14543
14796
|
const found = items?.find((item) => item.id === created.id);
|
|
@@ -14550,8 +14803,17 @@ window.__ModuleLoader__.load({
|
|
|
14550
14803
|
phase
|
|
14551
14804
|
]);
|
|
14552
14805
|
const busy = phase === "checking" || phase === "uploading";
|
|
14553
|
-
|
|
14554
|
-
|
|
14806
|
+
/** Still confirming a creation without an answer (until the list reads stop, when retrying is offered). */
|
|
14807
|
+
const confirmingNow = phase === "confirming" && !pollStopped;
|
|
14808
|
+
const fileInput = (0, react.useRef)(null);
|
|
14809
|
+
/** Open the system picker (the drop area, 重新选择 and the empty list's button all lead here). */
|
|
14810
|
+
const pickFile = () => {
|
|
14811
|
+
fileInput.current?.focus();
|
|
14812
|
+
fileInput.current?.click();
|
|
14813
|
+
};
|
|
14814
|
+
const chooseFile = (chosen) => {
|
|
14815
|
+
if (chosen === void 0) return;
|
|
14816
|
+
if (fileInput.current !== null) fileInput.current.value = "";
|
|
14555
14817
|
setFile(chosen);
|
|
14556
14818
|
setFileFailure(void 0);
|
|
14557
14819
|
setFileSeconds(void 0);
|
|
@@ -14575,7 +14837,7 @@ window.__ModuleLoader__.load({
|
|
|
14575
14837
|
};
|
|
14576
14838
|
const submit = async (event) => {
|
|
14577
14839
|
event.preventDefault();
|
|
14578
|
-
if (busy || phase === "processing" || file === void 0) return;
|
|
14840
|
+
if (busy || confirmingNow || phase === "processing" || file === void 0) return;
|
|
14579
14841
|
setCreateFailure(void 0);
|
|
14580
14842
|
setCreated(void 0);
|
|
14581
14843
|
setPhase("checking");
|
|
@@ -14590,6 +14852,9 @@ window.__ModuleLoader__.load({
|
|
|
14590
14852
|
setPhase("idle");
|
|
14591
14853
|
return;
|
|
14592
14854
|
}
|
|
14855
|
+
setBeforeIds(new Set((items ?? []).map((item) => item.id)));
|
|
14856
|
+
setStartedAt(Date.now());
|
|
14857
|
+
setNow(Date.now());
|
|
14593
14858
|
setPhase("uploading");
|
|
14594
14859
|
let data;
|
|
14595
14860
|
try {
|
|
@@ -14606,7 +14871,15 @@ window.__ModuleLoader__.load({
|
|
|
14606
14871
|
});
|
|
14607
14872
|
if (!result.ok) {
|
|
14608
14873
|
setCreateFailure(result.failure);
|
|
14609
|
-
|
|
14874
|
+
if (result.failure.code === "VOICE_PROFILE_UNCONFIRMED" || result.failure.code === "GATEWAY_TIMEOUT") {
|
|
14875
|
+
setPollStopped(false);
|
|
14876
|
+
poll.current = {
|
|
14877
|
+
round: 0,
|
|
14878
|
+
since: 0
|
|
14879
|
+
};
|
|
14880
|
+
setPhase("confirming");
|
|
14881
|
+
setReload((value) => value + 1);
|
|
14882
|
+
} else setPhase("failed");
|
|
14610
14883
|
return;
|
|
14611
14884
|
}
|
|
14612
14885
|
const profile = result.value;
|
|
@@ -14614,11 +14887,7 @@ window.__ModuleLoader__.load({
|
|
|
14614
14887
|
setItems((current) => [profile, ...(current ?? []).filter((item) => item.id !== profile.id)]);
|
|
14615
14888
|
if (profile.status === "ready") setPhase("ready");
|
|
14616
14889
|
else if (profile.status === "failed") setPhase("failed");
|
|
14617
|
-
else
|
|
14618
|
-
setStartedAt(Date.now());
|
|
14619
|
-
setNow(Date.now());
|
|
14620
|
-
setPhase("processing");
|
|
14621
|
-
}
|
|
14890
|
+
else setPhase("processing");
|
|
14622
14891
|
};
|
|
14623
14892
|
const another = () => {
|
|
14624
14893
|
setFile(void 0);
|
|
@@ -14648,39 +14917,50 @@ window.__ModuleLoader__.load({
|
|
|
14648
14917
|
};
|
|
14649
14918
|
const waited = Math.max(0, Math.round((now - startedAt) / 1e3));
|
|
14650
14919
|
const short = typeof fileSeconds === "number" && fileSeconds >= VOICE_LIMITS.minSeconds && fileSeconds < VOICE_LIMITS.recommendedMinSeconds;
|
|
14920
|
+
const locked = busy || confirmingNow || phase === "processing";
|
|
14921
|
+
/** Why 创建音色 cannot be pressed yet, shown under it (and as its tooltip). */
|
|
14922
|
+
const blockedReason = locked ? void 0 : file === void 0 ? t("voiceNeedFile") : title.trim() === "" ? t("voiceNeedName") : void 0;
|
|
14923
|
+
const refreshList = () => {
|
|
14924
|
+
setDeleted(false);
|
|
14925
|
+
setReload((value) => value + 1);
|
|
14926
|
+
};
|
|
14927
|
+
const refreshButton = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
14928
|
+
type: "button",
|
|
14929
|
+
variant: "outline",
|
|
14930
|
+
size: "sm",
|
|
14931
|
+
disabled: listState === "loading" && items === void 0,
|
|
14932
|
+
onClick: refreshList,
|
|
14933
|
+
"data-voice-refresh": true,
|
|
14934
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RefreshIcon, {}),
|
|
14935
|
+
children: t("voiceRefresh")
|
|
14936
|
+
});
|
|
14651
14937
|
if (listState === "unsupported") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
14652
|
-
className: "center-voices",
|
|
14938
|
+
className: "member-polish center-voices",
|
|
14939
|
+
"data-voice-page": true,
|
|
14653
14940
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
14654
|
-
className: "center-section
|
|
14655
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
children: t("voiceUnsupported")
|
|
14941
|
+
className: "center-section",
|
|
14942
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoicePlaceholder, {
|
|
14943
|
+
kind: "unsupported",
|
|
14944
|
+
t
|
|
14659
14945
|
})
|
|
14660
14946
|
})
|
|
14661
14947
|
});
|
|
14662
14948
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14663
|
-
className: "center-voices",
|
|
14949
|
+
className: "member-polish center-voices",
|
|
14664
14950
|
"data-voice-page": true,
|
|
14665
14951
|
children: [
|
|
14666
14952
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14667
|
-
className: "center-voices-intro",
|
|
14668
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.
|
|
14669
|
-
className: "center-
|
|
14670
|
-
children:
|
|
14671
|
-
|
|
14672
|
-
|
|
14673
|
-
|
|
14674
|
-
|
|
14675
|
-
disabled: listState === "loading" && items === void 0,
|
|
14676
|
-
onClick: () => {
|
|
14677
|
-
setDeleted(false);
|
|
14678
|
-
setReload((value) => value + 1);
|
|
14679
|
-
},
|
|
14680
|
-
children: t("voiceRefresh")
|
|
14681
|
-
})]
|
|
14953
|
+
className: "member-polish-intro center-voices-intro",
|
|
14954
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
14955
|
+
className: "center-muted",
|
|
14956
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
14957
|
+
className: "center-voices-free",
|
|
14958
|
+
children: t("voiceFree")
|
|
14959
|
+
}), t("voiceKeepNote")]
|
|
14960
|
+
}), refreshButton]
|
|
14682
14961
|
}),
|
|
14683
14962
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Section, {
|
|
14963
|
+
className: "center-voices-card",
|
|
14684
14964
|
title: t("voiceNewTitle"),
|
|
14685
14965
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
14686
14966
|
className: "center-voices-form",
|
|
@@ -14691,40 +14971,44 @@ window.__ModuleLoader__.load({
|
|
|
14691
14971
|
children: [
|
|
14692
14972
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14693
14973
|
className: "center-field",
|
|
14694
|
-
children: [
|
|
14695
|
-
|
|
14696
|
-
|
|
14697
|
-
|
|
14698
|
-
|
|
14699
|
-
|
|
14974
|
+
children: [
|
|
14975
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
14976
|
+
htmlFor: fileId,
|
|
14977
|
+
children: t("voiceFile")
|
|
14978
|
+
}),
|
|
14979
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
14980
|
+
ref: fileInput,
|
|
14700
14981
|
id: fileId,
|
|
14982
|
+
className: "center-sr-only",
|
|
14701
14983
|
type: "file",
|
|
14702
14984
|
accept: VOICE_ACCEPT,
|
|
14703
14985
|
"aria-label": t("voiceChooseFile"),
|
|
14704
|
-
disabled:
|
|
14705
|
-
|
|
14986
|
+
disabled: locked,
|
|
14987
|
+
tabIndex: -1,
|
|
14988
|
+
onChange: (event) => chooseFile(event.target.files?.[0])
|
|
14989
|
+
}),
|
|
14990
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceDropzone, {
|
|
14991
|
+
...file === void 0 ? {} : { file },
|
|
14992
|
+
...fileSeconds === void 0 ? {} : { fileSeconds },
|
|
14993
|
+
disabled: locked,
|
|
14994
|
+
t,
|
|
14995
|
+
onPick: pickFile,
|
|
14996
|
+
onChoose: chooseFile
|
|
14997
|
+
}),
|
|
14998
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", {
|
|
14999
|
+
className: "center-voices-hint",
|
|
15000
|
+
title: t("voiceFileHint"),
|
|
15001
|
+
children: t("voiceFileAdvice")
|
|
14706
15002
|
})
|
|
14707
|
-
|
|
14708
|
-
}),
|
|
14709
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14710
|
-
className: "center-muted",
|
|
14711
|
-
children: t("voiceFileHint")
|
|
14712
|
-
}),
|
|
14713
|
-
file !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14714
|
-
className: "center-voices-facts",
|
|
14715
|
-
"data-voice-file": true,
|
|
14716
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: fill$1(t("voiceFileChosen"), {
|
|
14717
|
-
name: file.name,
|
|
14718
|
-
size: megabytes(file.size)
|
|
14719
|
-
}) }), typeof fileSeconds === "number" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: fill$1(t("voiceFileSeconds"), { seconds: seconds(fileSeconds) }) })]
|
|
15003
|
+
]
|
|
14720
15004
|
}),
|
|
14721
15005
|
fileSeconds === "unknown" && fileFailure === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14722
|
-
className: "center-
|
|
15006
|
+
className: "center-voices-hint",
|
|
14723
15007
|
role: "status",
|
|
14724
15008
|
children: t("voiceFileSecondsUnknown")
|
|
14725
15009
|
}),
|
|
14726
15010
|
short && fileFailure === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14727
|
-
className: "center-
|
|
15011
|
+
className: "center-voices-hint",
|
|
14728
15012
|
children: t("voiceFileShortHint")
|
|
14729
15013
|
}),
|
|
14730
15014
|
fileFailure !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
@@ -14738,21 +15022,28 @@ window.__ModuleLoader__.load({
|
|
|
14738
15022
|
}),
|
|
14739
15023
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14740
15024
|
className: "center-field",
|
|
14741
|
-
children: [
|
|
14742
|
-
|
|
14743
|
-
|
|
14744
|
-
|
|
14745
|
-
|
|
14746
|
-
|
|
14747
|
-
|
|
14748
|
-
|
|
14749
|
-
|
|
14750
|
-
|
|
14751
|
-
|
|
14752
|
-
|
|
14753
|
-
|
|
14754
|
-
|
|
14755
|
-
|
|
15025
|
+
children: [
|
|
15026
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
15027
|
+
htmlFor: titleId,
|
|
15028
|
+
children: t("voiceName")
|
|
15029
|
+
}),
|
|
15030
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
15031
|
+
id: titleId,
|
|
15032
|
+
value: title,
|
|
15033
|
+
maxLength: VOICE_LIMITS.titleMax,
|
|
15034
|
+
placeholder: t("voiceNamePlaceholder"),
|
|
15035
|
+
disabled: locked,
|
|
15036
|
+
"aria-invalid": titleInvalid,
|
|
15037
|
+
onChange: (event) => {
|
|
15038
|
+
setTitle(event.target.value);
|
|
15039
|
+
setTitleInvalid(false);
|
|
15040
|
+
}
|
|
15041
|
+
}),
|
|
15042
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", {
|
|
15043
|
+
className: "center-voices-hint",
|
|
15044
|
+
children: fill$1(t("voiceNameHint"), { max: VOICE_LIMITS.titleMax })
|
|
15045
|
+
})
|
|
15046
|
+
]
|
|
14756
15047
|
}),
|
|
14757
15048
|
titleInvalid && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14758
15049
|
className: "center-warning",
|
|
@@ -14761,9 +15052,11 @@ window.__ModuleLoader__.load({
|
|
|
14761
15052
|
}),
|
|
14762
15053
|
phase !== "idle" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceSteps, {
|
|
14763
15054
|
phase,
|
|
15055
|
+
waited,
|
|
14764
15056
|
t
|
|
14765
15057
|
}),
|
|
14766
|
-
(busy || phase === "processing") && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
15058
|
+
(busy || confirmingNow || phase === "processing") && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
15059
|
+
className: "center-voices-progress-box",
|
|
14767
15060
|
role: "status",
|
|
14768
15061
|
"aria-live": "polite",
|
|
14769
15062
|
"data-voice-progress": true,
|
|
@@ -14773,9 +15066,16 @@ window.__ModuleLoader__.load({
|
|
|
14773
15066
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {})
|
|
14774
15067
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14775
15068
|
className: "center-muted",
|
|
14776
|
-
children: phase === "checking" ? t("voiceChecking") : phase === "uploading" ? t("voiceUploading") : fill$1(t(pollStopped ? "voiceProcessingSlow" : "voiceProcessing"), { seconds: waited })
|
|
15069
|
+
children: phase === "checking" ? t("voiceChecking") : phase === "uploading" ? voiceStepOf("uploading", waited) >= 2 ? fill$1(t("voiceWaitingGateway"), { seconds: waited }) : t("voiceUploading") : phase === "confirming" ? fill$1(t("voiceConfirming"), { seconds: waited }) : fill$1(t(pollStopped ? "voiceProcessingSlow" : "voiceProcessing"), { seconds: waited })
|
|
14777
15070
|
})]
|
|
14778
15071
|
}),
|
|
15072
|
+
phase === "confirming" && pollStopped && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
15073
|
+
className: "center-voices-notice",
|
|
15074
|
+
"data-tone": "warn",
|
|
15075
|
+
role: "status",
|
|
15076
|
+
"data-voice-unconfirmed": true,
|
|
15077
|
+
children: t("voiceUnconfirmed")
|
|
15078
|
+
}),
|
|
14779
15079
|
phase === "ready" && created !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14780
15080
|
className: "center-voices-notice",
|
|
14781
15081
|
"data-tone": "success",
|
|
@@ -14783,7 +15083,8 @@ window.__ModuleLoader__.load({
|
|
|
14783
15083
|
children: fill$1(t("voiceReadyNotice"), { title: created.title ?? title })
|
|
14784
15084
|
}),
|
|
14785
15085
|
phase === "failed" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14786
|
-
className: "center-
|
|
15086
|
+
className: "center-voices-notice",
|
|
15087
|
+
"data-tone": "danger",
|
|
14787
15088
|
role: "alert",
|
|
14788
15089
|
"data-voice-create-error": true,
|
|
14789
15090
|
children: createFailure !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailureText, {
|
|
@@ -14791,9 +15092,9 @@ window.__ModuleLoader__.load({
|
|
|
14791
15092
|
t
|
|
14792
15093
|
}) : fill$1(t("voiceFailedNotice"), { reason: created === void 0 ? t("voiceFailedUnknown") : failureText(created, t) })
|
|
14793
15094
|
}),
|
|
14794
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
14795
|
-
className: "center-
|
|
14796
|
-
children: phase === "ready" || phase === "failed" && createFailure === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
15095
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
15096
|
+
className: "center-voices-submit",
|
|
15097
|
+
children: [phase === "ready" || phase === "failed" && createFailure === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
14797
15098
|
type: "button",
|
|
14798
15099
|
variant: "outline",
|
|
14799
15100
|
onClick: another,
|
|
@@ -14802,19 +15103,25 @@ window.__ModuleLoader__.load({
|
|
|
14802
15103
|
type: "submit",
|
|
14803
15104
|
variant: "primary",
|
|
14804
15105
|
"data-voice-create": true,
|
|
14805
|
-
|
|
15106
|
+
title: blockedReason,
|
|
15107
|
+
disabled: locked || file === void 0 || fileFailure !== void 0 || fileSeconds === "measuring" || title.trim() === "",
|
|
14806
15108
|
children: t("voiceCreate")
|
|
14807
|
-
})
|
|
14808
|
-
|
|
14809
|
-
|
|
14810
|
-
|
|
14811
|
-
|
|
15109
|
+
}), blockedReason !== void 0 && phase !== "ready" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", {
|
|
15110
|
+
className: "center-voices-hint",
|
|
15111
|
+
"data-voice-blocked": true,
|
|
15112
|
+
children: blockedReason
|
|
15113
|
+
})]
|
|
14812
15114
|
})
|
|
14813
15115
|
]
|
|
14814
15116
|
}, formKey)
|
|
14815
15117
|
}),
|
|
14816
15118
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
|
|
15119
|
+
className: "center-voices-card",
|
|
14817
15120
|
title: t("voiceList"),
|
|
15121
|
+
action: items !== void 0 && items.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
15122
|
+
className: "center-voices-count",
|
|
15123
|
+
children: fill$1(t("voiceListCount"), { count: items.length })
|
|
15124
|
+
}) : void 0,
|
|
14818
15125
|
children: [
|
|
14819
15126
|
deleted && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14820
15127
|
className: "center-voices-notice",
|
|
@@ -14842,31 +15149,36 @@ window.__ModuleLoader__.load({
|
|
|
14842
15149
|
t
|
|
14843
15150
|
})
|
|
14844
15151
|
}),
|
|
14845
|
-
listState === "failed" && listFailure !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
15152
|
+
listState === "failed" && listFailure !== void 0 && items !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
14846
15153
|
className: "center-warning",
|
|
14847
15154
|
role: "alert",
|
|
14848
15155
|
"data-voice-list-error": true,
|
|
14849
15156
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailureText, {
|
|
14850
15157
|
failure: listFailure,
|
|
14851
15158
|
t
|
|
14852
|
-
}),
|
|
15159
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
14853
15160
|
className: "center-muted",
|
|
14854
15161
|
children: [" · ", t("centerStale")]
|
|
14855
|
-
})
|
|
15162
|
+
})]
|
|
14856
15163
|
}),
|
|
14857
|
-
items
|
|
14858
|
-
className: "center-muted",
|
|
14859
|
-
role: "status",
|
|
14860
|
-
children: t("voiceLoading")
|
|
14861
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceTable, {
|
|
15164
|
+
items !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceTable, {
|
|
14862
15165
|
items,
|
|
14863
15166
|
t,
|
|
14864
15167
|
busy: deleting,
|
|
15168
|
+
onPick: pickFile,
|
|
14865
15169
|
onDelete: (profile) => {
|
|
14866
15170
|
setDeleted(false);
|
|
14867
15171
|
setDeleteFailure(void 0);
|
|
14868
15172
|
setConfirming(profile);
|
|
14869
15173
|
}
|
|
15174
|
+
}) : listState === "failed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoicePlaceholder, {
|
|
15175
|
+
kind: "failed",
|
|
15176
|
+
t,
|
|
15177
|
+
...listFailure === void 0 ? {} : { failure: listFailure },
|
|
15178
|
+
onRetry: refreshList
|
|
15179
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoicePlaceholder, {
|
|
15180
|
+
kind: "loading",
|
|
15181
|
+
t
|
|
14870
15182
|
})
|
|
14871
15183
|
]
|
|
14872
15184
|
})
|
package/client/client.js
CHANGED
|
@@ -2483,7 +2483,24 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
|
|
|
2483
2483
|
voiceErrorCode: "错误码 {code}",
|
|
2484
2484
|
voiceRejectSimilar: "这段样本和已有录音太像,请换一段干净、独特的人声。",
|
|
2485
2485
|
voiceRejectNotClean: "这不是干净的人声:请换一段只有一个人声、不带伴奏和杂音的录音。",
|
|
2486
|
-
voiceRejectOriginal: "原始原因:{reason}"
|
|
2486
|
+
voiceRejectOriginal: "原始原因:{reason}",
|
|
2487
|
+
voiceDropTitle: "点击或拖入音频文件",
|
|
2488
|
+
voiceFileAdvice: "建议 10–60 秒、只有一个人声的干净录音,不带伴奏和杂音。",
|
|
2489
|
+
voiceDropActive: "松开即可添加",
|
|
2490
|
+
voiceDropFormats: "mp3 · wav · m4a · aac · flac · ogg,6–60 秒,不超过 10 MB",
|
|
2491
|
+
voiceChangeFile: "重新选择",
|
|
2492
|
+
voiceMeasuring: "正在测量时长…",
|
|
2493
|
+
voicePickFile: "选择音频文件",
|
|
2494
|
+
voiceNameHint: "最多 {max} 个字,只用来在列表里区分音色。",
|
|
2495
|
+
voiceNeedFile: "请先选择一个音频文件",
|
|
2496
|
+
voiceNeedName: "请填写音色名称",
|
|
2497
|
+
voiceListCount: "共 {count} 个",
|
|
2498
|
+
voiceLoadFailed: "音色列表没有读到",
|
|
2499
|
+
voiceUnsupportedTitle: "暂未开放音色管理",
|
|
2500
|
+
voiceRetry: "重试",
|
|
2501
|
+
voiceWaitingGateway: "网关处理中,已等待 {seconds} 秒。较长的样本可能需要 1–3 分钟,请不要关闭页面。",
|
|
2502
|
+
voiceConfirming: "网关没有及时回复,音色可能已经创建,正在确认(已等待 {seconds} 秒)…",
|
|
2503
|
+
voiceUnconfirmed: "网关处理超时。可能已在网关侧创建,请稍后刷新列表确认;若列表没有,再重试。"
|
|
2487
2504
|
};
|
|
2488
2505
|
const voiceProfileEn = {
|
|
2489
2506
|
centerVoiceProfiles: "My voices",
|
|
@@ -2549,7 +2566,24 @@ window.__ModuleLoader__.load({ id: "@vibedev-si/dsh-vibedev", factory: (require)
|
|
|
2549
2566
|
voiceErrorCode: "Error code {code}",
|
|
2550
2567
|
voiceRejectSimilar: "This sample is too similar to an existing recording. Use a different clean, original vocal.",
|
|
2551
2568
|
voiceRejectNotClean: "This is not a clean solo vocal. Use a recording of one voice without accompaniment or background noise.",
|
|
2552
|
-
voiceRejectOriginal: "Original reason: {reason}"
|
|
2569
|
+
voiceRejectOriginal: "Original reason: {reason}",
|
|
2570
|
+
voiceDropTitle: "Click or drop an audio file here",
|
|
2571
|
+
voiceFileAdvice: "A clean recording of one voice, 10–60 s, without accompaniment or background noise, works best.",
|
|
2572
|
+
voiceDropActive: "Release to add it",
|
|
2573
|
+
voiceDropFormats: "mp3 · wav · m4a · aac · flac · ogg, 6–60 s, up to 10 MB",
|
|
2574
|
+
voiceChangeFile: "Choose another",
|
|
2575
|
+
voiceMeasuring: "Measuring length…",
|
|
2576
|
+
voicePickFile: "Choose an audio file",
|
|
2577
|
+
voiceNameHint: "Up to {max} characters, only to tell your voices apart.",
|
|
2578
|
+
voiceNeedFile: "Choose an audio file first",
|
|
2579
|
+
voiceNeedName: "Enter a name for the voice",
|
|
2580
|
+
voiceListCount: "{count} in total",
|
|
2581
|
+
voiceLoadFailed: "The voice list could not be read",
|
|
2582
|
+
voiceUnsupportedTitle: "Voice profiles are not available yet",
|
|
2583
|
+
voiceRetry: "Try again",
|
|
2584
|
+
voiceWaitingGateway: "The gateway is processing, {seconds} s so far. A longer sample can take 1–3 minutes; keep this page open.",
|
|
2585
|
+
voiceConfirming: "The gateway did not answer in time. The voice may already exist; checking ({seconds} s so far)…",
|
|
2586
|
+
voiceUnconfirmed: "The gateway timed out. The voice may have been created there: refresh the list in a little while to check, and try again only if it is not there."
|
|
2553
2587
|
};
|
|
2554
2588
|
//#endregion
|
|
2555
2589
|
//#region src/client/AccountCenter/center-locales.ts
|
|
@@ -42,6 +42,20 @@ export declare const VOICE_SAMPLE_LIMITS: {
|
|
|
42
42
|
};
|
|
43
43
|
/** Longest profile title. */
|
|
44
44
|
export declare const VOICE_TITLE_MAX = 80;
|
|
45
|
+
/** How long the creation request may take: Suno can need well over a minute for a longer sample. */
|
|
46
|
+
export declare const VOICE_CREATE_TIMEOUT_MS = 180000;
|
|
47
|
+
/** How long the list is read for a profile whose creation ended without an answer. */
|
|
48
|
+
export declare const VOICE_CONFIRM_TIMEOUT_MS = 180000;
|
|
49
|
+
/**
|
|
50
|
+
* The creation's `Idempotency-Key`: the same sample under the same title always sends the same key, so a retry is the
|
|
51
|
+
* same operation to a gateway that deduplicates by it; a different title is a different profile.
|
|
52
|
+
* @param data - the sample's bytes.
|
|
53
|
+
* @param title - the checked title.
|
|
54
|
+
* @returns `vp-` and 32 hex digits.
|
|
55
|
+
*/
|
|
56
|
+
export declare function voiceIdempotencyKey(data: Uint8Array, title: string): string;
|
|
57
|
+
/** A creation whose outcome the client cannot know: no answer in time, no connection, or the gateway's 504. */
|
|
58
|
+
export declare function voiceOutcomeUnknown(error: unknown): boolean;
|
|
45
59
|
/** A profile's state: being made, usable, refused, or closed. */
|
|
46
60
|
export type VoiceProfileStatus = 'processing' | 'ready' | 'failed' | 'deleted';
|
|
47
61
|
/** Why a provider refused a voice sample, in words a person understands. */
|
|
@@ -137,6 +151,8 @@ export interface VoiceProfilesOptions {
|
|
|
137
151
|
/** Waits between status reads; a test seam. */
|
|
138
152
|
readonly sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
139
153
|
readonly now?: () => number;
|
|
154
|
+
/** How long a creation without an answer is confirmed from the list; {@link VOICE_CONFIRM_TIMEOUT_MS} by default. */
|
|
155
|
+
readonly confirmTimeoutMs?: number;
|
|
140
156
|
}
|
|
141
157
|
/** Per-request options: cancellation, and the account guard of the account center. */
|
|
142
158
|
export interface VoiceRequestOptions {
|
|
@@ -169,6 +185,13 @@ export declare class VoiceProfiles {
|
|
|
169
185
|
* @returns the profile as the gateway answered (often still being made).
|
|
170
186
|
*/
|
|
171
187
|
create(media: LoadedMedia, title: string, options?: VoiceRequestOptions): Promise<VoiceProfile>;
|
|
188
|
+
/**
|
|
189
|
+
* Find the profile a creation without an answer made: read the list (after 3 s, 5 s, then every 10 s, for up to
|
|
190
|
+
* three minutes) for an id that was not there before, the one under the same title first. Without the earlier list,
|
|
191
|
+
* only a profile under the same title counts.
|
|
192
|
+
* @throws {@link MediaError} `VOICE_PROFILE_UNCONFIRMED` (retryable, outcome unknown, nothing charged) when none appears.
|
|
193
|
+
*/
|
|
194
|
+
private confirmCreated;
|
|
172
195
|
/**
|
|
173
196
|
* Close one profile for good. Songs already made with it are not affected.
|
|
174
197
|
* @param id - a `vp_…` id.
|
package/lib/index.js
CHANGED
|
@@ -11824,6 +11824,23 @@ const VOICE_SAMPLE_LIMITS = {
|
|
|
11824
11824
|
"audio/ogg"
|
|
11825
11825
|
]
|
|
11826
11826
|
};
|
|
11827
|
+
/** How long the creation request may take: Suno can need well over a minute for a longer sample. */
|
|
11828
|
+
const VOICE_CREATE_TIMEOUT_MS = 18e4;
|
|
11829
|
+
/**
|
|
11830
|
+
* The creation's `Idempotency-Key`: the same sample under the same title always sends the same key, so a retry is the
|
|
11831
|
+
* same operation to a gateway that deduplicates by it; a different title is a different profile.
|
|
11832
|
+
* @param data - the sample's bytes.
|
|
11833
|
+
* @param title - the checked title.
|
|
11834
|
+
* @returns `vp-` and 32 hex digits.
|
|
11835
|
+
*/
|
|
11836
|
+
function voiceIdempotencyKey(data, title) {
|
|
11837
|
+
const sample = createHash("sha256").update(data).digest("hex");
|
|
11838
|
+
return `vp-${createHash("sha256").update(`${sample}\n${title}`).digest("hex").slice(0, 32)}`;
|
|
11839
|
+
}
|
|
11840
|
+
/** A creation whose outcome the client cannot know: no answer in time, no connection, or the gateway's 504. */
|
|
11841
|
+
function voiceOutcomeUnknown(error) {
|
|
11842
|
+
return error instanceof MediaError && (error.code === "GATEWAY_TIMEOUT" || error.code === "GATEWAY_UNREACHABLE" || error.details.status === 504);
|
|
11843
|
+
}
|
|
11827
11844
|
/**
|
|
11828
11845
|
* Provider refusals and what they mean, checked in order against the reason and the code (Suno refuses a sample that
|
|
11829
11846
|
* "matches an existing recording", for one). A reason none of them matches is shown as it came, scrubbed.
|
|
@@ -12126,12 +12143,16 @@ var VoiceProfiles = class {
|
|
|
12126
12143
|
submissionState: "not_submitted",
|
|
12127
12144
|
billingState: "not_charged"
|
|
12128
12145
|
});
|
|
12146
|
+
const before = await this.list(options).then((list) => new Set(list.map((item) => item.id)), (error) => {
|
|
12147
|
+
if (error instanceof MediaError && (error.code === "ABORTED" || error.code === "ACCOUNT_CHANGED")) throw error;
|
|
12148
|
+
});
|
|
12129
12149
|
let answer;
|
|
12130
12150
|
try {
|
|
12131
12151
|
answer = await this.options.http.json(VOICE_PROFILES_PATH, {
|
|
12132
12152
|
...this.request(options),
|
|
12153
|
+
timeoutMs: VOICE_CREATE_TIMEOUT_MS,
|
|
12133
12154
|
method: "POST",
|
|
12134
|
-
idempotencyKey:
|
|
12155
|
+
idempotencyKey: voiceIdempotencyKey(media.data, name),
|
|
12135
12156
|
busyRetries: 0,
|
|
12136
12157
|
json: {
|
|
12137
12158
|
model: VOICE_PROFILE_MODEL,
|
|
@@ -12140,6 +12161,13 @@ var VoiceProfiles = class {
|
|
|
12140
12161
|
}
|
|
12141
12162
|
});
|
|
12142
12163
|
} catch (error) {
|
|
12164
|
+
if (voiceOutcomeUnknown(error)) {
|
|
12165
|
+
const confirmed = await this.confirmCreated(before, name, options);
|
|
12166
|
+
return {
|
|
12167
|
+
...confirmed,
|
|
12168
|
+
...confirmed.durationSeconds === void 0 ? { durationSeconds: Math.round(measured * 10) / 10 } : {}
|
|
12169
|
+
};
|
|
12170
|
+
}
|
|
12143
12171
|
const rejection = error instanceof MediaError && (error.details.status ?? 0) >= 400 && (error.details.status ?? 0) < 500 ? voiceRejectionOf(error.message, error.code) : void 0;
|
|
12144
12172
|
if (rejection === void 0) throw error;
|
|
12145
12173
|
throw new MediaError(`${rejection.en} ${rejection.zh} (${scrubReason(error.message)}) No voice profile was created and nothing was charged.`, "VOICE_SAMPLE_REJECTED", {
|
|
@@ -12163,6 +12191,40 @@ var VoiceProfiles = class {
|
|
|
12163
12191
|
};
|
|
12164
12192
|
}
|
|
12165
12193
|
/**
|
|
12194
|
+
* Find the profile a creation without an answer made: read the list (after 3 s, 5 s, then every 10 s, for up to
|
|
12195
|
+
* three minutes) for an id that was not there before, the one under the same title first. Without the earlier list,
|
|
12196
|
+
* only a profile under the same title counts.
|
|
12197
|
+
* @throws {@link MediaError} `VOICE_PROFILE_UNCONFIRMED` (retryable, outcome unknown, nothing charged) when none appears.
|
|
12198
|
+
*/
|
|
12199
|
+
async confirmCreated(before, title, options) {
|
|
12200
|
+
const started = this.now();
|
|
12201
|
+
const limit = this.options.confirmTimeoutMs ?? 18e4;
|
|
12202
|
+
const steps = [3e3, 5e3];
|
|
12203
|
+
for (let round = 0;; round++) {
|
|
12204
|
+
const left = started + limit - this.now();
|
|
12205
|
+
if (left <= 0) break;
|
|
12206
|
+
await this.sleep(Math.min(steps[round] ?? 1e4, left), options.signal);
|
|
12207
|
+
let list;
|
|
12208
|
+
try {
|
|
12209
|
+
list = await this.list(options);
|
|
12210
|
+
} catch (error) {
|
|
12211
|
+
if (error instanceof MediaError && (error.code === "ABORTED" || error.code === "ACCOUNT_CHANGED")) throw error;
|
|
12212
|
+
continue;
|
|
12213
|
+
}
|
|
12214
|
+
const fresh = list.filter((item) => before === void 0 ? item.title === title : !before.has(item.id));
|
|
12215
|
+
const found = fresh.find((item) => item.title === title) ?? fresh[0];
|
|
12216
|
+
if (found !== void 0) return found;
|
|
12217
|
+
}
|
|
12218
|
+
throw new MediaError("The VibeDev gateway did not answer in time while creating the voice profile. It may have been created on the gateway: refresh the list in a little while to check, and try again only if it is not there. 网关处理超时。可能已在网关侧创建,请稍后刷新列表确认;若列表没有,再重试。", "VOICE_PROFILE_UNCONFIRMED", {
|
|
12219
|
+
category: "submission_uncertain",
|
|
12220
|
+
stage: "submit",
|
|
12221
|
+
retryable: true,
|
|
12222
|
+
submissionState: "unknown",
|
|
12223
|
+
billingState: "not_charged",
|
|
12224
|
+
retryAction: "reconcile"
|
|
12225
|
+
});
|
|
12226
|
+
}
|
|
12227
|
+
/**
|
|
12166
12228
|
* Close one profile for good. Songs already made with it are not affected.
|
|
12167
12229
|
* @param id - a `vp_…` id.
|
|
12168
12230
|
*/
|
|
@@ -17175,7 +17237,7 @@ const LIMITS = `${VOICE_SAMPLE_LIMITS.minSeconds}–${VOICE_SAMPLE_LIMITS.maxSec
|
|
|
17175
17237
|
function voiceProfileCreateTool(runtime, profiles) {
|
|
17176
17238
|
return defineTool({
|
|
17177
17239
|
name: "voice_profile_create",
|
|
17178
|
-
description: "Create a VibeDev voice profile (音色) from a recording of the user's own singing voice, for Suno voice covers (audio_generate voice_id). Free: it makes no song and charges nothing. The sample must be " + LIMITS + "; it is checked, uploaded to the VibeDev media library and submitted, and the call waits until the profile is ready or failed. The result is a vp_… id — the only form of voice id that exists for the user; never ask for or pass any other voice id. Only create one when the user asks, from audio they have the right to use. Do not promise that a profile is kept forever.",
|
|
17240
|
+
description: "Create a VibeDev voice profile (音色) from a recording of the user's own singing voice, for Suno voice covers (audio_generate voice_id). Free: it makes no song and charges nothing. The sample must be " + LIMITS + "; it is checked, uploaded to the VibeDev media library and submitted, and the call waits until the profile is ready or failed (creation can take 2–3 minutes; when the gateway does not answer in time the list is checked for the new profile before anything is reported). The result is a vp_… id — the only form of voice id that exists for the user; never ask for or pass any other voice id. Only create one when the user asks, from audio they have the right to use. Do not promise that a profile is kept forever.",
|
|
17179
17241
|
parameters: {
|
|
17180
17242
|
source: {
|
|
17181
17243
|
type: "string",
|
|
@@ -17205,7 +17267,7 @@ function voiceProfileCreateTool(runtime, profiles) {
|
|
|
17205
17267
|
text: value.message
|
|
17206
17268
|
}]
|
|
17207
17269
|
},
|
|
17208
|
-
timeoutMs:
|
|
17270
|
+
timeoutMs: 6e5,
|
|
17209
17271
|
async execute(args, exec) {
|
|
17210
17272
|
const title = checkVoiceTitle(args.title);
|
|
17211
17273
|
const media = await runtime.load(exec, args.source, "audio", VOICE_SAMPLE_LIMITS.maxBytes);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibedev-si/dsh-vibedev",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.4",
|
|
4
4
|
"description": "VibeDev 账号与模型:在 DeepSeek Harness 里登录 VibeDev,与 DeepSeek 账号并存,使用 VibeDev 网关的模型(Claude、GPT 等),并生成图片、视频、音乐和播客 · VibeDev account and models for DeepSeek Harness: sign in to VibeDev next to the DeepSeek account and use the VibeDev gateway's models (Claude, GPT and more), plus image, video, music and podcast generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|