dsh-ai-subtitle 0.4.0 → 0.4.2

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/client.js CHANGED
@@ -10,7 +10,7 @@ window.__ModuleLoader__.load({
10
10
  const PANEL_ID = 'subtitle-studio-panel'
11
11
  const API = '/dsh-ai-subtitle/api'
12
12
  // Bump whenever the bundle needs to be distinguishable in the running page.
13
- const BUILD = 'ui-2026-12-06c'
13
+ const BUILD = 'ui-2026-12-06e'
14
14
  function trace(message) {
15
15
  try {
16
16
  const payload = JSON.stringify({ msg: String(message).slice(0, 300) })
@@ -25,6 +25,8 @@ window.__ModuleLoader__.load({
25
25
  }
26
26
  }
27
27
 
28
+ const shortPath = (value) => String(value || "").split(/[\\/]/).filter(Boolean).pop() || String(value || "")
29
+
28
30
  const MOUNT_GUARD = { start: 0, count: 0 }
29
31
  /** Stop rendering when the panel is remounted in a loop, which freezes the page. */
30
32
  function mountAllowed() {
@@ -939,8 +941,9 @@ window.__ModuleLoader__.load({
939
941
  setNotice('导出失败:' + result.error)
940
942
  return
941
943
  }
942
- const renamed = result.backup ? ';旧字幕已改名为 ' + result.backup : ''
943
- setNotice('已导出 ' + result.stats.cues + ' 条字幕:' + result.out + renamed)
944
+ const renamed = result.backup ? ';旧字幕改名为 ' + shortPath(result.backup) : ''
945
+ const where = location === 'video' ? '视频目录' : '项目目录'
946
+ setNotice('已导出 ' + result.stats.cues + ' 条字幕到' + where + ':' + shortPath(result.out) + renamed)
944
947
  refresh()
945
948
  }
946
949
 
@@ -1250,8 +1253,9 @@ window.__ModuleLoader__.load({
1250
1253
  setNotice('导出失败:' + result.error + (result.details ? '(' + result.details.join('; ') + ')' : ''))
1251
1254
  return
1252
1255
  }
1253
- const renamed = result.backup ? ';旧字幕已改名为 ' + result.backup : ''
1254
- setNotice('已导出:' + result.out + '(' + result.stats.cues + ' 条)' + renamed)
1256
+ const renamed = result.backup ? ';旧字幕改名为 ' + shortPath(result.backup) : ''
1257
+ const where = location === 'video' ? '视频目录' : '项目目录'
1258
+ setNotice('已导出 ' + result.stats.cues + ' 条字幕到' + where + ':' + shortPath(result.out) + renamed)
1255
1259
  openProject(detail)
1256
1260
  refresh()
1257
1261
  }
@@ -2416,8 +2420,18 @@ window.__ModuleLoader__.load({
2416
2420
  })
2417
2421
  : null,
2418
2422
 
2419
- notice ? h('div', { style: { ...code, marginTop: 4 } }, notice) : null,
2420
- error ? h('div', { style: { ...code, color: tokens.danger, marginTop: 4 } }, '接口错误:' + error) : null,
2423
+ h(
2424
+ 'div',
2425
+ { style: { minHeight: 18, marginTop: 4 } },
2426
+ notice
2427
+ ? h(
2428
+ 'div',
2429
+ { style: { ...code, maxWidth: '100%', whiteSpace: 'pre-wrap', overflowWrap: 'anywhere', wordBreak: 'break-word', userSelect: 'text' } },
2430
+ notice,
2431
+ )
2432
+ : null,
2433
+ error ? h('div', { style: { ...code, color: tokens.danger } }, '接口错误:' + error) : null,
2434
+ ),
2421
2435
  )
2422
2436
  }
2423
2437
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ai-subtitle",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Japanese video to bilingual JP/zh subtitles inside DeepSeek Harness: a self-installing ffmpeg, Python and Whisper runtime, cue editing and SRT export.",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/python/worker.py CHANGED
@@ -80,7 +80,7 @@ def speech_regions(audio, rate=16000, frame_ms=20, min_speech=0.18, min_gap=0.45
80
80
  return result
81
81
 
82
82
 
83
- def split_long(audio, start_s, end_s, rate=16000, limit=28.0):
83
+ def split_long(audio, start_s, end_s, rate=16000, limit=12.0):
84
84
  """Split a region longer than the model window at its quietest frame."""
85
85
  if end_s - start_s <= limit:
86
86
  return [(start_s, end_s)]
package/src/resplit.js CHANGED
@@ -32,7 +32,7 @@ export function buildResplitPrompt(cue) {
32
32
  return PROMPT.replace('{jp}', String(cue.jp || '')).replace('{zh}', String(cue.zh || ''))
33
33
  }
34
34
 
35
- /** Parse "1|日文|中文" lines; returns [] when the reply is unusable. */
35
+ /** Parse "1|jp|zh" lines; returns [] when the reply is unusable. */
36
36
  export function parseResplit(text) {
37
37
  const rows = []
38
38
  for (const raw of String(text || '').split(/\r?\n/)) {