@lynn123411/dsh-chat-translate 3.3.1 → 3.4.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/README.md +15 -6
- package/docs//351/205/215/347/275/256.md +5 -5
- package/lib/client.js +118 -106
- package/lib/client.js.map +3 -3
- package/lib/index.js +5 -5
- package/lib/index.js.map +2 -2
- package/lib/types/client/chat/assistant-step.d.ts +7 -7
- package/lib/types/client/chat/click-guard.d.ts +7 -7
- package/lib/types/client/chat/row-plan.d.ts +24 -19
- package/lib/types/client/chat/styles.d.ts +31 -47
- package/lib/types/client/chat/translate-store.d.ts +9 -6
- package/lib/types/client/locales.d.ts +13 -8
- package/lib/types/server/dispatcher.d.ts +2 -2
- package/package.json +13 -13
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* 1. 正文块从数据层拿**原始 markdown**(`AssistantBlock.text`),译文同样按
|
|
7
7
|
* markdown 交给宿主公开基线组件 `MarkdownText` 重渲染:格式保真由官方
|
|
8
8
|
* 渲染器负责,本文件不产生任何自拼 markup。
|
|
9
|
-
* 2.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
9
|
+
* 2. 「翻成了没有」是渲染状态:落定、开关开启、进入视口后逐行首跑;成功的块
|
|
10
|
+
* (包括模型认为原样最好的块)换成中文渲染,失败的块保持原文。
|
|
11
|
+
*
|
|
12
|
+
* 正文左缘不画任何东西,正文排版与宿主默认逐字一致。可点的只有左缘之外的两样:
|
|
13
|
+
* 成功块的译文/原文切换归一条 6px 透明窄带(正文一个像素都不占),失败块的补跑
|
|
14
|
+
* 归一个真的 ↻ 按钮(浮在正文左侧的空隙里)。正文整块不是点击目标,所以单击
|
|
15
|
+
* 落字、拖选复制都不会误触。补跑在途时 ↻ 原位转圈、暂不可重复点。
|
|
16
16
|
*
|
|
17
17
|
* 除正文外的行内容与宿主逐分支等价:reasoning 行走折叠(含 Turn-process
|
|
18
18
|
* 隐藏与 beforematch 揭示)、连续 image 组交回 owner 的 renderMessageImages、
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 左缘窄带的点击判定:只有「按下与松手都落在窄带上」的干净点击才切换译文/原文。
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* 会派发给两者的公共祖先,target
|
|
7
|
-
* click
|
|
4
|
+
* 窄带没有子元素,所以浏览器派发过来的 click 若 `target === currentTarget`,
|
|
5
|
+
* 就说明按下与松手都在窄带里;反之(在窄带上按下、往右拖进正文选字再松手)click
|
|
6
|
+
* 会派发给两者的公共祖先,target 不是窄带,天然判为拖选。这不是启发式,是
|
|
7
|
+
* click 事件的分派语义——正文整块不是点击目标,误触从根上消失。
|
|
8
8
|
* 纯 DOM 判定,不依赖 React,可独立测试。
|
|
9
9
|
*/
|
|
10
10
|
interface MinimalPointerEvent {
|
|
11
11
|
/** 点击命中的最深元素。 */
|
|
12
12
|
target: unknown;
|
|
13
|
-
/**
|
|
13
|
+
/** 挂了本守卫的窄带元素本身。 */
|
|
14
14
|
currentTarget: unknown;
|
|
15
15
|
}
|
|
16
16
|
interface MinimalWindow {
|
|
@@ -22,7 +22,7 @@ interface MinimalWindow {
|
|
|
22
22
|
/**
|
|
23
23
|
* @param event - click 事件(结构面:target/currentTarget)。
|
|
24
24
|
* @param view - 可注入的 window(测试传假对象;运行时传全局 window)。
|
|
25
|
-
* @returns
|
|
25
|
+
* @returns 该点击是否应当触发切换。
|
|
26
26
|
*/
|
|
27
27
|
export declare function isCleanHotspotClick(event: MinimalPointerEvent, view: MinimalWindow | undefined): boolean;
|
|
28
28
|
export {};
|
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
* groupPart 怎么过滤、tool-call 块为什么在这里被跳过(工具行是 flow 里
|
|
7
7
|
* 独立的行,由宿主自己渲染)、连续 image 怎么合成一组、未知块落 JSON、
|
|
8
8
|
* 「已停止」标记的出现条件。
|
|
9
|
-
* 2.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* 空白块(trim
|
|
16
|
-
*
|
|
9
|
+
* 2. 翻译呈现的单点判断:正文块左缘出现什么。判据一次算清:成功落定=翻成了
|
|
10
|
+
* (`translated`,原始 mark 里没有「读原文」这一态——它由 `showingOriginal`
|
|
11
|
+
* 单点承载,所以切回原文后仍然切得回来);失败=留下补跑标记(`failed`,
|
|
12
|
+
* `fail` 一句技术细节只喂悬停文案,`retryBusy` 说 ↻ 此刻是否在原地转圈);
|
|
13
|
+
* 其余(空白块、流式、开关关、未登记、还没有结果的块)= 左缘什么都不出现。
|
|
14
|
+
* 模型原样返回同样算成功:标记传达「这段过了模型」,不是「变过」。
|
|
15
|
+
* 空白块(trim 后为空)不进送译清单、不占下标、永不标记——它没送过模型,
|
|
16
|
+
* 重试也永远不会成,标记只会留下消不掉的东西。
|
|
17
17
|
*
|
|
18
|
-
* 渲染层(assistant-step.tsx)只消费 mark
|
|
19
|
-
*
|
|
18
|
+
* 渲染层(assistant-step.tsx)只消费 mark 与两个附加位;改动这里的等价分支必须
|
|
19
|
+
* 同时对照宿主实现。
|
|
20
20
|
*/
|
|
21
21
|
import type { BlockOutcome } from './translate-store.ts';
|
|
22
22
|
import type { ProseMark } from './styles.ts';
|
|
@@ -36,10 +36,10 @@ export type RowPlanEntry =
|
|
|
36
36
|
text: string;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
* 正文块:mark
|
|
40
|
-
*
|
|
41
|
-
* fail 仅在 mark==='failed' 时非 null——服务端的技术一句,
|
|
42
|
-
*
|
|
39
|
+
* 正文块:mark 即左缘标记状态(类名与左缘动作全由它决定);translated 仅在
|
|
40
|
+
* 成功时非 null;showingOriginal 是同一份成功结果上的显示源选择(成功块的
|
|
41
|
+
* 译文/原文切换);fail 仅在 mark==='failed' 时非 null——服务端的技术一句,
|
|
42
|
+
* 供悬停报因;retryBusy 仅在失败块补跑在途时为 true——↻ 原地转圈、暂不可重复点。
|
|
43
43
|
*/
|
|
44
44
|
| {
|
|
45
45
|
type: 'prose';
|
|
@@ -47,7 +47,9 @@ export type RowPlanEntry =
|
|
|
47
47
|
text: string;
|
|
48
48
|
translated: string | null;
|
|
49
49
|
mark: ProseMark;
|
|
50
|
+
showingOriginal: boolean;
|
|
50
51
|
fail: string | null;
|
|
52
|
+
retryBusy: boolean;
|
|
51
53
|
} | {
|
|
52
54
|
type: 'images';
|
|
53
55
|
key: number;
|
|
@@ -74,17 +76,20 @@ export interface RowPlanInput {
|
|
|
74
76
|
interrupted: boolean;
|
|
75
77
|
/** flow 分组:'reasoning' 只要思考块,'response' 排除思考块,缺省全要。 */
|
|
76
78
|
groupPart?: string;
|
|
77
|
-
/** 可译门(enabled 且通道三要素齐备):false
|
|
79
|
+
/** 可译门(enabled 且通道三要素齐备):false 时一切按原文呈现,左缘不出现任何东西。 */
|
|
78
80
|
canTranslate: boolean;
|
|
79
81
|
/**
|
|
80
82
|
* 该行正文块的翻译结果,与 texts 同下标;null = 该批尚未落定。
|
|
81
83
|
* 未登记或换代时整个缺省。
|
|
82
84
|
*/
|
|
83
85
|
outcomes?: readonly (BlockOutcome | null)[];
|
|
84
|
-
/**
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
/**
|
|
87
|
+
* 这一轮在途是不是用户点 ↻ 发起的补跑:只有它让失败块的 ↻ 转圈。
|
|
88
|
+
* 首跑在途(还有批没回)不转——用户没点过它。
|
|
89
|
+
*/
|
|
90
|
+
rowRetrying?: boolean;
|
|
91
|
+
/** 用户点了「读原文」的正文块(按条目 key):成功块改回原文渲染,
|
|
92
|
+
* 触发它的是左缘窄带上的切换,不是点正文。 */
|
|
88
93
|
originalKeys?: ReadonlySet<number>;
|
|
89
94
|
}
|
|
90
95
|
export declare function planAssistantRow(input: RowPlanInput): RowPlan;
|
|
@@ -1,64 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 助手行接管所需的样式:与宿主 `AssistantMarkdown` / `ReasoningRow` 逐条对齐
|
|
3
|
-
* 的等价规则(字号、行距、gap、粘性折叠头、running 微光、summary
|
|
4
|
-
* 加上本插件唯一新增的视觉词汇——正文块左缘的线与贴着它的那条热区:
|
|
5
|
-
* 蓝粗线(1px 主色)=正在读译文;灰细线(0.5px 中性)=有译文但正在读原文
|
|
6
|
-
* (再点即切回);红实线(1px error 色)=翻译失败(通道伤:超时、断流、空
|
|
7
|
-
* 返回);灰脉动=整行在途、这块尚无结果;无线=没送过模型(含空白块)或开关关闭。
|
|
8
|
-
* 译文的结构漂移不再挂红线——由宿主按原文修回、重掷或照收,红线只剩通道伤一种。
|
|
3
|
+
* 的等价规则(字号、行距、gap、粘性折叠头、running 微光、summary 遮罩等)。
|
|
9
4
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* 加亮,粗细始终只表示译文/原文。失败块的 ↻ 常驻在红线旁,是补跑的可见入口。
|
|
5
|
+
* 正文左缘**不画任何东西**——没有竖线、没有脉动、也没有缩进:正文的排版与宿主
|
|
6
|
+
* 默认完全一致。标记只剩两种语义类,且都只是状态钩子、不带任何绘制规则:
|
|
7
|
+
* `dsh-ct-prose-translated`(有译文)与 `dsh-ct-prose-failed`(失败)。
|
|
14
8
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
9
|
+
* 交互压到左缘之外的两个东西上:
|
|
10
|
+
* 1. 成功块的可点面是 `dsh-ct-hotspot`——正文左缘外侧那条 6px 透明窄带。它整条
|
|
11
|
+
* 落在正文之外(不占正文一个像素),切换译文与原文都由它承载。
|
|
12
|
+
* 2. 失败块的可点面是 `dsh-ct-retry`——一个真的 button(小 ↻),浮在正文左缘
|
|
13
|
+
* 外侧更远一点的位置;补跑在途时它原位转圈(`data-busy`),不重挂载。
|
|
14
|
+
*
|
|
15
|
+
* 两者都不给可见的焦点框:键盘可以聚焦,但界面不加任何标记——这是明说的取舍。
|
|
16
|
+
* 悬停也不改任何视觉,只有指针变手型。动画声明尊重 `prefers-reduced-motion`。
|
|
17
|
+
* 样式随 bundle 注入一次(`<style data-plugin-css>`),类名用固定前缀,不依赖
|
|
18
|
+
* 宿主哈希类名。
|
|
18
19
|
*/
|
|
19
20
|
export declare const ASSISTANT_CSS: string;
|
|
20
21
|
/**
|
|
21
|
-
*
|
|
22
|
-
* mark
|
|
23
|
-
*
|
|
22
|
+
* 正文块的状态词汇:只剩「翻成了」与「没翻成」两种。单点在 row-plan 算出
|
|
23
|
+
* (`planAssistantRow` 直接产出 mark),渲染层只消费、样式层只翻成类名。
|
|
24
|
+
* 「这块当前显示译文还是原文」不再是一种 mark——它是同一份成功结果上的显示
|
|
25
|
+
* 源选择(`showingOriginal`),所以切回原文后标记不变、也仍然切得回来。
|
|
24
26
|
*/
|
|
25
|
-
export type ProseMark = 'translated' | '
|
|
26
|
-
/** mark →
|
|
27
|
+
export type ProseMark = 'translated' | 'failed' | null;
|
|
28
|
+
/** mark → 左缘动作单点:切换、补跑、没有可点物三选一(渲染层照此接线)。 */
|
|
27
29
|
export type ProseAction = 'toggle' | 'retry' | null;
|
|
28
|
-
/**
|
|
29
|
-
* mark → 正文块类名与热区动作的单点表。
|
|
30
|
-
*
|
|
31
|
-
* 一张表而不是两个并列 switch:线型(类名)与可点性(动作)从同一行读出来,
|
|
32
|
-
* 加一种 mark 时不可能只改一处、留下「有线但点不动」或「可点但没有线」的
|
|
33
|
-
* 半截状态。`action` 为 null 表示没有热区——没线的块(没送过模型、开关关闭、
|
|
34
|
-
* 通道没配好、空白块)没有可切换的东西。
|
|
35
|
-
*/
|
|
36
|
-
interface ProsePresentation {
|
|
37
|
-
/** 正文块的状态类名;null 的块只有基础类。 */
|
|
38
|
-
className: string | null;
|
|
39
|
-
/** 热区动作:切换、补跑、或没有热区。 */
|
|
40
|
-
action: ProseAction;
|
|
41
|
-
}
|
|
42
|
-
/** 每个正文块都挂的基础类:定位父级(热区以它为基准绝对定位)。 */
|
|
30
|
+
/** 每个正文块都挂的基础类:窄带与 ↻ 的定位父级。 */
|
|
43
31
|
export declare const PROSE_BASE_CLASS = "dsh-ct-prose";
|
|
44
|
-
|
|
45
|
-
/** mark → 热区动作({@link prosePresentation} 的窄读法,测试与渲染层共用)。 */
|
|
32
|
+
/** mark → 左缘动作({@link prosePresentation} 的窄读法,测试与渲染层共用)。 */
|
|
46
33
|
export declare function proseAction(mark: ProseMark): ProseAction;
|
|
47
34
|
/**
|
|
48
|
-
* mark →
|
|
49
|
-
*
|
|
35
|
+
* mark → 正文块类名单点:只有语义状态类。点击不在这层——正文整块不可点,
|
|
36
|
+
* 切换归左缘窄带、补跑归 ↻({@link HOTSPOT_CLASS} / {@link RETRY_CLASS})。
|
|
50
37
|
*/
|
|
51
38
|
export declare function proseClassNames(mark: ProseMark): string | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* 缩进单点:能翻译(开关开 + 通道齐备)时所有正文块一律左缩进,与「这块是否
|
|
54
|
-
* 已挂线」无关——译文落定的那一刻正文不右移,块与块左缘也对齐;关掉开关或
|
|
55
|
-
* 通道没配好时不缩进,排版回到宿主原样(此时正文会横移一次,是刻意的取舍)。
|
|
56
|
-
*/
|
|
57
|
-
export declare function proseIndentClassName(canTranslate: boolean): string | undefined;
|
|
58
|
-
/** 左缘热区的类名单点:切换/补跑的唯一点击目标。 */
|
|
39
|
+
/** 成功块的可点窄带类名:左缘外 6px 的透明带子,切换译文/原文。 */
|
|
59
40
|
export declare const HOTSPOT_CLASS = "dsh-ct-hotspot";
|
|
60
|
-
/**
|
|
61
|
-
export declare const
|
|
41
|
+
/** 失败块的 ↻ 类名:一个真的 button,点它整行补跑。 */
|
|
42
|
+
export declare const RETRY_CLASS = "dsh-ct-retry";
|
|
43
|
+
/** 补跑在途态:挂在 ↻ 自己身上(同一个节点,只换属性,不重挂载)。 */
|
|
44
|
+
export declare const RETRY_BUSY_ATTR = "data-busy";
|
|
45
|
+
/** ↻ 的转圈图标类名(转的是图标本身,按钮位置不动)。 */
|
|
46
|
+
export declare const RETRY_SPIN_CLASS = "dsh-ct-retry-spin";
|
|
62
47
|
/** 注入接管样式;重复调用是空操作。 */
|
|
63
48
|
export declare function ensureAssistantStyles(): void;
|
|
64
|
-
export {};
|
|
@@ -12,12 +12,15 @@ export interface BlockOutcome {
|
|
|
12
12
|
* 一行正文的翻译状态。outcomes 与 texts 同下标,null = 该块所在批尚未落定:
|
|
13
13
|
* 每批返回就地填入并通知,长回答按阅读顺序逐段出中文,不憋到最后一批。
|
|
14
14
|
* 全部批落定后 status 转 settled——落定即终态:这里没有任何自动补跑,
|
|
15
|
-
*
|
|
15
|
+
* 失败块的救活只由用户点击 ↻ 发起(ensure 的 manual 参数)。
|
|
16
|
+
* retrying = 这一轮在途是用户手点的补跑:失败块的 ↻ 因此原位转圈;首次自动
|
|
17
|
+
* 首跑即使已有批失败也不转圈(用户没点过它)。
|
|
16
18
|
*/
|
|
17
19
|
export interface RowState {
|
|
18
20
|
status: 'pending' | 'settled';
|
|
19
21
|
texts: readonly string[];
|
|
20
22
|
outcomes: readonly (BlockOutcome | null)[];
|
|
23
|
+
retrying: boolean;
|
|
21
24
|
}
|
|
22
25
|
/** 送译一行正文的取数面:默认走宿主路由,测试注入假实现。 */
|
|
23
26
|
export type ReplyFetcher = (texts: string[]) => Promise<ReplyBlockResult[]>;
|
|
@@ -37,10 +40,10 @@ export declare function chunkTexts(texts: readonly string[]): string[][];
|
|
|
37
40
|
* 行键由渲染层给出(会话内锚点序号),文本数组参与一致性判断:同键不同文本
|
|
38
41
|
* 视为行换了一代内容,整行重新请求——这保证重渲染或会话切换后不会把旧译文
|
|
39
42
|
* 配到新文本上。请求幂等:同键同文本且仍在途的 ensure 不发第二个请求;已落定
|
|
40
|
-
* 的行同样短路——**除非** manual=true
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
43
|
+
* 的行同样短路——**除非** manual=true,那是用户点了失败块的 ↻ 发起的手动补跑,
|
|
44
|
+
* 无限次、不设额度。手动补跑时上一代结果整体保留(服务端磁盘缓存让已成功的块
|
|
45
|
+
* 秒回),所以译文不闪、失败块的 ↻ 也不消失(它原位转圈,靠 RowState.retrying
|
|
46
|
+
* 单点判定)。在途期间换代,迟到的旧代结果直接丢弃。
|
|
44
47
|
*
|
|
45
48
|
* 本模块不依赖 React:渲染层用 useSyncExternalStore 订阅版本,再读 getState。
|
|
46
49
|
*/
|
|
@@ -57,7 +60,7 @@ export declare class ChatTranslateStore {
|
|
|
57
60
|
getState(rowKey: string): RowState | undefined;
|
|
58
61
|
/**
|
|
59
62
|
* 确保该行按当前文本被翻译。
|
|
60
|
-
* @param manual -
|
|
63
|
+
* @param manual - 用户点击失败块的 ↻ 发起的补跑:已落定的同代行只有这条路会重发。
|
|
61
64
|
* @returns 是否发出了新的请求。
|
|
62
65
|
*/
|
|
63
66
|
ensure(rowKey: string, texts: readonly string[], manual?: boolean): boolean;
|
|
@@ -9,7 +9,7 @@ export declare const NS = "settings.chatTranslate";
|
|
|
9
9
|
export declare const zh: {
|
|
10
10
|
readonly masterTitle: "翻译总开关";
|
|
11
11
|
readonly enableTranslation: "启用翻译";
|
|
12
|
-
readonly masterDesc: "自动把助手回答正文翻成中文(如 {example}):折叠块里的过程正文与最终汇总一视同仁,整段中文的块也照送,由模型一并改写成自然中文、顺掉机器腔。Think
|
|
12
|
+
readonly masterDesc: "自动把助手回答正文翻成中文(如 {example}):折叠块里的过程正文与最终汇总一视同仁,整段中文的块也照送,由模型一并改写成自然中文、顺掉机器腔。Think 卡与工具调用行不翻,代码块原样保留。正文的排版与原生完全一致,左缘不画任何标记。切换不在正文上:贴着正文左缘的一条透明窄带才是操作区,鼠标移到它上面变手型,点一下在译文与原文间切换,再点一下切回来——正文整块不响应点击,选字、拖选复制都不会误触;模型认为原样最好、返回一模一样的文字时同样算翻译过、同样可切。翻译失败时这一段保持原文,左缘只留下一个小 ↻:鼠标停上去出气泡报出通道细节(超时、断流或空返回),点它整行重新翻译,等待期间它原地转圈且不能重复点;已经成功的段落保持显示不打扰。通道失败不自动重试,恢复后由你点 ↻ 救活。译文按原 markdown 格式重新渲染,表格、列表、加粗与行内代码保持结构。回答还在流式输出时不翻,落定后按阅读顺序逐段出中文。只作用于当前查看的会话,译文不写回会话上下文。输入框下方那一行有同款开关,两处状态同步。";
|
|
13
13
|
readonly aiTitle: "AI 翻译(OpenAI 兼容协议)";
|
|
14
14
|
readonly aiRule: "只有这一条通道:Key / Base URL / 模型齐备才会翻译,缺任何一项都保持原文。";
|
|
15
15
|
readonly badgeConfigured: "已配置";
|
|
@@ -34,15 +34,15 @@ export declare const zh: {
|
|
|
34
34
|
readonly testOk: "连接正常,延迟 {latency}ms";
|
|
35
35
|
readonly testFail: "失败:{error}";
|
|
36
36
|
readonly behaviorTitle: "翻译范围";
|
|
37
|
-
readonly behaviorRule: "
|
|
37
|
+
readonly behaviorRule: "助手回答正文一律翻译,包括最终汇总与整段中文的块:中文块同样交给模型改写成自然中文,意义、术语与数字不变;空白块不送译、左缘不出现任何标记。思考链正文、工具调用标题与折叠摘要不翻译,代码块及其内部原样保留。";
|
|
38
38
|
readonly dockLabel: "译";
|
|
39
39
|
readonly dockOn: "正文翻译已开启,点击关闭";
|
|
40
40
|
readonly dockOff: "正文翻译已关闭,点击开启";
|
|
41
41
|
readonly failTitle: "翻译失败";
|
|
42
|
-
readonly retryAria: "
|
|
42
|
+
readonly retryAria: "翻译失败,点这个按钮重新翻译整行";
|
|
43
|
+
readonly retryBusyAria: "正在重新翻译,请等待";
|
|
43
44
|
readonly toggleToOriginalAria: "查看原文";
|
|
44
45
|
readonly toggleToTranslatedAria: "查看译文";
|
|
45
|
-
readonly inflightAria: "翻译中,此处暂无动作";
|
|
46
46
|
};
|
|
47
47
|
/** Locale keys this plugin renders. */
|
|
48
48
|
export type ChatTranslateLocaleKey = keyof typeof zh;
|
|
@@ -57,12 +57,17 @@ export declare function bindRowCopy(locale: {
|
|
|
57
57
|
bind?(namespace: string): (key: string) => string;
|
|
58
58
|
} | null | undefined): void;
|
|
59
59
|
export declare function rowCopy(): {
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
/**
|
|
61
|
+
* 失败块 ↻ 的读屏标签。Tooltip 的气泡只在 `openOnClick` 时才挂
|
|
62
|
+
* `aria-describedby`,所以败因必须进标签本身——读屏用户不悬停,这是他们
|
|
63
|
+
* 唯一能听到「超时 / 断流 / 空返回」的通道。
|
|
64
|
+
*/
|
|
65
|
+
retryAria: (detail?: string | null) => string;
|
|
66
|
+
/** 补跑在途时 ↻ 的读屏标签:说清此刻按下去没有动作,同样带上败因。 */
|
|
67
|
+
retryBusyAria: (detail?: string | null) => string;
|
|
68
|
+
/** 窄带的读屏标签:读译文时提示可切回原文,反之亦然。 */
|
|
62
69
|
toggleToOriginalAria: string;
|
|
63
70
|
toggleToTranslatedAria: string;
|
|
64
|
-
/** 在途热区的读屏标签:说清此刻按下去没有动作。 */
|
|
65
|
-
inflightAria: string;
|
|
66
71
|
/** 失败块悬停文案:本地化标签 + 服务端原样带来的技术一句(通道伤)。 */
|
|
67
72
|
failTitle: (detail?: string | null) => string;
|
|
68
73
|
};
|
|
@@ -20,8 +20,8 @@ export declare class TranslationDispatcher {
|
|
|
20
20
|
*
|
|
21
21
|
* **形状问题不否决内容**:修不好的片段自动重掷一次;再修不好就照收模型的
|
|
22
22
|
* 译文(链接数不等时不回填,其余原样)——原文一键可回,可读的译文优先于
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* 形状完整。失败只剩通道伤一种:超时、断流、空返回,块保持原文并带一句
|
|
24
|
+
* detail 供悬停报因,救活由用户的点击发起。
|
|
25
25
|
*
|
|
26
26
|
* 调用方传进来的每个块要么整块译出、要么整块保持原文:任一片段缺失都让该块
|
|
27
27
|
* 作废,避免半中半英的段落;失败块带 `detail` 一句技术细节。每行只跑首跑
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynn123411/dsh-chat-translate",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"description": "Assistant reply-body translation for the DeepSeek Harness Web UI (OpenAI-compatible channel)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "lynn123411",
|
|
@@ -72,17 +72,17 @@
|
|
|
72
72
|
},
|
|
73
73
|
"engines": {
|
|
74
74
|
"node": "^22.19 || >=24",
|
|
75
|
-
"dsh": ">=0.2.1-alpha.
|
|
75
|
+
"dsh": ">=0.2.1-alpha.3"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@deepseek-ai/cordis": "^4.0.5-alpha.
|
|
79
|
-
"@deepseek-ai/dsh-client-connection": ">=0.2.1-alpha.
|
|
80
|
-
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.1-alpha.
|
|
81
|
-
"@deepseek-ai/dsh-client-ui-renderer": ">=0.2.1-alpha.
|
|
82
|
-
"@deepseek-ai/dsh-client-ui-settings": ">=0.2.1-alpha.
|
|
83
|
-
"@deepseek-ai/dsh-client-ui-slots": ">=0.2.1-alpha.
|
|
84
|
-
"@deepseek-ai/dsh-home-paths": ">=0.2.1-alpha.
|
|
85
|
-
"@deepseek-ai/schemastery": "^3.18.5-alpha.
|
|
78
|
+
"@deepseek-ai/cordis": "^4.0.5-alpha.2",
|
|
79
|
+
"@deepseek-ai/dsh-client-connection": ">=0.2.1-alpha.3",
|
|
80
|
+
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.1-alpha.3",
|
|
81
|
+
"@deepseek-ai/dsh-client-ui-renderer": ">=0.2.1-alpha.3",
|
|
82
|
+
"@deepseek-ai/dsh-client-ui-settings": ">=0.2.1-alpha.3",
|
|
83
|
+
"@deepseek-ai/dsh-client-ui-slots": ">=0.2.1-alpha.3",
|
|
84
|
+
"@deepseek-ai/dsh-home-paths": ">=0.2.1-alpha.3",
|
|
85
|
+
"@deepseek-ai/schemastery": "^3.18.5-alpha.2",
|
|
86
86
|
"@eslint/js": "^9.30.0",
|
|
87
87
|
"@types/node": "^22.19.0",
|
|
88
88
|
"@types/react": "^19.2.18",
|
|
@@ -91,11 +91,11 @@
|
|
|
91
91
|
"react": "^18.3.1",
|
|
92
92
|
"react-dom": "^18.3.1",
|
|
93
93
|
"typescript": "^6.0.0",
|
|
94
|
-
"@deepseek-ai/dsh-client-ui-plugin-manager": ">=0.2.1-alpha.
|
|
94
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager": ">=0.2.1-alpha.3"
|
|
95
95
|
},
|
|
96
96
|
"peerDependencies": {
|
|
97
|
-
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.1-alpha.
|
|
98
|
-
"@deepseek-ai/dsh-home-paths": ">=0.2.1-alpha.
|
|
97
|
+
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.1-alpha.3",
|
|
98
|
+
"@deepseek-ai/dsh-home-paths": ">=0.2.1-alpha.3"
|
|
99
99
|
},
|
|
100
100
|
"peerDependenciesMeta": {
|
|
101
101
|
"@deepseek-ai/dsh-client-ui-primitives": {
|