dsh-video-insight 0.9.0 → 0.10.0
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 +7 -5
- package/client/client.js +685 -104
- package/lib/index.js +2 -2
- package/lib/jobs.js +5 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](LICENSE)
|
|
4
4
|
[](https://github.com/deepseek-ai)
|
|
5
5
|
[](#已知限制)
|
|
6
|
-
[](package.json)
|
|
7
7
|
|
|
8
8
|

|
|
9
9
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
兜底有三档:**本机 Whisper / SenseVoice 转写**(可选引擎、线程、只转前 N 秒),音频全程不出这台电脑;**纯无声/纯画面视频**(没有配音也没有字幕)还能抽帧做**画面文字识别(OCR)**,甚至直接把画面交给**视觉模型**描述场景、人物和动作(「画面理解」,会用到支持图片输入的模型),把画面内容变成带时间戳的文字稿,摘要仍用你 profile 里的模型。
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
粘贴链接那一刻就进**后台队列**:首页历史里每条视频会显示解析进度条,「全部解析」把还没分析完的历史一次性排进队列(默认**不限制并发**,提交几个就跑几个;`jobs.concurrency` 设成正数可限制上限)。详情页只等元信息就打开,总结、章节、导图、分镜都等后台任务跑完自动回填,切走或回首页都不影响。,一条任务从头跑完 总结 → 思维导图 → 分镜 →(可选)画面描述,不用再切页签逐个点「生成」。状态只存在内存里,分析结果照常落盘。
|
|
15
15
|
|
|
16
16
|
追问是 **RAG(检索增强)**:先把问题在转写稿里做 BM25 检索,只把最相关的几段(带时间戳)连同对话一起喂给模型,回答里标 `[mm:ss]`,气泡下面还有「依据」按钮,点一下直接跳回那段视频。
|
|
17
17
|
|
|
@@ -23,11 +23,13 @@
|
|
|
23
23
|
|
|
24
24
|
入口在左侧栏的面板列表(`sidebar.panellist`,`order: 30`,排在默认条目之后,可按需调整)。图标是粉色播放键 + 星芒。
|
|
25
25
|
|
|
26
|
-
首页是 Google 式的**居中大输入框 +
|
|
26
|
+
首页是 Google 式的**居中大输入框 + 解析按钮**(粘贴链接回车即可),下面给三个真实示例(TED 演讲 / 哔哩哔哩科普 / 无字幕动画),点一下就能看完整效果;「最近分析」是**卡片流**:封面、时长、标题、作者,以及总结/章节/导图状态徽标,卡片右上 `⋯` 可以重新解析、复制链接、收藏或删除(历史区自己内联滚动,不带动整页)。解析出视频后才出现顶部的小号输入条,方便随时换一个链接。
|
|
27
|
+
|
|
28
|
+
面板顶部还有**全局任务条**:只要有视频在后台解析就常驻显示「解析队列 3/8 · 正在写总结 42%」,点「展开」是任务抽屉(运行中可取消、失败可重试、完成可打开,底部一键清除已完成)。详情页工具栏分两层:第一层是返回/封面/标题/重新生成▾/导出▾/历史/设置,第二层元信息(作者、时长、发布、播放数据)可收起。页签标题后面有小状态点:实心=已生成、呼吸=生成中、空心=还没生成。
|
|
27
29
|
|
|
28
30
|
| 页签 | 做什么 |
|
|
29
31
|
| --- | --- |
|
|
30
|
-
| 总结 |
|
|
32
|
+
| 总结 | 解析完自动流式生成,**首屏是卡片化阅读**:一句话总结大卡 + 核心观点 / 适合谁看 / 值得记住的说法三张小卡,内容脉络与关键要点折叠在后面(点开可读全文);结构固定为 一句话总结 / 核心观点 / 内容脉络 / 关键要点 / 值得记住的说法 / 适合谁看,引用带 `[mm:ss]` 时间戳——**正文里的时间戳也可点击,点一下播放器跳到该时间点继续播放**。正文末尾还让模型顺手给出 **3 条「继续追问」**(只对本期内容成立的具体问题),host 会把它从正文里剥出来、单存成 `suggestions`,面板在追问空态里渲染成带虚线的 chip |
|
|
31
33
|
| 章节 | 章节大纲**以思维导图的一级节点为准**(`GET /outline`;导图节点带时间点,直接作为章节起点),导图还没生成时退回模型按时间轴切的章节、视频自带章节或分 P;每行带一张 `GET /thumb` 章节缩略图,点行跳转到该章并继续播放,播放时当前章节高亮 |
|
|
32
34
|
| 原文 | 字幕逐段列表(`[mm:ss] 文本`),可搜索过滤、点单条复制、一键复制全文;「双语」开关把每段翻译成中文/英文(`POST /translate`,按批送模型、结果按视频缓存),开启「跟随」后播放器播到哪、对应段落就高亮滚到视野里(时间轴同步由播放器外壳每秒回传) |
|
|
33
35
|
| 思维导图 | 模型把字幕整理成 3 层树状大纲(`GET /mindmap`,带缓存),面板渲染成 **SVG 图形化横向树**(节点卡片 + 贝塞尔连线、按分支配色),点节点折叠/展开,支持全部展开/收起、缩放、重新生成;节点上带可点的时间徽标(模型按字幕定位),点一下跳到视频对应位置 |
|
|
@@ -233,7 +235,7 @@ host 半零外部依赖(只用 Node 内置 `fetch`/`crypto`),不写锁文
|
|
|
233
235
|
visionPack: sheet # sheet=多帧拼一张分镜图(默认,省图省时)| frames=逐帧发
|
|
234
236
|
sheetCols: 3 # 分镜图列数(行数按帧数自动算)
|
|
235
237
|
jobs:
|
|
236
|
-
concurrency:
|
|
238
|
+
concurrency: 0 # 后台解析并发数:0 = 不限制(默认),>0 限制上限(最大 16)
|
|
237
239
|
```
|
|
238
240
|
|
|
239
241
|
面板「设置」里保存的 Cookie 与本地转写配置都写在 `~/.dsh/video-credentials.json`,**优先级高于**行配置,改完立即生效。
|
package/client/client.js
CHANGED
|
@@ -16,6 +16,7 @@ window.__ModuleLoader__.load({
|
|
|
16
16
|
|
|
17
17
|
const PANEL_ID = 'video';
|
|
18
18
|
const PLAYER_KEY = 'dsh-video.player.collapsed';
|
|
19
|
+
const META_KEY = 'dsh-video.meta.collapsed';
|
|
19
20
|
const HISTORY_LIMIT = 100;
|
|
20
21
|
const HOME_RECENT_LIMIT = 10;
|
|
21
22
|
const SEGMENT_LIMIT = 400;
|
|
@@ -75,6 +76,12 @@ window.__ModuleLoader__.load({
|
|
|
75
76
|
en: 'English', 'en-us': 'English', 'en-gb': 'English', ja: '日本語', ko: '한국어',
|
|
76
77
|
};
|
|
77
78
|
const TABS = [['summary', '总结'], ['chapters', '章节'], ['transcript', '原文'], ['storyboard', '分镜'], ['mindmap', '思维导图']];
|
|
79
|
+
/** 首页示例链接:点一下直接解析。 */
|
|
80
|
+
const HOME_EXAMPLES = [
|
|
81
|
+
['TED 演讲 · 24min', 'https://www.youtube.com/watch?v=iG9CE55wbtY'],
|
|
82
|
+
['哔哩哔哩科普 · 16min', 'https://www.bilibili.com/video/BV14Asw6jE1J'],
|
|
83
|
+
['无字幕动画 · 10min', 'https://www.youtube.com/watch?v=aqz-KE-bpKQ'],
|
|
84
|
+
];
|
|
78
85
|
const ASK_EXAMPLES = ['这个视频最核心的论点是什么?', '作者的观点有哪些可疑之处?', '用 5 句话讲给完全不懂的人听'];
|
|
79
86
|
|
|
80
87
|
function platformMeta(platform) {
|
|
@@ -353,6 +360,17 @@ window.__ModuleLoader__.load({
|
|
|
353
360
|
try { return window.localStorage.getItem(PLAYER_KEY) === '1'; }
|
|
354
361
|
catch { return false; }
|
|
355
362
|
}
|
|
363
|
+
|
|
364
|
+
/** 元信息行是否折叠(localStorage 记忆,默认展开)。 */
|
|
365
|
+
function readMetaCollapsed() {
|
|
366
|
+
try { return window.localStorage.getItem(META_KEY) === '1'; }
|
|
367
|
+
catch { return false; }
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function writeMetaCollapsed(collapsed) {
|
|
371
|
+
try { window.localStorage.setItem(META_KEY, collapsed ? '1' : '0'); }
|
|
372
|
+
catch { /* 忽略隐私模式等异常 */ }
|
|
373
|
+
}
|
|
356
374
|
function writePlayerCollapsed(collapsed) {
|
|
357
375
|
try { window.localStorage.setItem(PLAYER_KEY, collapsed ? '1' : '0'); }
|
|
358
376
|
catch { /* 隐私模式 / 配额满:只影响记住折叠状态 */ }
|
|
@@ -716,10 +734,41 @@ window.__ModuleLoader__.load({
|
|
|
716
734
|
]);
|
|
717
735
|
}
|
|
718
736
|
|
|
737
|
+
/* ------------------------------------------------------------ 统一状态组件 */
|
|
738
|
+
|
|
739
|
+
/** 统一空态:标题 + 说明 + 可选操作。 */
|
|
740
|
+
function EmptyState({ title, note, action }) {
|
|
741
|
+
return h('div', { className: 'dvv-state dvv-state-empty' }, [
|
|
742
|
+
h('div', { key: 't', className: 'dvv-state-title' }, title || '暂无内容'),
|
|
743
|
+
note ? h('div', { key: 'n', className: 'dvv-state-note' }, note) : null,
|
|
744
|
+
action || null,
|
|
745
|
+
].filter(Boolean));
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
/** 统一骨架屏:若干行 shimmer。 */
|
|
749
|
+
function Skeleton({ rows, note }) {
|
|
750
|
+
const count = Number(rows) > 0 ? Math.floor(Number(rows)) : 6;
|
|
751
|
+
return h('div', { className: 'dvv-state dvv-state-loading', 'aria-busy': 'true' }, [
|
|
752
|
+
h('div', { key: 'skel', className: 'dvv-skel-lines' }, Array.from({ length: count }, (_, index) =>
|
|
753
|
+
h('div', { key: index, className: 'dvv-skel', style: { width: `${92 - (index % 3) * 12}%` } }))),
|
|
754
|
+
note ? h('div', { key: 'n', className: 'dvv-state-note' }, note) : null,
|
|
755
|
+
].filter(Boolean));
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/** 统一错误态:中文信息 + 重试按钮。 */
|
|
759
|
+
function ErrorState({ text, onRetry, retryLabel }) {
|
|
760
|
+
return h('div', { className: 'dvv-state dvv-state-error' }, [
|
|
761
|
+
h('div', { key: 't', className: 'dvv-state-title' }, '出错了'),
|
|
762
|
+
h('div', { key: 'n', className: 'dvv-state-note' }, String(text || '请求失败,请稍后重试。')),
|
|
763
|
+
onRetry ? h('div', { key: 'a', className: 'dvv-actions' },
|
|
764
|
+
h('button', { type: 'button', className: 'dvv-btn', onClick: onRetry }, retryLabel || '重试')) : null,
|
|
765
|
+
].filter(Boolean));
|
|
766
|
+
}
|
|
767
|
+
|
|
719
768
|
/* ------------------------------------------------------------------ 空态 */
|
|
720
769
|
|
|
721
770
|
/** 首页:Google 式居中的大号解析框 + 最近分析列表。 */
|
|
722
|
-
function HomeHero({ url, busy, statusError, biliReady, onUrl, onSubmit, onGoSettings }) {
|
|
771
|
+
function HomeHero({ url, busy, statusError, biliReady, onUrl, onSubmit, onExample, onGoSettings }) {
|
|
723
772
|
const canSubmit = !busy && String(url ?? '').trim().length > 0;
|
|
724
773
|
const submit = (event) => {
|
|
725
774
|
if (event && typeof event.preventDefault === 'function') event.preventDefault();
|
|
@@ -729,7 +778,7 @@ window.__ModuleLoader__.load({
|
|
|
729
778
|
statusError ? h('div', { key: 'host', className: 'dvv-error' }, `插件主机未就绪:${statusError}(面板要等 host 半启动后才能解析)`) : null,
|
|
730
779
|
h('div', { key: 'hero', className: 'dvv-home-hero' }, [
|
|
731
780
|
h('h1', { key: 't', className: 'dvv-home-title' }, '视频解析'),
|
|
732
|
-
h('p', { key: 's', className: 'dvv-home-sub' }, '
|
|
781
|
+
h('p', { key: 's', className: 'dvv-home-sub' }, '粘贴一条链接,30 秒看清一个视频值不值得看。'),
|
|
733
782
|
h('form', { key: 'form', className: 'dvv-home-form', onSubmit: submit }, [
|
|
734
783
|
h('input', {
|
|
735
784
|
key: 'i', className: 'dvv-home-input', type: 'text', value: url,
|
|
@@ -742,6 +791,14 @@ window.__ModuleLoader__.load({
|
|
|
742
791
|
key: 'go', type: 'submit', className: 'dvv-btn dvv-home-btn', 'data-primary': 'true', disabled: !canSubmit,
|
|
743
792
|
}, busy ? '解析中…' : '解析'),
|
|
744
793
|
]),
|
|
794
|
+
h('div', { key: 'chips', className: 'dvv-home-chips' }, HOME_EXAMPLES.map(([label, link]) =>
|
|
795
|
+
h('button', {
|
|
796
|
+
key: link, type: 'button', className: 'dvv-home-chip',
|
|
797
|
+
title: `解析示例:${link}`, disabled: busy,
|
|
798
|
+
onClick: () => { if (onExample) onExample(link); },
|
|
799
|
+
}, label))),
|
|
800
|
+
h('div', { key: 'tip', className: 'dvv-home-tip' }, '粘贴后回车解析'),
|
|
801
|
+
h('p', { key: 'sub2', className: 'dvv-home-sub2' }, '粘贴 YouTube / 哔哩哔哩链接,自动抓字幕、生成总结、章节和思维导图,还能对着视频追问'),
|
|
745
802
|
!biliReady ? h('div', { key: 'cookie', className: 'dvv-home-hint' }, [
|
|
746
803
|
h('span', { key: 't' }, 'B 站 AI 字幕需要登录 Cookie:'),
|
|
747
804
|
h('button', { key: 'b', type: 'button', className: 'dvv-btn dvv-btn-mini', onClick: onGoSettings }, '去设置'),
|
|
@@ -793,49 +850,93 @@ window.__ModuleLoader__.load({
|
|
|
793
850
|
* 顶部紧凑工具栏:返回 + 标题/平台/状态 + 历史/设置。
|
|
794
851
|
* 视频信息压缩成两行(标题一行省略、元信息一行),不再占掉一整块纵向空间。
|
|
795
852
|
*/
|
|
796
|
-
function VideoToolbar({ doc, job, historyCount, canGoBack, onBack, onHistory, onSettings, onCancelJob }) {
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
}
|
|
853
|
+
function VideoToolbar({ doc, job, historyCount, canGoBack, onBack, onHistory, onSettings, onCancelJob, onRegenerate, onExport }) {
|
|
854
|
+
const [metaCollapsed, setMetaCollapsed] = useState(readMetaCollapsed);
|
|
855
|
+
const [menu, setMenu] = useState('');
|
|
856
|
+
const toggleMeta = () => {
|
|
857
|
+
const next = !metaCollapsed;
|
|
858
|
+
setMetaCollapsed(next);
|
|
859
|
+
writeMetaCollapsed(next);
|
|
860
|
+
};
|
|
861
|
+
const stats = doc ? (doc.stats ?? {}) : {};
|
|
862
|
+
const statBits = [['播放', stats.views], ['点赞', stats.likes], ['评论', stats.comments]]
|
|
863
|
+
.filter(([, value]) => Number(value) > 0)
|
|
864
|
+
.map(([label, value], index) => h('span', { key: `s-${label}` }, `${index ? '· ' : ''}${label} ${fmtCount(value)}`));
|
|
865
|
+
const closeMenu = () => setMenu('');
|
|
866
|
+
const runAction = (kind) => { closeMenu(); if (kind === 'summary' && onRegenerate) onRegenerate('summary'); if (kind === 'mindmap' && onRegenerate) onRegenerate('mindmap'); if (kind === 'storyboard' && onRegenerate) onRegenerate('storyboard'); };
|
|
867
|
+
const exportAction = (kind) => { closeMenu(); if (onExport) onExport(kind); };
|
|
868
|
+
const menuList = (items) => h('div', { className: 'dvv-menu-pop', role: 'menu' }, items.map(([key, label, action]) =>
|
|
869
|
+
h('button', { key, type: 'button', className: 'dvv-menu-item', role: 'menuitem', onClick: action }, label)));
|
|
811
870
|
return h('header', { className: 'dvv-toolbar' }, [
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
h('
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
h('
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
871
|
+
h('div', { key: 'row', className: 'dvv-toolbar-row' }, [
|
|
872
|
+
canGoBack ? h('button', {
|
|
873
|
+
key: 'back', type: 'button', className: 'dvv-btn dvv-back',
|
|
874
|
+
title: doc ? '返回首页' : '返回对话', 'aria-label': doc ? '返回首页' : '返回上一级',
|
|
875
|
+
onClick: () => { if (onBack) onBack(); },
|
|
876
|
+
}, '← 返回') : null,
|
|
877
|
+
doc ? h('div', { key: 'cover', className: 'dvv-toolbar-cover' }, h(CoverImage, { src: doc.cover, alt: doc.title })) : null,
|
|
878
|
+
h('div', { key: 'main', className: 'dvv-toolbar-main' }, doc ? [
|
|
879
|
+
h('a', {
|
|
880
|
+
key: 'title', className: 'dvv-toolbar-title', href: doc.url || '#', target: '_blank',
|
|
881
|
+
rel: 'noreferrer noopener', title: doc.title || '',
|
|
882
|
+
}, doc.title || '(无标题视频)'),
|
|
883
|
+
h('div', { key: 'sub', className: 'dvv-toolbar-sub' }, [
|
|
884
|
+
h(PlatformBadge, { key: 'plat', platform: doc.platform, compact: true }),
|
|
885
|
+
doc.author ? h('span', { key: 'author', className: 'dvv-toolbar-author' }, doc.author) : null,
|
|
886
|
+
].filter(Boolean)),
|
|
887
|
+
] : [
|
|
888
|
+
h('div', { key: 't', className: 'dvv-toolbar-title-plain' }, '视频解析'),
|
|
889
|
+
h('div', { key: 's', className: 'dvv-toolbar-sub' }, '粘贴链接,自动抓字幕、做总结与思维导图'),
|
|
890
|
+
]),
|
|
891
|
+
h('div', { key: 'actions', className: 'dvv-toolbar-actions' }, [
|
|
892
|
+
job && jobActive(job) ? h('div', {
|
|
893
|
+
key: 'job', className: 'dvv-job-chip',
|
|
894
|
+
title: `${jobStageText(job)} · ${jobPercent(job)}%`,
|
|
895
|
+
}, [
|
|
896
|
+
h('span', { key: 't', className: 'dvv-job-chip-text' }, `后台解析 ${jobPercent(job)}% · ${jobStageText(job)}`),
|
|
897
|
+
h('button', {
|
|
898
|
+
key: 'x', type: 'button', className: 'dvv-job-chip-x', title: '取消后台解析', 'aria-label': '取消后台解析',
|
|
899
|
+
onClick: () => { if (onCancelJob) onCancelJob(job); },
|
|
900
|
+
}, '×'),
|
|
901
|
+
]) : null,
|
|
902
|
+
doc && onRegenerate ? h('div', { key: 'regen', className: 'dvv-menu' }, [
|
|
903
|
+
h('button', {
|
|
904
|
+
key: 'b', type: 'button', className: 'dvv-btn', 'aria-haspopup': 'menu',
|
|
905
|
+
'data-open': menu === 'regen' ? 'true' : undefined,
|
|
906
|
+
onClick: () => setMenu(menu === 'regen' ? '' : 'regen'),
|
|
907
|
+
}, '重新生成 ▾'),
|
|
908
|
+
menu === 'regen' ? menuList([
|
|
909
|
+
['summary', '重新生成总结', () => runAction('summary')],
|
|
910
|
+
['mindmap', '重新生成思维导图', () => runAction('mindmap')],
|
|
911
|
+
['storyboard', '重新生成分镜', () => runAction('storyboard')],
|
|
912
|
+
]) : null,
|
|
913
|
+
]) : null,
|
|
914
|
+
doc && onExport ? h('div', { key: 'export', className: 'dvv-menu' }, [
|
|
915
|
+
h('button', {
|
|
916
|
+
key: 'b', type: 'button', className: 'dvv-btn', 'aria-haspopup': 'menu',
|
|
917
|
+
'data-open': menu === 'export' ? 'true' : undefined,
|
|
918
|
+
onClick: () => setMenu(menu === 'export' ? '' : 'export'),
|
|
919
|
+
}, '导出 ▾'),
|
|
920
|
+
menu === 'export' ? menuList([
|
|
921
|
+
['md-copy', '复制 Markdown', () => exportAction('markdown')],
|
|
922
|
+
['md-dl', '下载 .md', () => exportAction('download')],
|
|
923
|
+
['full', '复制全文', () => exportAction('fulltext')],
|
|
924
|
+
]) : null,
|
|
925
|
+
]) : null,
|
|
926
|
+
h('button', { key: 'history', type: 'button', className: 'dvv-btn', onClick: onHistory }, historyCount ? `历史 ${historyCount}` : '历史'),
|
|
927
|
+
h('button', { key: 'settings', type: 'button', className: 'dvv-btn', onClick: onSettings }, '设置'),
|
|
928
|
+
].filter(Boolean)),
|
|
838
929
|
]),
|
|
930
|
+
doc ? h('div', { key: 'meta', className: 'dvv-meta', 'data-collapsed': metaCollapsed ? 'true' : 'false' }, [
|
|
931
|
+
metaCollapsed
|
|
932
|
+
? h('button', { key: 'expand', type: 'button', className: 'dvv-meta-toggle', onClick: toggleMeta }, '展开视频信息')
|
|
933
|
+
: [
|
|
934
|
+
doc.duration ? h('span', { key: 'dur', className: 'dvv-dur' }, `时长 ${fmtTime(doc.duration)}`) : null,
|
|
935
|
+
doc.publishedAt ? h('span', { key: 'when', className: 'dvv-note' }, fmtDate(doc.publishedAt)) : null,
|
|
936
|
+
statBits.length ? h('span', { key: 'stats', className: 'dvv-toolbar-stats' }, statBits) : null,
|
|
937
|
+
h('button', { key: 'toggle', type: 'button', className: 'dvv-meta-toggle', onClick: toggleMeta }, '收起视频信息'),
|
|
938
|
+
].filter(Boolean),
|
|
939
|
+
]) : null,
|
|
839
940
|
].filter(Boolean));
|
|
840
941
|
}
|
|
841
942
|
|
|
@@ -931,9 +1032,90 @@ window.__ModuleLoader__.load({
|
|
|
931
1032
|
return h('div', { className: 'dvv-asr-note' }, parts);
|
|
932
1033
|
}
|
|
933
1034
|
|
|
1035
|
+
/* ---------------------------------------------------------- 总结卡片化 */
|
|
1036
|
+
|
|
1037
|
+
/** 把总结 markdown 按 `## 标题` 切成若干段(没有 `##` 时返回空数组,调用方回退整段渲染)。 */
|
|
1038
|
+
function parseSummarySections(text) {
|
|
1039
|
+
const source = String(text ?? '');
|
|
1040
|
+
if (!source.trim()) return [];
|
|
1041
|
+
const sections = [];
|
|
1042
|
+
let current = null;
|
|
1043
|
+
for (const line of source.split('\n')) {
|
|
1044
|
+
const match = /^##\s+(.+?)\s*$/.exec(line);
|
|
1045
|
+
if (match) {
|
|
1046
|
+
if (current) sections.push(current);
|
|
1047
|
+
current = { title: match[1].trim(), lines: [] };
|
|
1048
|
+
} else if (current) {
|
|
1049
|
+
current.lines.push(line);
|
|
1050
|
+
} else if (line.trim()) {
|
|
1051
|
+
current = { title: '', lines: [line] };
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
if (current) sections.push(current);
|
|
1055
|
+
return sections
|
|
1056
|
+
.map((section) => ({ title: section.title, body: section.lines.join('\n').trim() }))
|
|
1057
|
+
.filter((section) => section.title || section.body);
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
const SUMMARY_SMALL_SECTIONS = ['核心观点', '适合谁看', '值得记住的说法'];
|
|
1061
|
+
const SUMMARY_FOLDED_SECTIONS = ['内容脉络', '关键要点'];
|
|
1062
|
+
|
|
1063
|
+
/** 卡片化总结:一句话大卡 + 三张小卡 + 可折叠详读。没有 `##` 分段时由调用方回退。 */
|
|
1064
|
+
function SummaryCards({ text, onSeek }) {
|
|
1065
|
+
const sections = parseSummarySections(text);
|
|
1066
|
+
const [expanded, setExpanded] = useState({});
|
|
1067
|
+
const [showAllSmall, setShowAllSmall] = useState(false);
|
|
1068
|
+
if (!sections.length) return null;
|
|
1069
|
+
const matches = (names) => sections.filter((section) => names.some((name) => section.title.includes(name)));
|
|
1070
|
+
const bigSection = sections.find((section) => /一句话|总结/.test(section.title)) || sections[0];
|
|
1071
|
+
const smallSections = matches(SUMMARY_SMALL_SECTIONS);
|
|
1072
|
+
const foldedSections = matches(SUMMARY_FOLDED_SECTIONS);
|
|
1073
|
+
const otherSections = sections.filter((section) => section !== bigSection
|
|
1074
|
+
&& !smallSections.includes(section) && !foldedSections.includes(section));
|
|
1075
|
+
const body = (section) => h('div', { className: 'dvv-md dvv-sum-md' }, renderMarkdown(section.body, onSeek));
|
|
1076
|
+
const isOpen = (key, fallback) => (key in expanded ? Boolean(expanded[key]) : Boolean(fallback));
|
|
1077
|
+
const toggle = (key, fallback) => setExpanded((current) => ({ ...current, [key]: !isOpen(key, fallback) }));
|
|
1078
|
+
const parts = [
|
|
1079
|
+
h('div', { key: 'big', className: 'dvv-sum-big' }, [
|
|
1080
|
+
bigSection.title ? h('div', { key: 't', className: 'dvv-sum-big-title' }, bigSection.title === '一句话总结' ? '一句话总结' : bigSection.title) : null,
|
|
1081
|
+
bigSection.body ? body(bigSection) : null,
|
|
1082
|
+
].filter(Boolean)),
|
|
1083
|
+
];
|
|
1084
|
+
if (smallSections.length) {
|
|
1085
|
+
parts.push(h('div', { key: 'small', className: 'dvv-sum-cards' }, smallSections.map((section, index) => {
|
|
1086
|
+
const lines = section.body.split('\n').filter((line) => line.trim());
|
|
1087
|
+
const limited = !showAllSmall && lines.length > 6;
|
|
1088
|
+
const shown = limited ? lines.slice(0, 6).join('\n') : section.body;
|
|
1089
|
+
return h('div', { key: `s-${index}`, className: 'dvv-sum-card' }, [
|
|
1090
|
+
h('div', { key: 't', className: 'dvv-sum-card-title' }, section.title || '要点'),
|
|
1091
|
+
h('div', { key: 'b', className: 'dvv-md' }, renderMarkdown(shown, onSeek)),
|
|
1092
|
+
limited ? h('button', {
|
|
1093
|
+
key: 'more', type: 'button', className: 'dvv-btn dvv-btn-mini',
|
|
1094
|
+
onClick: () => setShowAllSmall(true),
|
|
1095
|
+
}, '展开更多') : null,
|
|
1096
|
+
].filter(Boolean));
|
|
1097
|
+
})));
|
|
1098
|
+
}
|
|
1099
|
+
for (const section of [...foldedSections, ...otherSections]) {
|
|
1100
|
+
const key = section.title || '其他';
|
|
1101
|
+
const defaultOpen = section.title.includes('内容脉络');
|
|
1102
|
+
const open = isOpen(key, defaultOpen);
|
|
1103
|
+
parts.push(h('div', { key: `f-${key}`, className: 'dvv-sum-fold', 'data-open': open ? 'true' : 'false' }, [
|
|
1104
|
+
h('button', {
|
|
1105
|
+
key: 'h', type: 'button', className: 'dvv-sum-fold-head', onClick: () => toggle(key, defaultOpen),
|
|
1106
|
+
}, [
|
|
1107
|
+
h('span', { key: 't', className: 'dvv-sum-fold-title' }, key),
|
|
1108
|
+
h('span', { key: 'x', className: 'dvv-sum-fold-arrow' }, open ? '收起' : '展开'),
|
|
1109
|
+
]),
|
|
1110
|
+
open ? body(section) : null,
|
|
1111
|
+
].filter(Boolean)));
|
|
1112
|
+
}
|
|
1113
|
+
return h('div', { className: 'dvv-sum' }, parts);
|
|
1114
|
+
}
|
|
1115
|
+
|
|
934
1116
|
/* ------------------------------------------------------------------ 总结 */
|
|
935
1117
|
|
|
936
|
-
function SummaryTab({ doc, summary, onRun, onStop, onCopy, onCopyMarkdown, onDownloadMarkdown, onGoSettings, onSeek }) {
|
|
1118
|
+
function SummaryTab({ doc, summary, job, onRun, onStop, onCopy, onCopyMarkdown, onDownloadMarkdown, onGoSettings, onSeek }) {
|
|
937
1119
|
const available = hasTranscript(doc);
|
|
938
1120
|
const official = doc && doc.officialSummary && doc.officialSummary.summary ? String(doc.officialSummary.summary) : '';
|
|
939
1121
|
const parts = [];
|
|
@@ -957,14 +1139,26 @@ window.__ModuleLoader__.load({
|
|
|
957
1139
|
parts.push(h('div', { key: 'cached', className: 'dvv-cache-note dvv-note' }, `已缓存 · ${fmtRelative(summary.cachedAt)}(点「重新生成」可覆盖)`));
|
|
958
1140
|
}
|
|
959
1141
|
if (summary.error) parts.push(h('div', { key: 'err', className: 'dvv-error' }, summary.error));
|
|
1142
|
+
const bgActive = Boolean(job && jobActive(job));
|
|
1143
|
+
if (bgActive && !summary.loading && !summary.text && !summary.error) {
|
|
1144
|
+
parts.push(h('div', { key: 'bg', className: 'dvv-loading-block dvv-bg-block' }, [
|
|
1145
|
+
h('span', { key: 's', className: 'dvv-spinner' }),
|
|
1146
|
+
h('span', { key: 't' }, `后台解析中 ${jobPercent(job)}% · ${jobStageText(job)}`),
|
|
1147
|
+
h('span', { key: 'n', className: 'dvv-note' }, '总结、章节、思维导图与分镜会在后台生成,完成后自动回填。'),
|
|
1148
|
+
]));
|
|
1149
|
+
}
|
|
960
1150
|
if (summary.loading && !summary.text) {
|
|
961
|
-
parts.push(h(
|
|
1151
|
+
parts.push(h(Skeleton, { key: 'loading', rows: 6, note: summary.phase || '正在生成总结…' }));
|
|
962
1152
|
}
|
|
963
1153
|
if (summary.text) {
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
1154
|
+
const sections = parseSummarySections(summary.text);
|
|
1155
|
+
parts.push(sections.length
|
|
1156
|
+
? h(SummaryCards, { key: 'cards', text: summary.text, onSeek })
|
|
1157
|
+
: h('div', { key: 'md', className: 'dvv-md dvv-md-wrap' }, [
|
|
1158
|
+
...renderMarkdown(summary.text, onSeek),
|
|
1159
|
+
summary.loading ? h('span', { key: 'caret', className: 'dvv-caret' }) : null,
|
|
1160
|
+
].filter(Boolean)));
|
|
1161
|
+
if (summary.loading) parts.push(h('span', { key: 'caret', className: 'dvv-caret' }));
|
|
968
1162
|
}
|
|
969
1163
|
if (summary.loading && summary.text && summary.phase) parts.push(h('div', { key: 'phase', className: 'dvv-note' }, summary.phase));
|
|
970
1164
|
const actions = [];
|
|
@@ -987,7 +1181,7 @@ window.__ModuleLoader__.load({
|
|
|
987
1181
|
onClick: onDownloadMarkdown,
|
|
988
1182
|
}, '下载 .md'));
|
|
989
1183
|
parts.push(h('div', { key: 'actions', className: 'dvv-actions' }, actions));
|
|
990
|
-
if (!summary.loading && !summary.text && !summary.error) {
|
|
1184
|
+
if (!summary.loading && !summary.text && !summary.error && !bgActive) {
|
|
991
1185
|
parts.push(h('div', { key: 'idle', className: 'dvv-notice' }, [
|
|
992
1186
|
h('div', { key: 'n', className: 'dvv-note' }, '还没有生成总结。'),
|
|
993
1187
|
h('div', { key: 'a', className: 'dvv-actions' }, h('button', { type: 'button', className: 'dvv-btn', 'data-primary': 'true', onClick: onRun }, '生成总结')),
|
|
@@ -1029,10 +1223,9 @@ window.__ModuleLoader__.load({
|
|
|
1029
1223
|
}
|
|
1030
1224
|
|
|
1031
1225
|
function ChaptersTab({ outline, doc, currentSeconds, view, onView, onSeek, onRetry, onGenerate, onCancel, hint, titlesBusy, onGenerateTitles, onGoMindmap }) {
|
|
1032
|
-
if (!doc) return h('div', { className: 'dvv-tabpane' }, h(
|
|
1226
|
+
if (!doc) return h('div', { className: 'dvv-tabpane' }, h(EmptyState, { title: '先解析一个视频,再来看章节。', note: '在首页粘贴链接,解析完成后这里会列出章节。' }));
|
|
1033
1227
|
if (outline.loading) {
|
|
1034
|
-
return h('div', { className: 'dvv-tabpane' }, h(
|
|
1035
|
-
[0, 1, 2, 3].map((index) => h('div', { key: index, className: 'dvv-skel' }))));
|
|
1228
|
+
return h('div', { className: 'dvv-tabpane' }, h(Skeleton, { rows: 4, note: '正在读取章节…' }));
|
|
1036
1229
|
}
|
|
1037
1230
|
const data = outline.data && typeof outline.data === 'object' ? outline.data : {};
|
|
1038
1231
|
const items = Array.isArray(data.items) ? data.items.filter(Boolean) : [];
|
|
@@ -1083,10 +1276,7 @@ window.__ModuleLoader__.load({
|
|
|
1083
1276
|
]));
|
|
1084
1277
|
}
|
|
1085
1278
|
if (outline.genError) parts.push(h('div', { key: 'gerr', className: 'dvv-error' }, outline.genError));
|
|
1086
|
-
if (outline.error) parts.push(h(
|
|
1087
|
-
h('span', { key: 'm' }, outline.error),
|
|
1088
|
-
h('button', { key: 'r', type: 'button', className: 'dvv-btn', onClick: onRetry }, '重试'),
|
|
1089
|
-
]));
|
|
1279
|
+
if (outline.error) parts.push(h(ErrorState, { key: 'err', text: outline.error, onRetry }));
|
|
1090
1280
|
if (items.length) {
|
|
1091
1281
|
if (view === 'grid') {
|
|
1092
1282
|
parts.push(h('div', { key: 'grid', className: 'dvv-kf-grid' }, items.map((item, index) => h(KeyframeCard, { key: `card-${index}`, doc, item, onSeek }))));
|
|
@@ -1096,10 +1286,10 @@ window.__ModuleLoader__.load({
|
|
|
1096
1286
|
}))));
|
|
1097
1287
|
}
|
|
1098
1288
|
} else if (!outline.loading && !outline.error) {
|
|
1099
|
-
parts.push(h(
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1289
|
+
parts.push(h(EmptyState, {
|
|
1290
|
+
key: 'empty', title: '还没有可用的章节',
|
|
1291
|
+
note: '这个视频可能太短,或者还没有字幕可以切分。',
|
|
1292
|
+
}));
|
|
1103
1293
|
}
|
|
1104
1294
|
return h('div', { className: 'dvv-tabpane' }, parts);
|
|
1105
1295
|
}
|
|
@@ -1139,13 +1329,13 @@ window.__ModuleLoader__.load({
|
|
|
1139
1329
|
if (!visible && typeof row.scrollIntoView === 'function') row.scrollIntoView({ block: 'nearest' });
|
|
1140
1330
|
}, [follow, currentIndex]);
|
|
1141
1331
|
if (!hasTranscript(doc)) {
|
|
1142
|
-
return h('div', { className: 'dvv-tabpane' }, h(
|
|
1143
|
-
|
|
1144
|
-
|
|
1332
|
+
return h('div', { className: 'dvv-tabpane' }, h(EmptyState, {
|
|
1333
|
+
title: '这个视频没拿到字幕',
|
|
1334
|
+
note: doc && doc.platform === 'bilibili'
|
|
1145
1335
|
? 'B 站要登录 Cookie 才能读 AI 字幕。去「设置」里粘贴 SESSDATA,再重新解析。'
|
|
1146
|
-
: 'YouTube 视频可能没有字幕,或作者关闭了自动字幕。'
|
|
1147
|
-
h('div', {
|
|
1148
|
-
|
|
1336
|
+
: 'YouTube 视频可能没有字幕,或作者关闭了自动字幕。',
|
|
1337
|
+
action: h('div', { className: 'dvv-actions' }, h('button', { type: 'button', className: 'dvv-btn', 'data-primary': 'true', onClick: onGoSettings }, '去设置')),
|
|
1338
|
+
}));
|
|
1149
1339
|
}
|
|
1150
1340
|
const keyword = String(query ?? '').trim().toLowerCase();
|
|
1151
1341
|
const entries = segments.map((segment, index) => {
|
|
@@ -1573,22 +1763,18 @@ window.__ModuleLoader__.load({
|
|
|
1573
1763
|
]);
|
|
1574
1764
|
let body;
|
|
1575
1765
|
if (mindmap.loading) {
|
|
1576
|
-
body = h(
|
|
1577
|
-
h('span', { key: 's', className: 'dvv-spinner' }),
|
|
1578
|
-
h('span', { key: 't' }, '正在生成思维导图…'),
|
|
1579
|
-
]);
|
|
1766
|
+
body = h(Skeleton, { key: 'loading', rows: 5, note: '正在生成思维导图…' });
|
|
1580
1767
|
} else if (mindmap.error) {
|
|
1581
1768
|
const canRetry = mindmap.code === 'no-transcript' && doc && !hasTranscript(doc);
|
|
1582
|
-
body = h(
|
|
1583
|
-
|
|
1584
|
-
canRetry ?
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
].filter(Boolean));
|
|
1769
|
+
body = h(ErrorState, {
|
|
1770
|
+
key: 'error', text: mindmap.error,
|
|
1771
|
+
onRetry: canRetry ? onGoTranscript : onRetry,
|
|
1772
|
+
retryLabel: canRetry ? '本地转写' : '重试',
|
|
1773
|
+
});
|
|
1588
1774
|
} else if (!mindmap.data) {
|
|
1589
|
-
body = h(
|
|
1775
|
+
body = h(EmptyState, { key: 'empty', title: '还没有生成思维导图', note: '点「重新生成」开始生成。' });
|
|
1590
1776
|
} else if (!layout || !layout.nodes.length) {
|
|
1591
|
-
body = h(
|
|
1777
|
+
body = h(EmptyState, { key: 'empty', title: '导图内容是空的', note: '点「重新生成」再试一次。' });
|
|
1592
1778
|
} else {
|
|
1593
1779
|
const edges = h('svg', {
|
|
1594
1780
|
key: 'edges',
|
|
@@ -1645,7 +1831,7 @@ window.__ModuleLoader__.load({
|
|
|
1645
1831
|
useEffect(() => { setBrokenSheets({}); }, [data && data.generatedAt]);
|
|
1646
1832
|
if (!doc) {
|
|
1647
1833
|
return h('div', { className: 'dvv-tabpane dvv-sb-tab' },
|
|
1648
|
-
h(
|
|
1834
|
+
h(EmptyState, { title: '先解析一个视频,再来看它的分镜。', note: '解析完成后「分镜」页会把整段视频的画面拼成网格。' }));
|
|
1649
1835
|
}
|
|
1650
1836
|
const budget = data && data.budget ? data.budget : null;
|
|
1651
1837
|
const sheets = data
|
|
@@ -1685,18 +1871,17 @@ window.__ModuleLoader__.load({
|
|
|
1685
1871
|
if (loading) {
|
|
1686
1872
|
body = h('div', { key: 'progress', className: 'dvv-sb-progress' }, [
|
|
1687
1873
|
h(AsrProgress, { key: 'progress', percent: storyboard.percent }),
|
|
1688
|
-
h(
|
|
1874
|
+
h(Skeleton, { key: 'skel', rows: 4, note: storyboard.phase || '正在生成分镜…' }),
|
|
1689
1875
|
h('div', { key: 'actions', className: 'dvv-actions' },
|
|
1690
1876
|
h('button', { key: 'cancel', type: 'button', className: 'dvv-btn', onClick: onCancel }, '取消')),
|
|
1691
1877
|
]);
|
|
1692
1878
|
} else if (error) {
|
|
1693
|
-
body = h(
|
|
1694
|
-
h('span', { key: 'text' }, error),
|
|
1695
|
-
h('button', { key: 'retry', type: 'button', className: 'dvv-btn', onClick: () => onGenerate() }, '重试'),
|
|
1696
|
-
]);
|
|
1879
|
+
body = h(ErrorState, { key: 'error', text: error, onRetry: () => onGenerate() });
|
|
1697
1880
|
} else if (!data) {
|
|
1698
|
-
body = h(
|
|
1699
|
-
'
|
|
1881
|
+
body = h(EmptyState, {
|
|
1882
|
+
key: 'empty', title: '这个视频还没有分镜',
|
|
1883
|
+
note: '点「生成分镜」,把整段视频的画面拼成一张图。',
|
|
1884
|
+
});
|
|
1700
1885
|
} else {
|
|
1701
1886
|
const allCells = Array.isArray(data.cells) ? data.cells : [];
|
|
1702
1887
|
const sheetNodes = sheets.map((sheet, index) => {
|
|
@@ -1773,6 +1958,91 @@ window.__ModuleLoader__.load({
|
|
|
1773
1958
|
]);
|
|
1774
1959
|
}
|
|
1775
1960
|
|
|
1961
|
+
/* ------------------------------------------------------ 全局任务条 / 任务抽屉 */
|
|
1962
|
+
|
|
1963
|
+
/** 常驻任务条:有进行中任务才渲染。 */
|
|
1964
|
+
function GlobalJobbar({ jobs, onExpand }) {
|
|
1965
|
+
const list = Array.isArray(jobs) ? jobs : [];
|
|
1966
|
+
const active = list.filter((job) => jobActive(job));
|
|
1967
|
+
if (!active.length) return null;
|
|
1968
|
+
const running = list.find((job) => job && job.status === 'running');
|
|
1969
|
+
const queued = list.filter((job) => job && job.status === 'queued');
|
|
1970
|
+
const finished = Math.max(0, list.length - active.length);
|
|
1971
|
+
const top = running || queued[0] || active[0];
|
|
1972
|
+
const stage = top && top.status === 'queued' ? '排队中' : jobStageText(top);
|
|
1973
|
+
const percent = top && top.status === 'running' ? ` ${jobPercent(top)}%` : '';
|
|
1974
|
+
return h('div', { className: 'dvv-jobbar-global', role: 'status' }, [
|
|
1975
|
+
h('span', { key: 'dot', className: 'dvv-jobbar-global-dot', 'aria-hidden': 'true' }),
|
|
1976
|
+
h('span', { key: 't', className: 'dvv-jobbar-global-text' }, `解析队列 ${finished}/${list.length}`),
|
|
1977
|
+
h('span', { key: 's', className: 'dvv-jobbar-global-stage' }, `· ${stage}${percent}`),
|
|
1978
|
+
h('div', { key: 'sp', className: 'dvv-spacer' }),
|
|
1979
|
+
h('button', { key: 'open', type: 'button', className: 'dvv-btn dvv-btn-mini', onClick: onExpand }, '展开'),
|
|
1980
|
+
].filter(Boolean));
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
/** 任务抽屉:运行中 / 排队中 / 最近完成。 */
|
|
1984
|
+
function JobDrawer({ jobs, onCancel, onRetry, onOpen, onClearDone, onClose }) {
|
|
1985
|
+
const list = Array.isArray(jobs) ? jobs : [];
|
|
1986
|
+
const running = list.filter((job) => job && job.status === 'running');
|
|
1987
|
+
const queued = list.filter((job) => job && job.status === 'queued');
|
|
1988
|
+
const recent = list.filter((job) => job && (job.status === 'done' || job.status === 'failed')).slice(0, 8);
|
|
1989
|
+
const row = (job, index) => h('div', {
|
|
1990
|
+
key: `${job.id || job.docId || 'job'}-${index}`,
|
|
1991
|
+
className: 'dvv-jd-row',
|
|
1992
|
+
'data-status': String(job.status || ''),
|
|
1993
|
+
}, [
|
|
1994
|
+
h('div', { key: 'main', className: 'dvv-jd-main' }, [
|
|
1995
|
+
h('div', { key: 't', className: 'dvv-jd-title', title: String(job.title || '') }, job.title || job.docId || '未命名视频'),
|
|
1996
|
+
h('div', { key: 's', className: 'dvv-jd-sub' }, job.status === 'failed'
|
|
1997
|
+
? `解析失败:${String(job.error || '未知错误')}`
|
|
1998
|
+
: `${jobStageText(job)}${job.status === 'running' ? ` · ${jobPercent(job)}%` : ''}`),
|
|
1999
|
+
jobActive(job) ? h('div', { key: 'bar', className: 'dvv-jobbar', 'data-queued': job.status === 'queued' ? 'true' : undefined },
|
|
2000
|
+
h('div', { key: 'fill', className: 'dvv-jobbar-fill', style: { width: `${jobPercent(job)}%` } })) : null,
|
|
2001
|
+
].filter(Boolean)),
|
|
2002
|
+
h('div', { key: 'actions', className: 'dvv-jd-actions' }, [
|
|
2003
|
+
jobActive(job) ? h('button', {
|
|
2004
|
+
key: 'cancel', type: 'button', className: 'dvv-btn dvv-btn-mini', onClick: () => onCancel(job),
|
|
2005
|
+
}, '取消') : null,
|
|
2006
|
+
job.status === 'failed' ? h('button', {
|
|
2007
|
+
key: 'retry', type: 'button', className: 'dvv-btn dvv-btn-mini', onClick: () => onRetry(job),
|
|
2008
|
+
}, '重试') : null,
|
|
2009
|
+
job.status === 'done' ? h('button', {
|
|
2010
|
+
key: 'open', type: 'button', className: 'dvv-btn dvv-btn-mini', onClick: () => onOpen(job),
|
|
2011
|
+
}, '打开') : null,
|
|
2012
|
+
].filter(Boolean)),
|
|
2013
|
+
].filter(Boolean));
|
|
2014
|
+
const section = (key, title, items) => (items.length
|
|
2015
|
+
? h('div', { key, className: 'dvv-jd-section' }, [
|
|
2016
|
+
h('div', { key: 'h', className: 'dvv-jd-head' }, `${title} · ${items.length}`),
|
|
2017
|
+
...items.map((job, index) => row(job, index)),
|
|
2018
|
+
])
|
|
2019
|
+
: null);
|
|
2020
|
+
return h('div', { className: 'dvv-overlay', 'data-quiet': 'true', onClick: onClose }, h('div', {
|
|
2021
|
+
key: 'drawer', className: 'dvv-drawer dvv-job-drawer',
|
|
2022
|
+
onClick: (event) => { if (event && typeof event.stopPropagation === 'function') event.stopPropagation(); },
|
|
2023
|
+
}, [
|
|
2024
|
+
h('div', { key: 'head', className: 'dvv-drawer-head' }, [
|
|
2025
|
+
h('div', { key: 't', className: 'dvv-drawer-title' }, '解析队列'),
|
|
2026
|
+
h('span', { key: 'n', className: 'dvv-note' }, `${running.length} 个进行中 · ${queued.length} 个排队`),
|
|
2027
|
+
h('button', { key: 'close', type: 'button', className: 'dvv-btn', onClick: onClose }, '关闭'),
|
|
2028
|
+
]),
|
|
2029
|
+
h('div', { key: 'body', className: 'dvv-drawer-body' }, [
|
|
2030
|
+
section('running', '运行中', running),
|
|
2031
|
+
section('queued', '排队中', queued),
|
|
2032
|
+
section('recent', '最近完成', recent),
|
|
2033
|
+
(!running.length && !queued.length && !recent.length)
|
|
2034
|
+
? h('div', { key: 'empty', className: 'dvv-empty-note' }, '目前没有后台任务。在首页或历史里重新解析视频即可开始。')
|
|
2035
|
+
: null,
|
|
2036
|
+
].filter(Boolean)),
|
|
2037
|
+
h('div', { key: 'foot', className: 'dvv-drawer-foot' }, [
|
|
2038
|
+
h('button', {
|
|
2039
|
+
key: 'clear', type: 'button', className: 'dvv-btn', disabled: !recent.length,
|
|
2040
|
+
onClick: onClearDone,
|
|
2041
|
+
}, '清除已完成'),
|
|
2042
|
+
]),
|
|
2043
|
+
]));
|
|
2044
|
+
}
|
|
2045
|
+
|
|
1776
2046
|
/* ---------------------------------------------------------- 历史列表 / 抽屉 */
|
|
1777
2047
|
|
|
1778
2048
|
/** 封面缩略图:没有 cover 或加载失败时用纯色占位。 */
|
|
@@ -1790,6 +2060,8 @@ window.__ModuleLoader__.load({
|
|
|
1790
2060
|
/** 百分比:夹在 0–100,排队中恒为 0。 */
|
|
1791
2061
|
function jobPercent(job) { if (!job || job.status === 'queued') return 0; const value = Number(job.percent); if (!Number.isFinite(value)) return 0; return Math.min(100, Math.max(0, value)); }
|
|
1792
2062
|
/** 阶段文案:排队中 / host 的 stageLabel / 兜底。 */ function jobStageText(job) { if (!job) return ''; if (job.status === 'queued') return '排队中…'; return String(job.stageLabel || (job.status === 'done' ? '已完成' : '解析中…')); }
|
|
2063
|
+
/** 某个 docId 是否有在跑的后台任务(避免同时开内联 SSE 双跑)。 */
|
|
2064
|
+
function activeJobForDoc(list, docId) { if (!docId) return null; for (const job of Array.isArray(list) ? list : []) if (job && job.docId === docId && jobActive(job)) return job; return null; }
|
|
1793
2065
|
/** 汇总成 docId → 最新一条任务 的 Map。 */
|
|
1794
2066
|
function buildJobsByDoc(list) { const map = new Map(); for (const job of Array.isArray(list) ? list : []) { if (!job || !job.docId) continue; const before = map.get(job.docId); if (!before) { map.set(job.docId, job); continue; } if ((Number(job.updatedAt) || 0) >= (Number(before.updatedAt) || 0)) map.set(job.docId, job); } return map; }
|
|
1795
2067
|
|
|
@@ -1853,6 +2125,97 @@ window.__ModuleLoader__.load({
|
|
|
1853
2125
|
].filter(Boolean));
|
|
1854
2126
|
}
|
|
1855
2127
|
|
|
2128
|
+
/** 首页卡片流里的一张最近分析卡:封面/时长、标题、作者时间、状态徽标、任务进度与快捷操作。 */
|
|
2129
|
+
function HistoryCard({ item, job, onOpen, onRemove, onFavorite, onCancelJob }) {
|
|
2130
|
+
const platform = item.platform || guessPlatform(item.url);
|
|
2131
|
+
const duration = Number(item.duration) > 0 ? fmtTime(item.duration) : '';
|
|
2132
|
+
const [menu, setMenu] = useState(false);
|
|
2133
|
+
const stop = (event) => { if (event && typeof event.stopPropagation === 'function') event.stopPropagation(); };
|
|
2134
|
+
const open = () => onOpen(item);
|
|
2135
|
+
return h('article', {
|
|
2136
|
+
className: 'dvv-vcard', role: 'button', tabIndex: 0,
|
|
2137
|
+
'data-doc': item.docId || '', title: item.title || '',
|
|
2138
|
+
onClick: open,
|
|
2139
|
+
onKeyDown: (event) => { if (event.key === 'Enter' || event.key === ' ') { event.preventDefault(); open(); } },
|
|
2140
|
+
}, [
|
|
2141
|
+
h('div', { key: 'cover', className: 'dvv-vcard-cover' }, [
|
|
2142
|
+
h(HistoryCover, { key: 'img', src: item.cover, alt: item.title }),
|
|
2143
|
+
duration ? h('span', { key: 'dur', className: 'dvv-vcard-dur' }, duration) : null,
|
|
2144
|
+
h('span', { key: 'plat', className: 'dvv-vcard-plat' }, h(PlatformBadge, { platform, compact: true })),
|
|
2145
|
+
]),
|
|
2146
|
+
h('div', { key: 'body', className: 'dvv-vcard-body' }, [
|
|
2147
|
+
h('div', { key: 'title', className: 'dvv-vcard-title', title: item.title || '' }, item.title || '(无标题视频)'),
|
|
2148
|
+
h('div', { key: 'sub', className: 'dvv-vcard-sub' }, [
|
|
2149
|
+
item.author ? h('span', { key: 'author' }, item.author) : null,
|
|
2150
|
+
h('span', { key: 'when' }, fmtRelative(item.analyzedAt)),
|
|
2151
|
+
].filter(Boolean)),
|
|
2152
|
+
h('div', { key: 'badges', className: 'dvv-vcard-badges' }, [
|
|
2153
|
+
item.hasSummary ? h('span', { key: 'sum', className: 'dvv-mini' }, '总结') : null,
|
|
2154
|
+
item.hasChapters ? h('span', { key: 'ch', className: 'dvv-mini' }, '章节') : null,
|
|
2155
|
+
item.hasMindmap ? h('span', { key: 'mm', className: 'dvv-mini' }, '导图') : null,
|
|
2156
|
+
h('span', { key: 'cap', className: 'dvv-mini', 'data-ok': item.hasTranscript ? 'true' : 'false' }, item.hasTranscript ? '字幕' : '无字幕'),
|
|
2157
|
+
].filter(Boolean)),
|
|
2158
|
+
]),
|
|
2159
|
+
job && jobActive(job) ? h('div', {
|
|
2160
|
+
key: 'job', className: 'dvv-job dvv-vcard-job', onClick: stop,
|
|
2161
|
+
}, [
|
|
2162
|
+
h('div', { key: 'bar', className: 'dvv-jobbar', 'data-queued': job.status === 'queued' ? 'true' : undefined },
|
|
2163
|
+
h('div', { key: 'fill', className: 'dvv-jobbar-fill', style: { width: `${jobPercent(job)}%` } })),
|
|
2164
|
+
h('span', { key: 'label', className: 'dvv-job-label' }, job.status === 'queued' ? '排队中…' : `${jobPercent(job)}% · ${jobStageText(job)}`),
|
|
2165
|
+
onCancelJob ? h('button', {
|
|
2166
|
+
key: 'cancel', type: 'button', className: 'dvv-del', title: '取消后台解析', 'aria-label': '取消后台解析',
|
|
2167
|
+
onClick: (event) => { stop(event); onCancelJob(job); },
|
|
2168
|
+
}, '×') : null,
|
|
2169
|
+
]) : (job && job.status === 'failed'
|
|
2170
|
+
? h('span', { key: 'jobfail', className: 'dvv-job-failed', title: String(job.error || '') }, '解析失败')
|
|
2171
|
+
: null),
|
|
2172
|
+
h('div', { key: 'actions', className: 'dvv-vcard-actions' }, [
|
|
2173
|
+
onFavorite ? h('button', {
|
|
2174
|
+
key: 'fav', type: 'button', className: 'dvv-fav', 'data-on': item.favorite ? 'true' : 'false',
|
|
2175
|
+
title: item.favorite ? '取消收藏' : '收藏', 'aria-label': item.favorite ? '取消收藏' : '收藏',
|
|
2176
|
+
onClick: (event) => { stop(event); onFavorite(item); },
|
|
2177
|
+
}, item.favorite ? '★' : '☆') : null,
|
|
2178
|
+
h('button', {
|
|
2179
|
+
key: 'more', type: 'button', className: 'dvv-vcard-more', title: '更多操作', 'aria-label': '更多操作',
|
|
2180
|
+
onClick: (event) => { stop(event); setMenu((value) => !value); },
|
|
2181
|
+
}, '⋯'),
|
|
2182
|
+
menu ? h('div', { key: 'menu', className: 'dvv-vcard-menu', onClick: stop }, [
|
|
2183
|
+
h('button', { key: 're', type: 'button', className: 'dvv-vcard-mi', onClick: () => { setMenu(false); open(); } }, '重新解析'),
|
|
2184
|
+
h('button', { key: 'cp', type: 'button', className: 'dvv-vcard-mi', onClick: () => { setMenu(false); void copyText(String(item.url || ''), '已复制链接'); } }, '复制链接'),
|
|
2185
|
+
onFavorite ? h('button', { key: 'fv', type: 'button', className: 'dvv-vcard-mi', onClick: () => { setMenu(false); onFavorite(item); } }, item.favorite ? '取消收藏' : '收藏') : null,
|
|
2186
|
+
onRemove ? h('button', { key: 'rm', type: 'button', className: 'dvv-vcard-mi', onClick: () => { setMenu(false); onRemove(item); } }, '删除') : null,
|
|
2187
|
+
].filter(Boolean)) : null,
|
|
2188
|
+
]),
|
|
2189
|
+
].filter(Boolean));
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
/** 首页「最近分析」卡片流:最多 10 张,更多去历史抽屉。 */
|
|
2193
|
+
function HistoryCards({ items, jobs, activeCount, parseAllBusy, parseAllConfirm, onOpen, onRemove, onFavorite, onOpenAll, onCancelJob, onParseAll }) {
|
|
2194
|
+
const all = Array.isArray(items) ? items : [];
|
|
2195
|
+
if (!all.length) return null;
|
|
2196
|
+
const shown = all.slice(0, HOME_RECENT_LIMIT);
|
|
2197
|
+
return h('section', { className: 'dvv-recent dvv-recent-cards dvv-home-recent' }, [
|
|
2198
|
+
h('div', { key: 'head', className: 'dvv-recent-head' }, [
|
|
2199
|
+
h('span', { key: 't', className: 'dvv-label' }, '最近分析'),
|
|
2200
|
+
h('span', { key: 'c', className: 'dvv-note' }, `共 ${all.length} 条 · 最多保留 ${HISTORY_LIMIT} 条`),
|
|
2201
|
+
h('div', { key: 's', className: 'dvv-spacer' }),
|
|
2202
|
+
onParseAll ? h('button', {
|
|
2203
|
+
key: 'parseAll', type: 'button', className: 'dvv-btn dvv-btn-mini',
|
|
2204
|
+
'data-danger': parseAllConfirm ? 'true' : undefined, disabled: Boolean(parseAllBusy),
|
|
2205
|
+
onClick: () => onParseAll(),
|
|
2206
|
+
}, parseAllConfirm ? '确认解析?' : (Number(activeCount) > 0 ? `解析中 ${Number(activeCount)}` : '全部解析')) : null,
|
|
2207
|
+
all.length > HOME_RECENT_LIMIT && onOpenAll
|
|
2208
|
+
? h('button', { key: 'more', type: 'button', className: 'dvv-btn dvv-btn-mini', onClick: onOpenAll }, '打开历史查看全部')
|
|
2209
|
+
: null,
|
|
2210
|
+
].filter(Boolean)),
|
|
2211
|
+
h('div', { key: 'grid', className: 'dvv-cards-grid' }, shown.map((item, index) => h(HistoryCard, {
|
|
2212
|
+
key: `${item.docId || item.url || 'item'}-${index}`, item,
|
|
2213
|
+
job: jobs && typeof jobs.get === 'function' ? jobs.get(item.docId) : null,
|
|
2214
|
+
onOpen, onRemove, onFavorite, onCancelJob,
|
|
2215
|
+
}))),
|
|
2216
|
+
]);
|
|
2217
|
+
}
|
|
2218
|
+
|
|
1856
2219
|
/** 无视频空态时直接铺在主区的历史列表:只展示前 10 条,更多去抽屉。 */
|
|
1857
2220
|
function HistoryList({ items, jobs, activeCount, parseAllBusy, parseAllConfirm, onOpen, onRemove, onFavorite, onOpenAll, onCancelJob, onParseAll }) {
|
|
1858
2221
|
const all = Array.isArray(items) ? items : [];
|
|
@@ -2309,6 +2672,8 @@ window.__ModuleLoader__.load({
|
|
|
2309
2672
|
const pendingSeek = useRef(null);
|
|
2310
2673
|
/** 自动转写判重:docId → running | done | cancelled | failed | manual(同一视频不重复自动触发)。 */
|
|
2311
2674
|
const autoAsrRef = useRef(new Map());
|
|
2675
|
+
/** 后台自动入队判重:docId → true(同一视频每轮只自动提交一次,回首页重置)。 */
|
|
2676
|
+
const autoQueueRef = useRef(new Set());
|
|
2312
2677
|
/** 双语翻译请求的独立 AbortController(不打断总结 / 追问)。 */
|
|
2313
2678
|
const translationAbort = useRef(null);
|
|
2314
2679
|
/** 后台解析队列:上一轮 jobs(用于判断 running/queued → done/failed)与最近 active 数。 */
|
|
@@ -2626,6 +2991,24 @@ window.__ModuleLoader__.load({
|
|
|
2626
2991
|
}
|
|
2627
2992
|
}, []);
|
|
2628
2993
|
|
|
2994
|
+
/** 拉取 host 分析缓存(GET /analysis)并回填面板;返回是否回填了内容。 */
|
|
2995
|
+
const loadAnalysisCache = useCallback(async (video) => {
|
|
2996
|
+
const target = video ?? docRef.current;
|
|
2997
|
+
if (!target || !target.docId || !mounted.current) return false;
|
|
2998
|
+
try {
|
|
2999
|
+
const value = await call('analysis', { docId: target.docId });
|
|
3000
|
+
if (!mounted.current) return false;
|
|
3001
|
+
const analysis = value && typeof value === 'object' ? (value.analysis || value) : null;
|
|
3002
|
+
const cache = readCachedAnalysis({ analysis });
|
|
3003
|
+
if (!cache) return false;
|
|
3004
|
+
applyAnalysisCache(cache);
|
|
3005
|
+
setDoc((current) => (current && current.docId === target.docId ? { ...current, analysis } : current));
|
|
3006
|
+
return true;
|
|
3007
|
+
} catch (caught) {
|
|
3008
|
+
return false;
|
|
3009
|
+
}
|
|
3010
|
+
}, [applyAnalysisCache]);
|
|
3011
|
+
|
|
2629
3012
|
/** 清空 host 上这个视频的分析缓存(总结 / 章节 / 导图 / 对话)。 */
|
|
2630
3013
|
const clearAnalysisCache = useCallback(async (video) => {
|
|
2631
3014
|
const target = video ?? docRef.current;
|
|
@@ -2672,6 +3055,10 @@ window.__ModuleLoader__.load({
|
|
|
2672
3055
|
const runSummary = useCallback(async (video) => {
|
|
2673
3056
|
const target = video ?? docRef.current;
|
|
2674
3057
|
if (!target || !mounted.current) return;
|
|
3058
|
+
if (activeJobForDoc(jobsRef.current, target.docId)) {
|
|
3059
|
+
showToast('后台解析中,完成后会自动回填总结');
|
|
3060
|
+
return;
|
|
3061
|
+
}
|
|
2675
3062
|
interruptActive();
|
|
2676
3063
|
const controller = new AbortController();
|
|
2677
3064
|
active.current = { controller, kind: 'summary' };
|
|
@@ -3101,13 +3488,14 @@ window.__ModuleLoader__.load({
|
|
|
3101
3488
|
if (!current || job.docId !== current.docId) continue;
|
|
3102
3489
|
if (job.status === 'done') {
|
|
3103
3490
|
showToast('后台解析完成');
|
|
3491
|
+
void loadAnalysisCache(current);
|
|
3104
3492
|
void loadOutline(current);
|
|
3105
3493
|
void loadStoryboard(current, { silent: true });
|
|
3106
3494
|
} else if (job.status === 'failed') {
|
|
3107
3495
|
showToast(`后台解析失败:${String(job.error || '未知错误')}`);
|
|
3108
3496
|
}
|
|
3109
3497
|
}
|
|
3110
|
-
}, [refreshHistory, showToast, loadOutline, loadStoryboard]);
|
|
3498
|
+
}, [refreshHistory, showToast, loadAnalysisCache, loadOutline, loadStoryboard]);
|
|
3111
3499
|
|
|
3112
3500
|
/** 取消某个 docId 的后台任务(历史行 / 详情工具条共用)。 */
|
|
3113
3501
|
const cancelJob = useCallback(async (jobOrDoc) => {
|
|
@@ -3123,6 +3511,32 @@ window.__ModuleLoader__.load({
|
|
|
3123
3511
|
}
|
|
3124
3512
|
}, [refreshJobs, showToast]);
|
|
3125
3513
|
|
|
3514
|
+
/** 任务抽屉「重试」:把失败的 docId 重新入队。 */
|
|
3515
|
+
const retryJob = useCallback(async (job) => {
|
|
3516
|
+
const docId = String((job && job.docId) || '');
|
|
3517
|
+
if (!docId) { showToast('这条任务缺少 docId,无法重试'); return; }
|
|
3518
|
+
try {
|
|
3519
|
+
await post('jobs', { docId, describe: true });
|
|
3520
|
+
if (!mounted.current) return;
|
|
3521
|
+
showToast('已重新加入解析队列');
|
|
3522
|
+
void refreshJobs();
|
|
3523
|
+
} catch (caught) {
|
|
3524
|
+
if (mounted.current) showToast(`重试失败:${String(caught?.message ?? caught)}`);
|
|
3525
|
+
}
|
|
3526
|
+
}, [refreshJobs, showToast]);
|
|
3527
|
+
|
|
3528
|
+
/** 任务抽屉「清除已完成」。 */
|
|
3529
|
+
const clearDoneJobs = useCallback(async () => {
|
|
3530
|
+
try {
|
|
3531
|
+
await post('jobs/clear', {});
|
|
3532
|
+
if (!mounted.current) return;
|
|
3533
|
+
showToast('已清除已完成任务');
|
|
3534
|
+
void refreshJobs();
|
|
3535
|
+
} catch (caught) {
|
|
3536
|
+
if (mounted.current) showToast(`清除失败:${String(caught?.message ?? caught)}`);
|
|
3537
|
+
}
|
|
3538
|
+
}, [refreshJobs, showToast]);
|
|
3539
|
+
|
|
3126
3540
|
/** 首页「全部解析」:第一次点击进入确认,第二次才真正提交。 */
|
|
3127
3541
|
const parseAllJobs = useCallback(async () => {
|
|
3128
3542
|
if (parseAllBusy) return;
|
|
@@ -3312,6 +3726,7 @@ window.__ModuleLoader__.load({
|
|
|
3312
3726
|
docRef.current = null;
|
|
3313
3727
|
setUrl(text);
|
|
3314
3728
|
let followUp = null;
|
|
3729
|
+
let queued = false;
|
|
3315
3730
|
let cachedSummary = false;
|
|
3316
3731
|
try {
|
|
3317
3732
|
const video = await call('resolve', { url: text, force: options && options.force ? 1 : undefined }, { signal: controller.signal });
|
|
@@ -3334,7 +3749,32 @@ window.__ModuleLoader__.load({
|
|
|
3334
3749
|
cachedSummary = Boolean(cache.summary);
|
|
3335
3750
|
}
|
|
3336
3751
|
void refreshHistory(); // host 在 /resolve 成功时已写入历史,客户端只重新拉取
|
|
3337
|
-
|
|
3752
|
+
// 解析成功即入队后台生成(总结 / 导图 / 分镜 / 画面描述);已在跑或分析完整时不重复提交。
|
|
3753
|
+
const runningJob = activeJobForDoc(jobsRef.current, video.docId);
|
|
3754
|
+
const complete = Boolean(cache && cache.summary && cache.chapters && cache.mindmap);
|
|
3755
|
+
const shouldQueue = !runningJob && !autoQueueRef.current.has(video.docId) && (!complete || Boolean(options && options.force));
|
|
3756
|
+
if (shouldQueue) {
|
|
3757
|
+
autoQueueRef.current.add(video.docId);
|
|
3758
|
+
try {
|
|
3759
|
+
const enqueued = await post('jobs', { docId: video.docId, describe: true }, { signal: controller.signal });
|
|
3760
|
+
if (!mounted.current) return;
|
|
3761
|
+
const job = enqueued && enqueued.job;
|
|
3762
|
+
if (job) {
|
|
3763
|
+
queued = true;
|
|
3764
|
+
jobsRef.current = [...jobsRef.current.filter((item) => item && item.docId !== job.docId), job];
|
|
3765
|
+
setJobs((current) => ({
|
|
3766
|
+
...current,
|
|
3767
|
+
jobs: jobsRef.current,
|
|
3768
|
+
}));
|
|
3769
|
+
void refreshJobs();
|
|
3770
|
+
}
|
|
3771
|
+
} catch (caught) {
|
|
3772
|
+
if (caught && caught.name === 'AbortError') return;
|
|
3773
|
+
queued = false; // 老 host / 网络错误:回退到内联总结,不能把解析弄坏
|
|
3774
|
+
}
|
|
3775
|
+
}
|
|
3776
|
+
// 后台已接手时不跑内联总结,等 job 完成后再回填;否则保持原来的内联行为。
|
|
3777
|
+
if (!queued) followUp = video;
|
|
3338
3778
|
} catch (caught) {
|
|
3339
3779
|
if (caught && caught.name === 'AbortError') return;
|
|
3340
3780
|
if (mounted.current) setError(friendlyResolveError(caught, text));
|
|
@@ -3343,7 +3783,7 @@ window.__ModuleLoader__.load({
|
|
|
3343
3783
|
if (resolveTicket.current === ticket && mounted.current) setResolveBusy(false);
|
|
3344
3784
|
}
|
|
3345
3785
|
if (followUp && hasTranscript(followUp) && !cachedSummary) void runSummary(followUp);
|
|
3346
|
-
}, [url, interruptActive, resetPanels, refreshHistory, runSummary, applyAnalysisCache]);
|
|
3786
|
+
}, [url, interruptActive, resetPanels, refreshHistory, runSummary, applyAnalysisCache, refreshJobs]);
|
|
3347
3787
|
|
|
3348
3788
|
/* ---- 追问:带最近 6 条 history 流式回答 ---- */
|
|
3349
3789
|
|
|
@@ -3506,11 +3946,17 @@ window.__ModuleLoader__.load({
|
|
|
3506
3946
|
void copy(lines.join('\n'), `已复制 ${items.length} 条字幕`);
|
|
3507
3947
|
};
|
|
3508
3948
|
|
|
3949
|
+
const jobList = Array.isArray(jobs.jobs) ? jobs.jobs.filter(Boolean) : [];
|
|
3950
|
+
const jobActiveCount = jobList.filter((job) => jobActive(job)).length;
|
|
3951
|
+
const jobsByDoc = buildJobsByDoc(jobs.jobs);
|
|
3952
|
+
const currentJob = doc ? jobsByDoc.get(doc.docId) : null;
|
|
3953
|
+
const jobsActiveCount = Number(jobs.active) > 0 ? Number(jobs.active) : Array.from(jobsByDoc.values()).filter(jobActive).length;
|
|
3954
|
+
|
|
3509
3955
|
let tabBody = null;
|
|
3510
3956
|
if (doc) {
|
|
3511
3957
|
if (tab === 'summary') {
|
|
3512
3958
|
tabBody = h(SummaryTab, {
|
|
3513
|
-
doc, summary,
|
|
3959
|
+
doc, summary, job: currentJob,
|
|
3514
3960
|
onRun: () => { void runSummary(doc); },
|
|
3515
3961
|
onStop: stopSummary,
|
|
3516
3962
|
onCopy: () => { void copy(summary.text, '已复制总结'); },
|
|
@@ -3575,6 +4021,7 @@ window.__ModuleLoader__.load({
|
|
|
3575
4021
|
/** 清空当前视频状态,回到插件首页(大输入框 + 最近分析)。 */
|
|
3576
4022
|
const resetToHome = useCallback(() => {
|
|
3577
4023
|
abortActive();
|
|
4024
|
+
autoQueueRef.current.clear();
|
|
3578
4025
|
docRef.current = null;
|
|
3579
4026
|
setDoc(null);
|
|
3580
4027
|
setUrl('');
|
|
@@ -3607,9 +4054,33 @@ window.__ModuleLoader__.load({
|
|
|
3607
4054
|
try { getLayoutService()?.selectPanel(null); } catch { /* 服务不可用:按钮已隐藏 */ }
|
|
3608
4055
|
};
|
|
3609
4056
|
|
|
3610
|
-
|
|
3611
|
-
const
|
|
3612
|
-
|
|
4057
|
+
/** 页签状态点:ready(有内容)/ loading(后台在跑且未生成)/ empty(还没生成)。 */
|
|
4058
|
+
const tabDotState = (id) => {
|
|
4059
|
+
const jobRunning = Boolean(currentJob && jobActive(currentJob));
|
|
4060
|
+
if (id === 'summary') {
|
|
4061
|
+
if (summary.text) return 'ready';
|
|
4062
|
+
return summary.loading || jobRunning ? 'loading' : 'empty';
|
|
4063
|
+
}
|
|
4064
|
+
if (id === 'chapters') {
|
|
4065
|
+
const items = outline.data && Array.isArray(outline.data.items) ? outline.data.items : [];
|
|
4066
|
+
if (items.length) return 'ready';
|
|
4067
|
+
return outline.loading || jobRunning ? 'loading' : 'empty';
|
|
4068
|
+
}
|
|
4069
|
+
if (id === 'transcript') {
|
|
4070
|
+
if (hasTranscript(doc)) return 'ready';
|
|
4071
|
+
return transcribe.loading || jobRunning ? 'loading' : 'empty';
|
|
4072
|
+
}
|
|
4073
|
+
if (id === 'storyboard') {
|
|
4074
|
+
const cells = storyboard.data && Array.isArray(storyboard.data.cells) ? storyboard.data.cells : [];
|
|
4075
|
+
if (cells.length) return 'ready';
|
|
4076
|
+
return storyboard.loading || jobRunning ? 'loading' : 'empty';
|
|
4077
|
+
}
|
|
4078
|
+
if (id === 'mindmap') {
|
|
4079
|
+
if (mindmap.data) return 'ready';
|
|
4080
|
+
return mindmap.loading || jobRunning ? 'loading' : 'empty';
|
|
4081
|
+
}
|
|
4082
|
+
return 'empty';
|
|
4083
|
+
};
|
|
3613
4084
|
|
|
3614
4085
|
const banners = [];
|
|
3615
4086
|
if (error) banners.push(h('div', { key: 'error', className: 'dvv-error' }, error));
|
|
@@ -3626,10 +4097,11 @@ window.__ModuleLoader__.load({
|
|
|
3626
4097
|
biliReady: Boolean(status && status.bilibili && status.bilibili.cookie),
|
|
3627
4098
|
onUrl: setUrl,
|
|
3628
4099
|
onSubmit: () => { void resolve(url); },
|
|
4100
|
+
onExample: (link) => { setUrl(link); void resolve(link); },
|
|
3629
4101
|
onGoSettings: openSettings,
|
|
3630
4102
|
}),
|
|
3631
4103
|
historyItems.length
|
|
3632
|
-
? h('div', { key: 'recent', className: 'dvv-home-recent' }, h(
|
|
4104
|
+
? h('div', { key: 'recent', className: 'dvv-home-recent' }, h(HistoryCards, {
|
|
3633
4105
|
items: historyItems, jobs: jobsByDoc, activeCount: jobsActiveCount,
|
|
3634
4106
|
parseAllBusy, parseAllConfirm,
|
|
3635
4107
|
onOpen: openHistoryItem,
|
|
@@ -3665,7 +4137,10 @@ window.__ModuleLoader__.load({
|
|
|
3665
4137
|
}),
|
|
3666
4138
|
h('div', { key: 'tabs', className: 'dvv-tabbar' }, TABS.map(([id, label]) => h('button', {
|
|
3667
4139
|
key: id, type: 'button', className: 'dvv-tab', 'data-active': tab === id ? 'true' : undefined, onClick: () => setTab(id),
|
|
3668
|
-
},
|
|
4140
|
+
}, [
|
|
4141
|
+
h('span', { key: 'l', className: 'dvv-tab-label' }, label),
|
|
4142
|
+
h('span', { key: 'd', className: 'dvv-tab-dot', 'data-state': tabDotState(id), 'aria-hidden': 'true' }),
|
|
4143
|
+
]))),
|
|
3669
4144
|
h('div', { key: 'pane', className: 'dvv-pane' }, tabBody),
|
|
3670
4145
|
]),
|
|
3671
4146
|
]);
|
|
@@ -3675,6 +4150,18 @@ window.__ModuleLoader__.load({
|
|
|
3675
4150
|
h(VideoToolbar, {
|
|
3676
4151
|
key: 'toolbar', doc, job: currentJob, historyCount: historyItems.length, canGoBack, onBack: goBack,
|
|
3677
4152
|
onCancelJob: (job) => { void cancelJob(job); },
|
|
4153
|
+
onRegenerate: (kind) => {
|
|
4154
|
+
const target = docRef.current;
|
|
4155
|
+
if (!target) return;
|
|
4156
|
+
if (kind === 'summary') void runSummary(target);
|
|
4157
|
+
else if (kind === 'mindmap') void loadMindmap(target, true);
|
|
4158
|
+
else if (kind === 'storyboard') void loadStoryboard(target, { force: true, describe: sbDescribe });
|
|
4159
|
+
},
|
|
4160
|
+
onExport: (kind) => {
|
|
4161
|
+
if (kind === 'markdown') void copyMarkdown();
|
|
4162
|
+
else if (kind === 'download') downloadMarkdown();
|
|
4163
|
+
else if (kind === 'fulltext') copyAllSegments(transcriptSegments(doc));
|
|
4164
|
+
},
|
|
3678
4165
|
onHistory: () => setOverlay(overlay === 'history' ? '' : 'history'),
|
|
3679
4166
|
onSettings: () => {
|
|
3680
4167
|
if (overlay === 'settings') { setOverlay(''); return; }
|
|
@@ -3691,6 +4178,9 @@ window.__ModuleLoader__.load({
|
|
|
3691
4178
|
}),
|
|
3692
4179
|
h('button', { key: 'go', type: 'button', className: 'dvv-btn', 'data-primary': 'true', disabled: resolveBusy, onClick: () => { void resolve(url); } }, resolveBusy ? '解析中…' : '解析'),
|
|
3693
4180
|
]) : null,
|
|
4181
|
+
jobActiveCount > 0 ? h(GlobalJobbar, {
|
|
4182
|
+
key: 'jobbar', jobs: jobList, onExpand: () => setOverlay(overlay === 'jobs' ? '' : 'jobs'),
|
|
4183
|
+
}) : null,
|
|
3694
4184
|
banners.length ? h('div', { key: 'banners', className: 'dvv-banners' }, banners) : null,
|
|
3695
4185
|
body,
|
|
3696
4186
|
overlay === 'history' ? h(HistoryDrawer, {
|
|
@@ -3705,6 +4195,19 @@ window.__ModuleLoader__.load({
|
|
|
3705
4195
|
onClear: () => { void clearHistory(); },
|
|
3706
4196
|
onClose: () => setOverlay(''),
|
|
3707
4197
|
}) : null,
|
|
4198
|
+
overlay === 'jobs' ? h(JobDrawer, {
|
|
4199
|
+
key: 'jobdrawer', jobs: jobList,
|
|
4200
|
+
onCancel: (job) => { void cancelJob(job); },
|
|
4201
|
+
onRetry: (job) => { void retryJob(job); },
|
|
4202
|
+
onOpen: (job) => {
|
|
4203
|
+
setOverlay('');
|
|
4204
|
+
const item = historyItems.find((entry) => entry.docId === job.docId)
|
|
4205
|
+
|| { docId: job.docId, url: job.url, title: job.title };
|
|
4206
|
+
openHistoryItem(item);
|
|
4207
|
+
},
|
|
4208
|
+
onClearDone: () => { void clearDoneJobs(); },
|
|
4209
|
+
onClose: () => setOverlay(''),
|
|
4210
|
+
}) : null,
|
|
3708
4211
|
overlay === 'settings' ? h(SettingsModal, {
|
|
3709
4212
|
key: 'modal', status, cookie, saving: savingCookie, note: cookieNote,
|
|
3710
4213
|
onCookie: (value) => setCookie(value),
|
|
@@ -3727,17 +4230,28 @@ window.__ModuleLoader__.load({
|
|
|
3727
4230
|
const CSS = `
|
|
3728
4231
|
.dvv-root{position:relative;display:flex;flex-direction:column;height:100%;min-height:0;background:var(--dsw-alias-bg-base,Canvas);color:var(--dsw-alias-label-primary,CanvasText)}
|
|
3729
4232
|
/* 顶部紧凑工具栏 */
|
|
3730
|
-
.dvv-toolbar{flex:none;display:flex;
|
|
4233
|
+
.dvv-toolbar{flex:none;display:flex;flex-direction:column;gap:4px;padding:8px 18px 6px;border-bottom:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.08))}
|
|
4234
|
+
.dvv-toolbar-row{display:flex;align-items:center;gap:10px;min-width:0}
|
|
3731
4235
|
.dvv-back{flex:none}
|
|
3732
|
-
.dvv-toolbar-cover{flex:none;width:
|
|
3733
|
-
.dvv-toolbar-cover .dvv-cover{width:
|
|
4236
|
+
.dvv-toolbar-cover{flex:none;width:56px}
|
|
4237
|
+
.dvv-toolbar-cover .dvv-cover{width:56px;aspect-ratio:16/9;border-radius:6px;object-fit:cover}
|
|
3734
4238
|
.dvv-toolbar-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
|
|
3735
|
-
.dvv-toolbar-title{font-size:14px;line-height:20px;font-weight:650;color:var(--dsw-alias-label-primary,inherit);text-decoration:none;
|
|
4239
|
+
.dvv-toolbar-title{font-size:14px;line-height:20px;font-weight:650;color:var(--dsw-alias-label-primary,inherit);text-decoration:none;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:break-all}
|
|
4240
|
+
.dvv-toolbar-title-plain{font-size:14px;line-height:20px;font-weight:650}
|
|
3736
4241
|
a.dvv-toolbar-title:hover{color:var(--dsw-alias-brand-primary)}
|
|
3737
4242
|
.dvv-toolbar-sub{font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,CanvasText)}
|
|
3738
4243
|
.dvv-toolbar-meta{display:flex;flex-wrap:wrap;align-items:center;gap:8px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,CanvasText)}
|
|
3739
4244
|
.dvv-toolbar-stats{font-variant-numeric:tabular-nums}
|
|
3740
|
-
.dvv-toolbar-actions{flex:none;display:flex;gap:8px}
|
|
4245
|
+
.dvv-toolbar-actions{flex:none;display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}
|
|
4246
|
+
.dvv-toolbar-author{font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary)}
|
|
4247
|
+
.dvv-meta{display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:1px 0 2px 66px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary)}
|
|
4248
|
+
.dvv-meta[data-collapsed="true"]{padding-left:66px}
|
|
4249
|
+
.dvv-meta-toggle{appearance:none;border:none;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:11px;line-height:16px;padding:0 2px;cursor:pointer;text-decoration:underline;text-underline-offset:2px}
|
|
4250
|
+
.dvv-meta-toggle:hover{color:var(--dsw-alias-brand-primary)}
|
|
4251
|
+
.dvv-menu{position:relative}
|
|
4252
|
+
.dvv-menu-pop{position:absolute;right:0;top:calc(100% + 4px);z-index:30;min-width:160px;display:flex;flex-direction:column;padding:4px;border-radius:10px;border:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.12));background:var(--dsw-alias-bg-overlay,#fff);box-shadow:0 8px 24px rgba(0,0,0,.16)}
|
|
4253
|
+
.dvv-menu-item{appearance:none;border:none;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:12px;line-height:18px;text-align:left;padding:6px 10px;border-radius:6px;cursor:pointer}
|
|
4254
|
+
.dvv-menu-item:hover{background:var(--dsw-alias-bg-layer-2,rgba(127,127,127,.14))}
|
|
3741
4255
|
.dvv-btn{appearance:none;border:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.14));background:transparent;color:var(--dsw-alias-label-primary,inherit);font:inherit;font-size:12px;line-height:22px;padding:2px 12px;border-radius:999px;cursor:pointer;white-space:nowrap}
|
|
3742
4256
|
.dvv-btn:hover{background:var(--dsw-alias-bg-layer-2,rgba(127,127,127,.14))}
|
|
3743
4257
|
.dvv-btn[data-primary="true"]{background:var(--dsw-alias-brand-primary);border-color:transparent;color:var(--dsw-alias-bg-base,Canvas);font-weight:600}
|
|
@@ -3767,14 +4281,40 @@ a.dvv-toolbar-title:hover{color:var(--dsw-alias-brand-primary)}
|
|
|
3767
4281
|
.dvv-home{flex:none;display:flex;flex-direction:column;gap:16px;width:100%;max-width:760px;margin:0 auto;padding:5vh 18px 10px}
|
|
3768
4282
|
.dvv-home-hero{display:flex;flex-direction:column;align-items:center;text-align:center;gap:12px}
|
|
3769
4283
|
.dvv-home-title{margin:0;font-size:26px;line-height:34px;font-weight:700;letter-spacing:-.4px;color:var(--dsw-alias-label-primary,inherit)}
|
|
3770
|
-
.dvv-home-sub{margin:0;max-width:560px;font-size:
|
|
4284
|
+
.dvv-home-sub{margin:0;max-width:560px;font-size:15px;line-height:24px;font-weight:550;color:var(--dsw-alias-label-primary)}
|
|
4285
|
+
.dvv-home-sub2{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
|
|
4286
|
+
.dvv-home-chips{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:2px}
|
|
4287
|
+
.dvv-home-chip{appearance:none;font:inherit;font-size:12px;line-height:18px;padding:5px 12px;border-radius:999px;cursor:pointer;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1,transparent);border:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.12));transition:border-color .15s ease,background .15s ease}
|
|
4288
|
+
.dvv-home-chip:hover{border-color:var(--dsw-alias-brand-primary);background:var(--dsw-alias-bg-layer-2,rgba(127,127,127,.1))}
|
|
4289
|
+
.dvv-home-chip:disabled{opacity:.55;cursor:not-allowed}
|
|
4290
|
+
.dvv-home-tip{font-size:11px;line-height:16px;color:var(--dsw-alias-label-secondary);opacity:.8}
|
|
3771
4291
|
.dvv-home-form{display:flex;gap:10px;width:100%;max-width:640px;margin-top:6px}
|
|
3772
4292
|
.dvv-home-input{flex:1;min-width:0;font:inherit;font-size:14px;line-height:26px;padding:9px 18px;border-radius:999px;border:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.14));background:var(--dsw-alias-bg-layer-1,transparent);color:inherit;outline:none;transition:border-color .15s ease,box-shadow .15s ease}
|
|
3773
4293
|
.dvv-home-input:focus{border-color:var(--dsw-alias-brand-primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--dsw-alias-brand-primary) 16%,transparent)}
|
|
3774
4294
|
.dvv-home-btn{flex:none;padding:0 22px;border-radius:999px;font-size:13px}
|
|
3775
4295
|
.dvv-home-hint{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:6px;font-size:12px;line-height:19px;color:var(--dsw-alias-label-secondary)}
|
|
3776
4296
|
.dvv-btn-mini{padding:0 10px;line-height:22px;font-size:12px;border-radius:999px}
|
|
3777
|
-
.dvv-home-recent{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;width:100%;max-width:
|
|
4297
|
+
.dvv-home-recent{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;width:100%;max-width:900px;margin:10px auto 0;padding:0 2px 18px}
|
|
4298
|
+
.dvv-recent-cards .dvv-recent-head{justify-content:flex-start}
|
|
4299
|
+
.dvv-cards-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:12px}
|
|
4300
|
+
.dvv-vcard{position:relative;display:flex;flex-direction:column;min-width:0;border-radius:12px;border:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.1));background:var(--dsw-alias-bg-layer-1,transparent);cursor:pointer;overflow:hidden;transition:border-color .15s ease,transform .12s ease}
|
|
4301
|
+
.dvv-vcard:hover{border-color:var(--dsw-alias-brand-primary);transform:translateY(-1px)}
|
|
4302
|
+
.dvv-vcard-cover{position:relative;aspect-ratio:16/9;background:var(--dsw-alias-bg-layer-2,rgba(127,127,127,.12));overflow:hidden}
|
|
4303
|
+
.dvv-vcard-cover .dvv-hist-cover{width:100%;height:100%;aspect-ratio:auto;border-radius:0;object-fit:cover}
|
|
4304
|
+
.dvv-vcard-dur{position:absolute;right:6px;bottom:6px;padding:1px 6px;border-radius:5px;background:var(--dsw-alias-bg-overlay,rgba(0,0,0,.55));color:var(--dsw-alias-label-primary);font-size:10px;line-height:15px;font-variant-numeric:tabular-nums}
|
|
4305
|
+
.dvv-vcard-plat{position:absolute;left:6px;top:6px}
|
|
4306
|
+
.dvv-vcard-body{display:flex;flex-direction:column;gap:4px;padding:8px 10px 6px;min-width:0}
|
|
4307
|
+
.dvv-vcard-title{font-size:13px;line-height:19px;font-weight:600;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:break-all}
|
|
4308
|
+
.dvv-vcard-sub{display:flex;flex-wrap:wrap;gap:8px;font-size:11px;line-height:16px;color:var(--dsw-alias-label-secondary)}
|
|
4309
|
+
.dvv-vcard-badges{display:flex;flex-wrap:wrap;gap:6px;margin-top:1px}
|
|
4310
|
+
.dvv-vcard-job{padding:0 10px 8px}
|
|
4311
|
+
.dvv-vcard .dvv-job-failed{display:block;padding:0 10px 8px}
|
|
4312
|
+
.dvv-vcard-actions{position:absolute;right:6px;top:6px;display:flex;align-items:center;gap:4px;opacity:0;transition:opacity .15s ease}
|
|
4313
|
+
.dvv-vcard:hover .dvv-vcard-actions,.dvv-vcard:focus-within .dvv-vcard-actions{opacity:1}
|
|
4314
|
+
.dvv-vcard-more{width:22px;height:22px;border-radius:50%;border:none;padding:0;line-height:20px;text-align:center;cursor:pointer;background:var(--dsw-alias-bg-overlay,rgba(0,0,0,.5));color:var(--dsw-alias-label-primary);font-size:14px}
|
|
4315
|
+
.dvv-vcard-menu{position:absolute;right:0;top:26px;z-index:25;display:flex;flex-direction:column;min-width:132px;padding:4px;border-radius:10px;border:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.12));background:var(--dsw-alias-bg-overlay,#fff);box-shadow:0 8px 24px rgba(0,0,0,.18)}
|
|
4316
|
+
.dvv-vcard-mi{appearance:none;border:none;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:12px;line-height:18px;text-align:left;padding:6px 10px;border-radius:6px;cursor:pointer;white-space:nowrap}
|
|
4317
|
+
.dvv-vcard-mi:hover{background:var(--dsw-alias-bg-layer-2,rgba(127,127,127,.14))}
|
|
3778
4318
|
.dvv-home-none{flex:none;width:100%;max-width:640px;margin:14px auto 0;padding:18px 0;text-align:center;font-size:12px;color:var(--dsw-alias-label-secondary)}
|
|
3779
4319
|
.dvv-cover{flex:none;width:212px;aspect-ratio:16/9;border-radius:10px;overflow:hidden;background:var(--dsw-alias-bg-layer-2,rgba(127,127,127,.12))}
|
|
3780
4320
|
.dvv-cover img{display:block;width:100%;height:100%;object-fit:cover}
|
|
@@ -3788,6 +4328,11 @@ a.dvv-toolbar-title:hover{color:var(--dsw-alias-brand-primary)}
|
|
|
3788
4328
|
.dvv-tab{appearance:none;border:none;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:13px;line-height:24px;padding:3px 14px;border-radius:999px;cursor:pointer}
|
|
3789
4329
|
.dvv-tab:hover{background:var(--dsw-alias-bg-layer-2,rgba(127,127,127,.12));color:var(--dsw-alias-label-primary)}
|
|
3790
4330
|
.dvv-tab[data-active="true"]{background:var(--dsw-alias-bg-layer-2,rgba(127,127,127,.16));color:var(--dsw-alias-label-primary);font-weight:600}
|
|
4331
|
+
.dvv-tab{display:inline-flex;align-items:center;gap:6px}
|
|
4332
|
+
.dvv-tab-dot{width:6px;height:6px;border-radius:50%;flex:none;background:var(--dsw-alias-label-secondary);opacity:.35}
|
|
4333
|
+
.dvv-tab-dot[data-state="ready"]{background:var(--dsw-alias-brand-primary);opacity:1}
|
|
4334
|
+
.dvv-tab-dot[data-state="loading"]{background:var(--dsw-alias-brand-primary);opacity:.9;animation:dvv-pulse 1.1s ease-in-out infinite}
|
|
4335
|
+
@keyframes dvv-pulse{0%,100%{transform:scale(1);opacity:.45}50%{transform:scale(1.35);opacity:1}}
|
|
3791
4336
|
.dvv-tabpane{padding-top:8px}
|
|
3792
4337
|
.dvv-pane{flex:1;min-height:0;overflow:auto;padding:4px 0 8px}
|
|
3793
4338
|
.dvv-md{font-size:13.5px;line-height:24px;color:var(--dsw-alias-label-primary,inherit)}
|
|
@@ -3807,11 +4352,35 @@ a.dvv-toolbar-title:hover{color:var(--dsw-alias-brand-primary)}
|
|
|
3807
4352
|
.dvv-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:10px 0 2px}
|
|
3808
4353
|
.dvv-actions-spacer{flex:1}
|
|
3809
4354
|
.dvv-btn[disabled]{opacity:.55;cursor:not-allowed}
|
|
4355
|
+
.dvv-bg-block{flex-wrap:wrap}
|
|
4356
|
+
.dvv-bg-block .dvv-note{width:100%;margin:0}
|
|
3810
4357
|
.dvv-loading-block{display:flex;align-items:center;gap:8px;padding:14px 0;font-size:12px;line-height:19px;color:var(--dsw-alias-label-secondary)}
|
|
3811
4358
|
.dvv-spinner{display:inline-block;width:12px;height:12px;border-radius:50%;border:2px solid var(--dsw-alias-border-l2,rgba(127,127,127,.35));border-top-color:var(--dsw-alias-brand-primary);animation:dvv-spin .8s linear infinite}
|
|
3812
4359
|
@keyframes dvv-spin{to{transform:rotate(360deg)}}
|
|
3813
4360
|
.dvv-notice{border:1px dashed var(--dsw-alias-border-l1,rgba(0,0,0,.14));border-radius:10px;padding:12px 14px;margin:8px 0}
|
|
4361
|
+
.dvv-state{display:flex;flex-direction:column;align-items:flex-start;gap:8px;padding:18px 16px;margin:8px 0;border:1px dashed var(--dsw-alias-border-l1,rgba(0,0,0,.14));border-radius:12px}
|
|
4362
|
+
.dvv-state-title{font-size:13px;line-height:20px;font-weight:600;color:var(--dsw-alias-label-primary)}
|
|
4363
|
+
.dvv-state-note{font-size:12px;line-height:19px;color:var(--dsw-alias-label-secondary)}
|
|
4364
|
+
.dvv-state-error{border-color:var(--dsw-alias-state-error-primary,var(--dsw-alias-border-l1))}
|
|
4365
|
+
.dvv-state-error .dvv-state-title{color:var(--dsw-alias-state-error-primary,inherit)}
|
|
4366
|
+
.dvv-state-loading{gap:6px;border-style:solid}
|
|
4367
|
+
.dvv-skel-lines{display:flex;flex-direction:column;gap:8px;width:100%}
|
|
4368
|
+
.dvv-state-loading .dvv-skel{height:14px;border-radius:6px;margin:0}
|
|
3814
4369
|
.dvv-notice-title{font-size:13px;line-height:20px;font-weight:600;margin-bottom:4px}
|
|
4370
|
+
.dvv-sum{display:flex;flex-direction:column;gap:12px}
|
|
4371
|
+
.dvv-sum-big{padding:14px 16px;border-radius:14px;border:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.1));background:var(--dsw-alias-bg-layer-1,transparent)}
|
|
4372
|
+
.dvv-sum-big-title{font-size:11px;line-height:16px;letter-spacing:.06em;text-transform:uppercase;color:var(--dsw-alias-label-secondary);margin-bottom:4px}
|
|
4373
|
+
.dvv-sum-big .dvv-sum-md{font-size:22px;line-height:32px;font-weight:700;letter-spacing:-.2px;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
|
|
4374
|
+
.dvv-sum-big .dvv-sum-md p{margin:0}
|
|
4375
|
+
.dvv-sum-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
|
|
4376
|
+
.dvv-sum-card{display:flex;flex-direction:column;gap:6px;padding:12px 14px;border-radius:12px;border:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.1));background:var(--dsw-alias-bg-layer-1,transparent);min-width:0}
|
|
4377
|
+
.dvv-sum-card-title{font-size:12px;line-height:18px;font-weight:650;color:var(--dsw-alias-label-primary)}
|
|
4378
|
+
.dvv-sum-card .dvv-md{font-size:12px;line-height:19px}
|
|
4379
|
+
.dvv-sum-fold{border-top:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.1));padding-top:8px}
|
|
4380
|
+
.dvv-sum-fold-head{appearance:none;border:none;background:transparent;font:inherit;width:100%;display:flex;align-items:center;gap:8px;padding:4px 0;cursor:pointer;color:var(--dsw-alias-label-primary)}
|
|
4381
|
+
.dvv-sum-fold-title{font-size:13px;line-height:20px;font-weight:600}
|
|
4382
|
+
.dvv-sum-fold-arrow{margin-left:auto;font-size:11px;color:var(--dsw-alias-label-secondary)}
|
|
4383
|
+
.dvv-sum-fold .dvv-md{font-size:13px;line-height:21px}
|
|
3815
4384
|
.dvv-official{border:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.1));border-radius:10px;padding:10px 12px;margin:10px 0;background:var(--dsw-alias-bg-layer-1,transparent)}
|
|
3816
4385
|
.dvv-skel{height:44px;border-radius:10px;margin-bottom:8px;background:linear-gradient(90deg,var(--dsw-alias-bg-layer-1,rgba(127,127,127,.08)) 25%,var(--dsw-alias-bg-layer-2,rgba(127,127,127,.18)) 37%,var(--dsw-alias-bg-layer-1,rgba(127,127,127,.08)) 63%);background-size:400% 100%;animation:dvv-shimmer 1.3s ease infinite}
|
|
3817
4386
|
@keyframes dvv-shimmer{0%{background-position:100% 0}100%{background-position:0 0}}
|
|
@@ -3899,6 +4468,18 @@ a.dvv-toolbar-title:hover{color:var(--dsw-alias-brand-primary)}
|
|
|
3899
4468
|
.dvv-home-recent .dvv-recent-head{justify-content:center;padding:2px 0 10px}
|
|
3900
4469
|
.dvv-recent-head{display:flex;align-items:baseline;gap:8px;padding:2px 0 8px}
|
|
3901
4470
|
.dvv-hist-list{display:flex;flex-direction:column;gap:2px}
|
|
4471
|
+
.dvv-jobbar-global{flex:none;display:flex;align-items:center;gap:8px;margin:0 18px;padding:6px 10px;border-radius:8px;border:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.1));background:var(--dsw-alias-bg-layer-1,transparent);font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary)}
|
|
4472
|
+
.dvv-jobbar-global-dot{width:6px;height:6px;border-radius:50%;background:var(--dsw-alias-brand-primary);animation:dvv-pulse 1.1s ease-in-out infinite}
|
|
4473
|
+
.dvv-jobbar-global-text{color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums}
|
|
4474
|
+
.dvv-jobbar-global-stage{color:var(--dsw-alias-label-secondary)}
|
|
4475
|
+
.dvv-jd-section{display:flex;flex-direction:column;gap:6px;padding:10px 0 4px;border-bottom:1px solid var(--dsw-alias-border-l1,rgba(0,0,0,.08))}
|
|
4476
|
+
.dvv-jd-head{font-size:11px;line-height:16px;letter-spacing:.05em;color:var(--dsw-alias-label-secondary)}
|
|
4477
|
+
.dvv-jd-row{display:flex;align-items:flex-start;gap:10px;padding:6px 0}
|
|
4478
|
+
.dvv-jd-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
|
|
4479
|
+
.dvv-jd-title{font-size:13px;line-height:19px;font-weight:550;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
4480
|
+
.dvv-jd-sub{font-size:11px;line-height:16px;color:var(--dsw-alias-label-secondary)}
|
|
4481
|
+
.dvv-jd-row[data-status="failed"] .dvv-jd-sub{color:var(--dsw-alias-state-error-primary,#c0392b)}
|
|
4482
|
+
.dvv-jd-actions{flex:none;display:flex;gap:6px}
|
|
3902
4483
|
.dvv-hist-sub{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:2px;font-size:11px;line-height:16px;color:var(--dsw-alias-label-secondary)}
|
|
3903
4484
|
/* 历史搜索 / 收藏筛选 / 星标(第 5 步) */
|
|
3904
4485
|
.dvv-hist-bar{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:2px 0 8px}
|
|
@@ -4093,7 +4674,7 @@ a.dvv-toolbar-title:hover{color:var(--dsw-alias-brand-primary)}
|
|
|
4093
4674
|
apply,
|
|
4094
4675
|
inject,
|
|
4095
4676
|
// 布局是纯函数,暴露给测试直接断言坐标/连线(Host 会忽略额外字段)。
|
|
4096
|
-
__test: { buildMindmapLayout, mindmapTextLines, defaultMindmapExpanded, allMindmapPaths, renderMarkdown, clockToSeconds, buildNoteMarkdown, sanitizeFileName, JOBS_ACTIVE_MS, JOBS_IDLE_MS },
|
|
4677
|
+
__test: { buildMindmapLayout, mindmapTextLines, defaultMindmapExpanded, allMindmapPaths, renderMarkdown, clockToSeconds, buildNoteMarkdown, sanitizeFileName, parseSummarySections, JOBS_ACTIVE_MS, JOBS_IDLE_MS },
|
|
4097
4678
|
};
|
|
4098
4679
|
return exports_;
|
|
4099
4680
|
},
|
package/lib/index.js
CHANGED
|
@@ -64,7 +64,7 @@ export const name = 'dsh-video-insight';
|
|
|
64
64
|
/** Route prefix the panel calls; same origin as the GUI, so no CORS preflight. */
|
|
65
65
|
export const API_PREFIX = '/dsh-video/api';
|
|
66
66
|
|
|
67
|
-
const VERSION = '0.
|
|
67
|
+
const VERSION = '0.10.0';
|
|
68
68
|
const CREDENTIALS_FILE = join(homedir(), '.dsh', 'video-credentials.json');
|
|
69
69
|
|
|
70
70
|
const DEFAULTS = {
|
|
@@ -773,7 +773,7 @@ function createApiHandler(aiCtx, config) {
|
|
|
773
773
|
|
|
774
774
|
// 后台解析队列:同一视频不重复排队,并发数可在 profile 的 jobs.concurrency 里调。
|
|
775
775
|
const jobQueue = createJobQueue({
|
|
776
|
-
concurrency: Number(config?.jobs?.concurrency)
|
|
776
|
+
concurrency: Number.isFinite(Number(config?.jobs?.concurrency)) ? Number(config?.jobs?.concurrency) : 0,
|
|
777
777
|
execute: (job, helpers) => runFullJob(job, helpers, { aiCtx, config, resolverFor }),
|
|
778
778
|
});
|
|
779
779
|
|
package/lib/jobs.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* 并发数默认 2(可在 profile 配置里调),同一视频不会重复排队。
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
const DEFAULT_CONCURRENCY =
|
|
9
|
+
const DEFAULT_CONCURRENCY = 0;
|
|
10
10
|
const MAX_RECORDS = 80;
|
|
11
11
|
const ACTIVE = new Set(['queued', 'running']);
|
|
12
12
|
|
|
@@ -39,7 +39,9 @@ function snapshot(job) {
|
|
|
39
39
|
* @param {(job: object, helpers: object) => Promise<void>} options.execute 真正干活
|
|
40
40
|
*/
|
|
41
41
|
export function createJobQueue({ concurrency = DEFAULT_CONCURRENCY, execute } = {}) {
|
|
42
|
-
|
|
42
|
+
// 0 = 不限制:提交几个就跑几个(默认就是不限,LLM 步骤自带重试,压不住的失败会记在任务里)。
|
|
43
|
+
const requested = Math.round(Number(concurrency));
|
|
44
|
+
const limit = Number.isFinite(requested) && requested >= 0 ? Math.min(16, requested) : DEFAULT_CONCURRENCY;
|
|
43
45
|
const jobs = new Map();
|
|
44
46
|
const queue = [];
|
|
45
47
|
let running = 0;
|
|
@@ -65,7 +67,7 @@ export function createJobQueue({ concurrency = DEFAULT_CONCURRENCY, execute } =
|
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
function pump() {
|
|
68
|
-
while (running < limit && queue.length) {
|
|
70
|
+
while ((limit <= 0 || running < limit) && queue.length) {
|
|
69
71
|
const job = queue.shift();
|
|
70
72
|
if (!job || job.status !== 'queued') continue;
|
|
71
73
|
job.status = 'running';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-video-insight",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "在 DeepSeek Harness 里快速分析视频:左侧栏「视频解析」面板,粘贴 YouTube / 哔哩哔哩链接,自动抓字幕并生成总结、章节、要点、原文与追问;无字幕时可用本机 Whisper / SenseVoice 转写兜底(音频不出本机),纯无声视频还能用画面文字识别(OCR)或视觉模型描述画面;右栏有 AI 思维导图;追问是基于转写稿的 RAG 问答(回答带「依据」时间戳);分析结果按视频缓存,历史记录可回看。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Jerry (Azerz)",
|