@eslaykey/dsh-breeze-tts 1.0.0 → 1.0.1
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/CHANGELOG.md +28 -18
- package/client.js +91 -1
- package/index.js +25 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project are documented here.
|
|
4
|
-
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), versioning follows [SemVer](https://semver.org/).
|
|
5
|
-
|
|
6
|
-
## [Unreleased]
|
|
7
|
-
|
|
8
|
-
## [1.0.
|
|
9
|
-
|
|
10
|
-
### Added
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here.
|
|
4
|
+
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), versioning follows [SemVer](https://semver.org/).
|
|
5
|
+
|
|
6
|
+
## [Unreleased]
|
|
7
|
+
|
|
8
|
+
## [1.0.1] - 2026-10-30
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- API key binding directly in the settings page: paste a key, validate it against the account balance, and disconnect when needed
|
|
12
|
+
- Built-in tone names are localized (English UI shows Natural / Warm / Formal / Lively)
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- Emotion tags were counted against the auto-speak character limit and could be spoken aloud
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## [1.0.0] - 2026-10-30
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- Three agent tools: `tts_speak`, `tts_voices`, `tts_status`
|
|
22
|
+
- Settings page: voice, delivery preset, preview line, daily character limit, balance, usage bar
|
|
23
|
+
- One-click "read this reply" action on every finalized assistant message
|
|
24
|
+
- Auto-speak for replies within a configurable character limit (off by default)
|
|
25
|
+
- Voice design: generate three candidates from a text description, audition and save
|
|
26
|
+
- Sentence-level language detection so mixed Chinese/English text keeps the right accent
|
|
27
|
+
- Six built-in public voices across gender, age and accent
|
|
28
|
+
- Localized error messages with an API code map (auth, rate limit, credits, validation, daily quota)
|
package/client.js
CHANGED
|
@@ -10,6 +10,8 @@ window.__ModuleLoader__.load({
|
|
|
10
10
|
zh: {
|
|
11
11
|
meta: { title: 'Breeze 语音朗读', description: '用 Breeze Blue 把文字念出来。' },
|
|
12
12
|
section: { title: '语音朗读', subtitle: 'Breeze Blue · 文字转语音' },
|
|
13
|
+
tone: { normal: '自然', warm: '温和', formal: '正式', lively: '活泼' },
|
|
14
|
+
|
|
13
15
|
err: {
|
|
14
16
|
auth: 'API key 无效或已失效,请重新填写',
|
|
15
17
|
rate: '请求太频繁,稍等几秒再试',
|
|
@@ -31,6 +33,14 @@ window.__ModuleLoader__.load({
|
|
|
31
33
|
autoSpeakHint: '对字数不超过设定值的新回复自动朗读,默认关闭',
|
|
32
34
|
renameBlocked: '内置音色和公开音色不能重命名',
|
|
33
35
|
voiceManageHint: '只有你自己生成的音色可以在这里改名或删除',
|
|
36
|
+
apiKey: 'API Key',
|
|
37
|
+
keyBound: '已连接',
|
|
38
|
+
keyMissing: '尚未连接,填入 Breeze 的 API key 后点连接',
|
|
39
|
+
keyRequired: '请先填入 API key',
|
|
40
|
+
keyConnected: '连接成功',
|
|
41
|
+
keyDisconnected: '已断开',
|
|
42
|
+
connect: '连接',
|
|
43
|
+
disconnect: '断开',
|
|
34
44
|
cloneNotice: '本插件不提供音色克隆。需要克隆自己的声音,请到 Breeze 官网的音色库创建,克隆好的音色会自动出现在上面的列表里。',
|
|
35
45
|
renameVoice: '重命名',
|
|
36
46
|
renamePlaceholder: '新的音色名称',
|
|
@@ -103,6 +113,8 @@ window.__ModuleLoader__.load({
|
|
|
103
113
|
en: {
|
|
104
114
|
meta: { title: 'Breeze Voice', description: 'Read text aloud with Breeze Blue.' },
|
|
105
115
|
section: { title: 'Voice', subtitle: 'Breeze Blue · text to speech' },
|
|
116
|
+
tone: { normal: 'Natural', warm: 'Warm', formal: 'Formal', lively: 'Lively' },
|
|
117
|
+
|
|
106
118
|
err: {
|
|
107
119
|
auth: 'The API key is invalid or expired. Please enter it again.',
|
|
108
120
|
rate: 'Too many requests. Wait a few seconds and retry.',
|
|
@@ -120,6 +132,14 @@ window.__ModuleLoader__.load({
|
|
|
120
132
|
status: { ready: 'Ready', missingKey: 'Missing API key', credits: 'credits', chars: 'chars' },
|
|
121
133
|
hint: { key: 'Write the Breeze API key into apiKey of ~/.dsh/breeze.json.', limit: 'Synthesis is refused past the limit so credits cannot run away.' },
|
|
122
134
|
extra: {
|
|
135
|
+
apiKey: 'API key',
|
|
136
|
+
keyBound: 'Connected',
|
|
137
|
+
keyMissing: 'Not connected. Paste your Breeze API key and press Connect.',
|
|
138
|
+
keyRequired: 'Enter an API key first',
|
|
139
|
+
keyConnected: 'Connected',
|
|
140
|
+
keyDisconnected: 'Disconnected',
|
|
141
|
+
connect: 'Connect',
|
|
142
|
+
disconnect: 'Disconnect',
|
|
123
143
|
autoSpeak: 'Auto speak',
|
|
124
144
|
autoSpeakHint: 'Automatically read new replies within the configured character limit. Off by default.',
|
|
125
145
|
renameBlocked: 'Built-in and public voices cannot be renamed',
|
|
@@ -701,6 +721,8 @@ function cleanForSpeech(text) {
|
|
|
701
721
|
const [voiceRenameOpen, setVoiceRenameOpen] = React.useState(false)
|
|
702
722
|
const [voiceNameDraft, setVoiceNameDraft] = React.useState('')
|
|
703
723
|
const [designName, setDesignName] = React.useState('')
|
|
724
|
+
const [apiKeyInput, setApiKeyInput] = React.useState('')
|
|
725
|
+
const [connectNote, setConnectNote] = React.useState(null)
|
|
704
726
|
const [voiceNames, setVoiceNames] = React.useState({})
|
|
705
727
|
const [libraryOpen, setLibraryOpen] = React.useState(false)
|
|
706
728
|
const [libraryQuery, setLibraryQuery] = React.useState('')
|
|
@@ -752,6 +774,45 @@ function cleanForSpeech(text) {
|
|
|
752
774
|
const used = data && data.today ? data.today.chars : 0
|
|
753
775
|
const limit = data && data.today ? data.today.limit : dailyChars
|
|
754
776
|
|
|
777
|
+
const connectKey = async () => {
|
|
778
|
+
const key = apiKeyInput.trim()
|
|
779
|
+
if (!key) {
|
|
780
|
+
setConnectNote({ tone: 'error', text: t('extra.keyRequired') })
|
|
781
|
+
return
|
|
782
|
+
}
|
|
783
|
+
setPhase('connect')
|
|
784
|
+
setConnectNote(null)
|
|
785
|
+
try {
|
|
786
|
+
const result = await api('/connect', {
|
|
787
|
+
method: 'POST',
|
|
788
|
+
headers: { 'content-type': 'application/json' },
|
|
789
|
+
body: JSON.stringify({ apiKey: key }),
|
|
790
|
+
})
|
|
791
|
+
setApiKeyInput('')
|
|
792
|
+
setConnectNote({
|
|
793
|
+
tone: 'ok',
|
|
794
|
+
text: t('extra.keyConnected') + (typeof result.balance === 'number' ? ' · ' + result.balance.toFixed(1) + ' ' + t('status.credits') : ''),
|
|
795
|
+
})
|
|
796
|
+
reload()
|
|
797
|
+
} catch (error) {
|
|
798
|
+
setConnectNote({ tone: 'error', text: humanError(t, error) })
|
|
799
|
+
}
|
|
800
|
+
setPhase('idle')
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
const disconnectKey = async () => {
|
|
804
|
+
setPhase('disconnect')
|
|
805
|
+
setConnectNote(null)
|
|
806
|
+
try {
|
|
807
|
+
await api('/disconnect', { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' })
|
|
808
|
+
setConnectNote({ tone: 'muted', text: t('extra.keyDisconnected') })
|
|
809
|
+
reload()
|
|
810
|
+
} catch (error) {
|
|
811
|
+
setConnectNote({ tone: 'error', text: humanError(t, error) })
|
|
812
|
+
}
|
|
813
|
+
setPhase('idle')
|
|
814
|
+
}
|
|
815
|
+
|
|
755
816
|
const preview = async () => {
|
|
756
817
|
setPhase('preview')
|
|
757
818
|
setNotice('')
|
|
@@ -1063,6 +1124,34 @@ function cleanForSpeech(text) {
|
|
|
1063
1124
|
state.error ? h('p', { className: 'dsh-breeze-hint', style: { color: COLOR.error } }, state.error) : null,
|
|
1064
1125
|
|
|
1065
1126
|
h('div', { style: { display: 'flex', flexDirection: 'column' } },
|
|
1127
|
+
row(t('extra.apiKey'),
|
|
1128
|
+
h('input', {
|
|
1129
|
+
className: 'dsh-breeze-control',
|
|
1130
|
+
style: { flex: 1, minWidth: 220, maxWidth: 360 },
|
|
1131
|
+
type: 'password',
|
|
1132
|
+
placeholder: data && data.hasKey ? t('extra.keyBound') : 'brz_...',
|
|
1133
|
+
value: apiKeyInput,
|
|
1134
|
+
onChange: (event) => setApiKeyInput(event.target.value),
|
|
1135
|
+
}),
|
|
1136
|
+
h('button', {
|
|
1137
|
+
type: 'button', className: 'dsh-breeze-btn', 'data-primary': 'true',
|
|
1138
|
+
onClick: connectKey, disabled: phase === 'connect',
|
|
1139
|
+
}, phase === 'connect' ? Spinner(12) : t('extra.connect')),
|
|
1140
|
+
data && data.hasKey
|
|
1141
|
+
? h('button', {
|
|
1142
|
+
type: 'button', className: 'dsh-breeze-btn',
|
|
1143
|
+
onClick: disconnectKey, disabled: phase === 'disconnect',
|
|
1144
|
+
}, t('extra.disconnect'))
|
|
1145
|
+
: null,
|
|
1146
|
+
h('span', {
|
|
1147
|
+
style: {
|
|
1148
|
+
fontSize: 12,
|
|
1149
|
+
color: connectNote
|
|
1150
|
+
? (connectNote.tone === 'error' ? COLOR.error : connectNote.tone === 'ok' ? COLOR.success : COLOR.secondary)
|
|
1151
|
+
: COLOR.secondary,
|
|
1152
|
+
},
|
|
1153
|
+
}, connectNote ? connectNote.text : (data && data.hasKey ? t('extra.keyBound') : t('extra.keyMissing')))),
|
|
1154
|
+
|
|
1066
1155
|
row(t('label.voice'),
|
|
1067
1156
|
h('select', {
|
|
1068
1157
|
className: 'dsh-breeze-control',
|
|
@@ -1170,7 +1259,8 @@ function cleanForSpeech(text) {
|
|
|
1170
1259
|
onChange: (event) => setMoodId(event.target.value),
|
|
1171
1260
|
},
|
|
1172
1261
|
tones.map((tone) => h('option', { key: tone.id, value: tone.id },
|
|
1173
|
-
|
|
1262
|
+
(tone.builtin ? t('tone.' + tone.id) : tone.name)
|
|
1263
|
+
+ (tone.builtin ? '' : ' · ' + t('extra.customTag'))))),
|
|
1174
1264
|
h('button', { type: 'button', className: 'dsh-breeze-btn', onClick: startNewTone }, t('extra.newTone')),
|
|
1175
1265
|
activeTone && !activeTone.builtin
|
|
1176
1266
|
? h('button', { type: 'button', className: 'dsh-breeze-btn', onClick: startEditTone }, t('extra.editTone'))
|
package/index.js
CHANGED
|
@@ -687,6 +687,7 @@ export function apply(ctx, config) {
|
|
|
687
687
|
}
|
|
688
688
|
return json(200, {
|
|
689
689
|
ok: Boolean(s.apiKey) && !error,
|
|
690
|
+
hasKey: Boolean(s.apiKey),
|
|
690
691
|
voiceId: s.voiceId,
|
|
691
692
|
modelId: s.modelId,
|
|
692
693
|
moodId: s.moodId ?? 'normal',
|
|
@@ -906,6 +907,30 @@ export function apply(ctx, config) {
|
|
|
906
907
|
if (st5.voiceId === voiceId) await writeStore({ voiceId: 'voc_rc894j8q2auu' })
|
|
907
908
|
return json(200, { ok: true, voiceId })
|
|
908
909
|
}
|
|
910
|
+
if (route === '/connect' && req.method === 'POST') {
|
|
911
|
+
const body = await readBody()
|
|
912
|
+
const key = String(body.apiKey ?? '').trim()
|
|
913
|
+
if (!key) return json(400, { ok: false, error: 'api key required' })
|
|
914
|
+
try {
|
|
915
|
+
const balance = await callApi('/balance', { apiKey: key })
|
|
916
|
+
await writeStore({ apiKey: key })
|
|
917
|
+
return json(200, { ok: true, balance: balance.balance ?? null })
|
|
918
|
+
} catch (caught) {
|
|
919
|
+
return json(400, {
|
|
920
|
+
ok: false,
|
|
921
|
+
error: caught instanceof Error ? caught.message : String(caught),
|
|
922
|
+
code: caught && caught.code ? String(caught.code) : '',
|
|
923
|
+
status: caught && caught.status ? Number(caught.status) : 0,
|
|
924
|
+
})
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
if (route === '/disconnect' && req.method === 'POST') {
|
|
928
|
+
const store = await readStore()
|
|
929
|
+
delete store.apiKey
|
|
930
|
+
delete store.api_key
|
|
931
|
+
await writeFile(SETTINGS_PATH, JSON.stringify(store, null, 2), 'utf8')
|
|
932
|
+
return json(200, { ok: true })
|
|
933
|
+
}
|
|
909
934
|
if (route === '/settings' && req.method === 'POST') {
|
|
910
935
|
const body = await readBody()
|
|
911
936
|
const patch = {}
|
package/package.json
CHANGED