dsh-music-player 0.3.3 → 0.3.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/lib/index.js +5 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -580,6 +580,9 @@ export function apply(ctx) {
|
|
|
580
580
|
// Reuse the api key the user already configured in DSH. DSH stores configured
|
|
581
581
|
// provider keys in ~/.dsh/.credentials.yaml keyed by the same name as
|
|
582
582
|
// settings.yaml's apiKeyEnv, so read it there (falling back to a real env var).
|
|
583
|
+
// Since DSH v1 the file nests keys under a refs: block (two-space indent,
|
|
584
|
+
// root "version: 1"); older builds used a flat layout with keys at column 0.
|
|
585
|
+
// Allow leading whitespace so both layouts resolve.
|
|
583
586
|
const readCredential = async (envName) => {
|
|
584
587
|
if (!envName) return null
|
|
585
588
|
if (process.env[envName]) return process.env[envName]
|
|
@@ -588,7 +591,7 @@ export function apply(ctx) {
|
|
|
588
591
|
if (file === null || !existsSync(file)) return null
|
|
589
592
|
const lines = readFileSync(file, 'utf8').split(/\r?\n/)
|
|
590
593
|
for (const ln of lines) {
|
|
591
|
-
const m = new RegExp('
|
|
594
|
+
const m = new RegExp('^\\s*' + envName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '\\s*[:=]\\s*(.+?)\\s*$').exec(ln)
|
|
592
595
|
if (m) return m[1]
|
|
593
596
|
}
|
|
594
597
|
return null
|
|
@@ -672,7 +675,7 @@ export function apply(ctx) {
|
|
|
672
675
|
// Synthesize a chunk of prose into a Buffer of wav audio (non-streaming, format=wav).
|
|
673
676
|
const synthesize = async (text, voice) => {
|
|
674
677
|
const { baseURL, key } = await resolveTts()
|
|
675
|
-
if (!key) throw new Error('未配置 xiaomi/MiMo
|
|
678
|
+
if (!key) throw new Error('未配置 xiaomi/MiMo 提供方(缺少 api key)')
|
|
676
679
|
const body = {
|
|
677
680
|
model: MIMO_DEFAULT_MODEL,
|
|
678
681
|
messages: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-music-player",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "DeepSeek Harness 本地音乐 + AI 讲书插件:Host 扫描音乐目录并以 HTTP 流式提供音频、解析 .txt 小说结构并经 MiMo TTS 合成朗读,浏览器侧提供播放条/播放面板/章节目录跳转/多声音选择/实时频谱,并注册 music_play 模型工具",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|