ai-helper-agent 2.4.8 → 2.5.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 +33 -1
- package/README.zh-CN.md +33 -1
- package/bin/agent.js +78 -0
- package/dist/assets/{agent-store-BTqZ3_7C.js → agent-store-D0oEv0PW.js} +1 -1
- package/dist/assets/background.js +4 -4
- package/dist/assets/{chat-export-BE9AcllU.js → chat-export-MTTSSIwM.js} +1 -1
- package/dist/assets/content.js +28 -28
- package/dist/assets/i18n-Br_sF5pb.js +49 -0
- package/dist/assets/{markdown-render-BhfoP_jE.js → markdown-render-Dq5F_dqP.js} +2 -2
- package/dist/assets/{model-profiles-BlsZEsSZ.js → model-profiles-BdQaV4EZ.js} +1 -1
- package/dist/assets/{options-Dir2xv8X.css → options-JtYgxtsc.css} +1 -1
- package/dist/assets/options.js +297 -238
- package/dist/assets/{page-snapshot-renderer-2AUkuzX_.js → page-snapshot-renderer-Cl0qk7U1.js} +1 -1
- package/dist/assets/{session-store-Xg-R-TyE.js → session-store-KkrAlIc6.js} +3 -3
- package/dist/assets/side_panel.css +1 -1
- package/dist/assets/side_panel.js +174 -174
- package/dist/assets/{utils-CTRffrs-.js → utils-ZJjxSlg_.js} +1 -1
- package/dist/assets/{version-D_5kiJwl.js → version-C0CY79zF.js} +1 -1
- package/dist/dist/_locales/en/messages.json +11 -0
- package/dist/dist/_locales/zh_CN/messages.json +11 -0
- package/dist/dist/assets/__vite-browser-external-CM3Eme-n.js +1 -0
- package/dist/dist/assets/agent-store-D0oEv0PW.js +1 -0
- package/dist/dist/assets/background.js +451 -0
- package/dist/dist/assets/chat-export-7wjGjcA8.js +37 -0
- package/dist/dist/assets/chunk-CMxvf4Kt.js +1 -0
- package/dist/dist/assets/content.js +985 -0
- package/dist/dist/assets/dist-BUuoW_84.js +24 -0
- package/dist/dist/assets/dist-DuuG_8Br.js +133 -0
- package/dist/dist/assets/i18n-Br_sF5pb.js +49 -0
- package/dist/dist/assets/jszip.min-DO6SOhXU.js +2 -0
- package/dist/dist/assets/lib-YwkWjNcC.js +220 -0
- package/dist/dist/assets/markdown-render-lSSxW953.js +63 -0
- package/dist/dist/assets/marked.min.js-D2rXgLAQ.js +56 -0
- package/dist/dist/assets/marked.min.js-loader-tKH5SQVQ.js +13 -0
- package/dist/dist/assets/model-profiles-BdQaV4EZ.js +24 -0
- package/dist/dist/assets/network-scope-CNRYXk74.js +1 -0
- package/dist/dist/assets/options-JtYgxtsc.css +1 -0
- package/dist/dist/assets/options.js +859 -0
- package/dist/dist/assets/page-snapshot-renderer-Cl0qk7U1.js +3 -0
- package/dist/dist/assets/pdf-DnVqBaAN.js +6 -0
- package/dist/dist/assets/session-store-KkrAlIc6.js +81 -0
- package/dist/dist/assets/side_panel.css +1 -0
- package/dist/dist/assets/side_panel.js +2595 -0
- package/dist/dist/assets/theme-BRAX5X2F.css +1 -0
- package/dist/dist/assets/theme-CLwYsx9o.js +1 -0
- package/dist/dist/assets/utils-ZJjxSlg_.js +112 -0
- package/dist/dist/assets/version-C7x4HYX1.js +1 -0
- package/dist/dist/assets/xlsx-DGkz7cnk.js +105 -0
- package/dist/dist/icons/README.md +11 -0
- package/dist/dist/icons/design-philosophy.md +41 -0
- package/dist/dist/icons/icon128.png +0 -0
- package/dist/dist/icons/icon128.svg +68 -0
- package/dist/dist/icons/icon16.png +0 -0
- package/dist/dist/icons/icon16.svg +32 -0
- package/dist/dist/icons/icon48.png +0 -0
- package/dist/dist/icons/icon48.svg +56 -0
- package/dist/dist/libs/github-markdown-light.min.css +8 -0
- package/dist/dist/libs/html2canvas.min.js +20 -0
- package/dist/dist/libs/jspdf.min.js +398 -0
- package/dist/dist/libs/marked.min.js +69 -0
- package/dist/dist/libs/mermaid.min.js +2024 -0
- package/dist/dist/libs/pdf.worker.min.js +22 -0
- package/dist/dist/libs/qrcode.min.js +7 -0
- package/dist/dist/manifest.json +94 -0
- package/dist/dist/offscreen/offscreen.html +11 -0
- package/dist/dist/offscreen/offscreen.js +49 -0
- package/dist/dist/options.html +1091 -0
- package/dist/dist/service-worker-loader.js +1 -0
- package/dist/dist/side_panel.html +1357 -0
- package/dist/dist/styles/styles.css +262 -0
- package/dist/dist/voice-capture-worklet.js +47 -0
- package/dist/manifest.json +1 -1
- package/dist/offscreen/offscreen.js +8 -8
- package/dist/options.html +38 -4
- package/dist/side_panel.html +25 -7
- package/dist/voice-capture-worklet.js +47 -0
- package/package.json +4 -1
- package/src/asr/config.js +155 -0
- package/src/asr/detect.js +215 -0
- package/src/asr/engine.js +347 -0
- package/src/asr/install.js +439 -0
- package/src/asr/model-catalog.js +207 -0
- package/src/asr/model-download.js +461 -0
- package/src/asr/model-pack.js +398 -0
- package/src/asr/offline-pool.js +283 -0
- package/src/asr/offline-worker.js +97 -0
- package/src/asr/probe-child.mjs +31 -0
- package/src/asr/routes.js +385 -0
- package/src/asr/session.js +435 -0
- package/src/asr/transcribe.js +310 -0
- package/src/directory-picker.js +157 -45
- package/src/locales/cli.json +26 -0
- package/src/locales/en.json +22 -1
- package/src/locales/zh.json +22 -1
- package/src/rag/install.js +60 -2
- package/src/server.js +136 -2
- package/dist/assets/i18n-DBVIgrwQ.js +0 -49
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/* AI Helper 浮框样式 */
|
|
2
|
+
|
|
3
|
+
#ai-helper-floating-box {
|
|
4
|
+
width: 500px;
|
|
5
|
+
max-width: 90vw;
|
|
6
|
+
max-height: 70vh;
|
|
7
|
+
background: #ffffff;
|
|
8
|
+
border: 1px solid #e0e0e0;
|
|
9
|
+
border-radius: 12px;
|
|
10
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
15
|
+
font-size: 14px;
|
|
16
|
+
line-height: 1.6;
|
|
17
|
+
color: #333;
|
|
18
|
+
z-index: 999999;
|
|
19
|
+
transition: box-shadow 0.3s ease;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
#ai-helper-floating-box:hover {
|
|
23
|
+
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* 头部样式 */
|
|
27
|
+
.ai-helper-header {
|
|
28
|
+
display: flex;
|
|
29
|
+
justify-content: space-between;
|
|
30
|
+
align-items: center;
|
|
31
|
+
padding: 12px 16px;
|
|
32
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
33
|
+
color: white;
|
|
34
|
+
cursor: grab;
|
|
35
|
+
user-select: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.ai-helper-header:active {
|
|
39
|
+
cursor: grabbing;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.ai-helper-title {
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
gap: 8px;
|
|
46
|
+
font-weight: 600;
|
|
47
|
+
font-size: 15px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ai-helper-icon {
|
|
51
|
+
font-size: 18px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.ai-helper-actions {
|
|
55
|
+
display: flex;
|
|
56
|
+
gap: 6px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.ai-helper-btn {
|
|
60
|
+
background: rgba(255, 255, 255, 0.2);
|
|
61
|
+
border: none;
|
|
62
|
+
color: white;
|
|
63
|
+
width: 28px;
|
|
64
|
+
height: 28px;
|
|
65
|
+
border-radius: 6px;
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
font-size: 14px;
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
transition: background 0.2s;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.ai-helper-btn:hover {
|
|
75
|
+
background: rgba(255, 255, 255, 0.35);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* 主体样式 */
|
|
79
|
+
.ai-helper-body {
|
|
80
|
+
flex: 1;
|
|
81
|
+
overflow-y: auto;
|
|
82
|
+
padding: 16px;
|
|
83
|
+
min-height: 200px;
|
|
84
|
+
max-height: 50vh;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.ai-helper-body::-webkit-scrollbar {
|
|
88
|
+
width: 6px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.ai-helper-body::-webkit-scrollbar-track {
|
|
92
|
+
background: transparent;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.ai-helper-body::-webkit-scrollbar-thumb {
|
|
96
|
+
background: #c0c0c0;
|
|
97
|
+
border-radius: 3px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.ai-helper-body::-webkit-scrollbar-thumb:hover {
|
|
101
|
+
background: #a0a0a0;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* 加载动画 */
|
|
105
|
+
.ai-helper-loading {
|
|
106
|
+
display: flex;
|
|
107
|
+
flex-direction: column;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
gap: 12px;
|
|
111
|
+
color: #888;
|
|
112
|
+
padding: 40px 20px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.ai-helper-spinner {
|
|
116
|
+
width: 32px;
|
|
117
|
+
height: 32px;
|
|
118
|
+
border: 3px solid #e0e0e0;
|
|
119
|
+
border-top-color: #667eea;
|
|
120
|
+
border-radius: 50%;
|
|
121
|
+
animation: ai-helper-spin 0.8s linear infinite;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@keyframes ai-helper-spin {
|
|
125
|
+
to {
|
|
126
|
+
transform: rotate(360deg);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* 输入模式 */
|
|
131
|
+
.ai-helper-input-container {
|
|
132
|
+
display: flex;
|
|
133
|
+
flex-direction: column;
|
|
134
|
+
gap: 12px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
#ai-helper-input {
|
|
138
|
+
width: 100%;
|
|
139
|
+
padding: 12px;
|
|
140
|
+
border: 1px solid #e0e0e0;
|
|
141
|
+
border-radius: 8px;
|
|
142
|
+
font-size: 14px;
|
|
143
|
+
font-family: inherit;
|
|
144
|
+
resize: vertical;
|
|
145
|
+
outline: none;
|
|
146
|
+
transition: border-color 0.2s;
|
|
147
|
+
box-sizing: border-box;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
#ai-helper-input:focus {
|
|
151
|
+
border-color: #667eea;
|
|
152
|
+
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.ai-helper-submit-btn {
|
|
156
|
+
padding: 10px 24px;
|
|
157
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
158
|
+
color: white;
|
|
159
|
+
border: none;
|
|
160
|
+
border-radius: 8px;
|
|
161
|
+
font-size: 14px;
|
|
162
|
+
font-weight: 500;
|
|
163
|
+
cursor: pointer;
|
|
164
|
+
transition: transform 0.1s, box-shadow 0.2s;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.ai-helper-submit-btn:hover {
|
|
168
|
+
transform: translateY(-1px);
|
|
169
|
+
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.ai-helper-submit-btn:active {
|
|
173
|
+
transform: translateY(0);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/* 结果内容 */
|
|
177
|
+
.ai-helper-result {
|
|
178
|
+
line-height: 1.7;
|
|
179
|
+
word-wrap: break-word;
|
|
180
|
+
overflow-wrap: break-word;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.ai-helper-result pre {
|
|
184
|
+
background: #f5f5f5;
|
|
185
|
+
border: 1px solid #e0e0e0;
|
|
186
|
+
border-radius: 6px;
|
|
187
|
+
padding: 12px;
|
|
188
|
+
overflow-x: auto;
|
|
189
|
+
margin: 12px 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.ai-helper-result code {
|
|
193
|
+
background: #f0f0f0;
|
|
194
|
+
padding: 2px 6px;
|
|
195
|
+
border-radius: 4px;
|
|
196
|
+
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
|
|
197
|
+
font-size: 13px;
|
|
198
|
+
color: #e83e8c;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.ai-helper-result pre code {
|
|
202
|
+
background: none;
|
|
203
|
+
padding: 0;
|
|
204
|
+
color: inherit;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.ai-helper-result strong {
|
|
208
|
+
color: #333;
|
|
209
|
+
font-weight: 600;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.ai-helper-result em {
|
|
213
|
+
color: #555;
|
|
214
|
+
font-style: italic;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/* 错误样式 */
|
|
218
|
+
.ai-helper-error {
|
|
219
|
+
color: #e53e3e;
|
|
220
|
+
font-weight: 500;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/* 底部状态栏 */
|
|
224
|
+
.ai-helper-footer {
|
|
225
|
+
padding: 8px 16px;
|
|
226
|
+
background: #f8f9fa;
|
|
227
|
+
border-top: 1px solid #e9ecef;
|
|
228
|
+
font-size: 12px;
|
|
229
|
+
color: #888;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.ai-helper-status {
|
|
233
|
+
display: flex;
|
|
234
|
+
align-items: center;
|
|
235
|
+
gap: 6px;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.ai-helper-status::before {
|
|
239
|
+
content: '';
|
|
240
|
+
width: 8px;
|
|
241
|
+
height: 8px;
|
|
242
|
+
border-radius: 50%;
|
|
243
|
+
background: #48bb78;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.ai-helper-status.generating::before {
|
|
247
|
+
background: #ed8936;
|
|
248
|
+
animation: ai-helper-pulse 1s ease-in-out infinite;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.ai-helper-status.error::before {
|
|
252
|
+
background: #e53e3e;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
@keyframes ai-helper-pulse {
|
|
256
|
+
0%, 100% {
|
|
257
|
+
opacity: 1;
|
|
258
|
+
}
|
|
259
|
+
50% {
|
|
260
|
+
opacity: 0.4;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// side_panel/voice-capture-worklet.js - 录音采集 AudioWorklet 处理器
|
|
2
|
+
//
|
|
3
|
+
// 职责:收 Float32 输入 → 累积 1600 样本(@16k ≈ 100ms)→ 转 Int16 → 转移所有权回主线程。
|
|
4
|
+
// 说明:
|
|
5
|
+
// - 该文件不参与 esbuild 打包,由 scripts/fix-build.js 直接复制到 dist/ 根;
|
|
6
|
+
// 面板按 ['voice-capture-worklet.js', 'dist/voice-capture-worklet.js'] 依次探测
|
|
7
|
+
// (安装形态不同,扩展根也不同:装 dist 时在根,源码形态下在 dist/ 子目录),
|
|
8
|
+
// 加载走 chrome.runtime.getURL(CSP 禁止 blob:);
|
|
9
|
+
// - 顺带算 RMS 回传,供录音条波形与「没有听到声音」判定使用,避免主线程重复遍历。
|
|
10
|
+
|
|
11
|
+
class VoiceCaptureProcessor extends AudioWorkletProcessor {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
this.frameSize = 1600; // 100ms @ 16kHz
|
|
15
|
+
this.buf = new Float32Array(this.frameSize);
|
|
16
|
+
this.n = 0;
|
|
17
|
+
this.rmsAcc = 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
process(inputs) {
|
|
21
|
+
const input = inputs[0];
|
|
22
|
+
const channel = input && input[0];
|
|
23
|
+
if (!channel || channel.length === 0) return true;
|
|
24
|
+
|
|
25
|
+
for (let i = 0; i < channel.length; i++) {
|
|
26
|
+
const sample = channel[i];
|
|
27
|
+
this.rmsAcc += sample * sample;
|
|
28
|
+
this.buf[this.n++] = sample;
|
|
29
|
+
|
|
30
|
+
if (this.n >= this.frameSize) {
|
|
31
|
+
const pcm = new Int16Array(this.frameSize);
|
|
32
|
+
for (let j = 0; j < this.frameSize; j++) {
|
|
33
|
+
const v = this.buf[j] < -1 ? -1 : this.buf[j] > 1 ? 1 : this.buf[j];
|
|
34
|
+
pcm[j] = v < 0 ? v * 0x8000 : v * 0x7fff;
|
|
35
|
+
}
|
|
36
|
+
const rms = Math.sqrt(this.rmsAcc / this.frameSize);
|
|
37
|
+
this.rmsAcc = 0;
|
|
38
|
+
this.n = 0;
|
|
39
|
+
const buf = pcm.buffer;
|
|
40
|
+
this.port.postMessage({ type: 'chunk', pcm: buf, rms }, [buf]);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
registerProcessor('voice-capture', VoiceCaptureProcessor);
|