-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
411 lines (393 loc) · 24.2 KB
/
Copy pathindex.html
File metadata and controls
411 lines (393 loc) · 24.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'sha256-DVs0fR8XB1jjl1bgTOlKWYtWCgzq/pEgxRTUXDRLz0U='; style-src 'self' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; connect-src 'self' https://api.deepseek.com https://dharmamitra.org https://buddhist-translator-api.lqsxianren.workers.dev; img-src 'self' data:; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'">
<title>慧译通 - 佛教AI翻译器 | Buddhist AI Translator</title>
<!-- SEO Meta Tags -->
<meta name="description" content="慧译通 - 专业佛教文献AI翻译平台。支持梵文、巴利文、藏文、文言文等18种语言互译,内置50+佛教术语数据库,DeepSeek AI驱动。Buddhist AI Translator with Sanskrit, Pali, Tibetan support.">
<meta name="keywords" content="佛教翻译,Buddhist translator,梵文翻译,Sanskrit translation,巴利文,Pali,藏文翻译,Tibetan,AI翻译,心经翻译,佛经翻译,DeepSeek,慧译通">
<meta name="author" content="xr843">
<meta name="robots" content="index, follow">
<link rel="canonical" href="https://xr843.github.io/Buddhist-AI-Translator/">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:url" content="https://xr843.github.io/Buddhist-AI-Translator/">
<meta property="og:title" content="慧译通 - 佛教AI翻译器 | Buddhist AI Translator">
<meta property="og:description" content="专业佛教文献AI翻译平台,支持梵文、巴利文、藏文等18种语言,内置50+佛教术语数据库。">
<meta property="og:image" content="https://raw.githubusercontent.com/xr843/Buddhist-AI-Translator/master/image/README/1749601583838.png">
<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:url" content="https://xr843.github.io/Buddhist-AI-Translator/">
<meta name="twitter:title" content="慧译通 - 佛教AI翻译器 | Buddhist AI Translator">
<meta name="twitter:description" content="专业佛教文献AI翻译平台,支持梵文、巴利文、藏文等18种语言。">
<meta name="twitter:image" content="https://raw.githubusercontent.com/xr843/Buddhist-AI-Translator/master/image/README/1749601583838.png">
<meta name="twitter:creator" content="@RenXian843">
<!-- Structured Data -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebApplication",
"name": "慧译通 Buddhist AI Translator",
"description": "专业佛教文献AI翻译平台",
"url": "https://xr843.github.io/Buddhist-AI-Translator/",
"applicationCategory": "UtilitiesApplication",
"operatingSystem": "Web Browser",
"offers": { "@type": "Offer", "price": "0", "priceCurrency": "USD" }
}
</script>
<link rel="stylesheet" href="styles/tokens.css">
<link rel="stylesheet" href="styles/base.css">
<link rel="stylesheet" href="styles/components.css">
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&family=Noto+Serif+SC:wght@400;500&display=swap" rel="stylesheet">
</head>
<body>
<svg class="icon-sprite" aria-hidden="true" focusable="false">
<symbol id="i-key" viewBox="0 0 24 24">
<circle cx="8" cy="8" r="4"/>
<line x1="11" y1="11" x2="21" y2="21"/>
<line x1="15" y1="15" x2="17" y2="13"/>
<line x1="18" y1="18" x2="20" y2="16"/>
</symbol>
<symbol id="i-shield" viewBox="0 0 24 24">
<path d="M12 3 L19 6 V11 C19 16 16 19.5 12 21 C8 19.5 5 16 5 11 V6 Z"/>
</symbol>
<symbol id="i-check" viewBox="0 0 24 24">
<circle cx="12" cy="12" r="9"/>
<polyline points="7.5,12.5 10.5,15.5 16.5,9"/>
</symbol>
<symbol id="i-swap" viewBox="0 0 24 24">
<polyline points="4,7 20,7"/>
<polyline points="16,3 20,7 16,11"/>
<polyline points="20,17 4,17"/>
<polyline points="8,13 4,17 8,21"/>
</symbol>
<symbol id="i-sliders" viewBox="0 0 24 24">
<line x1="4" y1="6" x2="20" y2="6"/>
<circle cx="9" cy="6" r="2"/>
<line x1="4" y1="12" x2="20" y2="12"/>
<circle cx="15" cy="12" r="2"/>
<line x1="4" y1="18" x2="20" y2="18"/>
<circle cx="11" cy="18" r="2"/>
</symbol>
<symbol id="i-layers" viewBox="0 0 24 24">
<path d="M12 3 L21 8 L12 13 L3 8 Z"/>
<polyline points="3,12 12,17 21,12"/>
<polyline points="3,16 12,21 21,16"/>
</symbol>
<symbol id="i-close" viewBox="0 0 24 24">
<line x1="5" y1="5" x2="19" y2="19"/>
<line x1="19" y1="5" x2="5" y2="19"/>
</symbol>
<symbol id="i-mic" viewBox="0 0 24 24">
<path d="M12 2a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z"/>
<path d="M6 11a6 6 0 0 0 12 0"/>
<line x1="12" y1="19" x2="12" y2="22"/>
<line x1="8" y1="22" x2="16" y2="22"/>
</symbol>
<symbol id="i-paste" viewBox="0 0 24 24">
<path d="M9 4h6a1 1 0 0 1 1 1v1H8V5a1 1 0 0 1 1-1z"/>
<path d="M6 6h12a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z"/>
<line x1="9" y1="12" x2="15" y2="12"/>
<line x1="9" y1="16" x2="15" y2="16"/>
</symbol>
<symbol id="i-book" viewBox="0 0 24 24">
<path d="M12 5c-1.5-1.5-4-2-8-2v14c4 0 6.5.5 8 2 1.5-1.5 4-2 8-2V3c-4 0-6.5.5-8 2z"/>
<line x1="12" y1="5" x2="12" y2="19"/>
</symbol>
<symbol id="i-copy" viewBox="0 0 24 24">
<path d="M8 8h11a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1z"/>
<path d="M5 16V5a1 1 0 0 1 1-1h11"/>
</symbol>
<symbol id="i-download" viewBox="0 0 24 24">
<line x1="12" y1="3" x2="12" y2="14"/>
<polyline points="7,10 12,15 17,10"/>
<polyline points="4,18 4,20 20,20 20,18"/>
</symbol>
<symbol id="i-volume" viewBox="0 0 24 24">
<path d="M4 9v6h4l5 5V4L8 9H4z"/>
<path d="M16 9a5 5 0 0 1 0 6"/>
<path d="M18.5 6.5a9 9 0 0 1 0 11"/>
</symbol>
<symbol id="i-stop" viewBox="0 0 24 24">
<path d="M6 6h12v12H6z"/>
</symbol>
<symbol id="i-language" viewBox="0 0 24 24">
<path d="M4 5h10v7H9l-2 2v-2H4z"/>
<path d="M20 10h-6v6h3l2 2v-2h1z"/>
</symbol>
<symbol id="i-spinner" viewBox="0 0 24 24">
<path d="M12 3a9 9 0 1 0 9 9"/>
</symbol>
</svg>
<header class="app-bar">
<div class="app-bar-inner">
<span class="brand">慧译通 <span class="brand-sub">佛典 AI 翻译</span></span>
<div class="app-bar-actions">
<div class="api-status-info">
<label class="engine-label" for="engine-select">引擎</label>
<select id="engine-select" class="engine-select">
<option value="auto">自动选择</option>
<option value="mitra">MITRA 佛典引擎(免密钥)</option>
<option value="deepseek">DeepSeek 通用模型</option>
</select>
<span id="api-status-text">API未配置</span>
<span id="api-status-indicator" class="status-indicator"></span>
</div>
<button class="api-config-btn" id="api-settings-btn" title="配置API密钥">
<svg class="icon" aria-hidden="true"><use href="#i-key"></use></svg>
<span>配置API</span>
</button>
</div>
</div>
</header>
<main class="main-content">
<section class="hero">
<div class="container">
<h1 class="hero-title">佛教文本AI翻译器</h1>
<p class="hero-subtitle">智能佛教文本翻译平台,支持梵文、巴利文、藏文、中文等多语种佛典翻译,助力佛法传播与学术研究</p>
</div>
</section>
<section class="translator">
<div class="container">
<div class="translator-card">
<div class="language-selectors">
<div class="language-selector">
<label for="source-lang">源语言</label>
<select id="source-lang" class="lang-select">
<option value="auto">自动检测</option>
<option value="zh">现代中文</option>
<option value="zh-classical">文言文</option>
<option value="en">英文</option>
<option value="sa">梵文 (Devanagari)</option>
<option value="sa-hk">梵文 (Harvard-Kyoto)</option>
<option value="bo">藏文 (Unicode)</option>
<option value="pi">巴利文</option>
<option value="fr">法文</option>
<option value="de">德文</option>
<option value="es">西班牙文</option>
<option value="pt">葡萄牙文</option>
<option value="it">意大利文</option>
<option value="nl">荷兰文</option>
<option value="ja">日文</option>
<option value="ko">韩文</option>
<option value="ru">俄文</option>
<option value="ar">阿拉伯文</option>
<option value="other">其他</option>
</select>
</div>
<div class="swap-languages">
<button class="swap-btn" id="swap-btn">
<svg class="icon" aria-hidden="true"><use href="#i-swap"></use></svg>
</button>
</div>
<div class="language-selector">
<label for="target-lang">目标语言</label>
<select id="target-lang" class="lang-select">
<option value="zh" selected>现代中文</option>
<option value="zh-classical">文言文</option>
<option value="en">英文</option>
<option value="sa">梵文 (Devanagari)</option>
<option value="sa-hk">梵文 (Harvard-Kyoto)</option>
<option value="bo">藏文 (Unicode)</option>
<option value="pi">巴利文</option>
<option value="fr">法文</option>
<option value="de">德文</option>
<option value="es">西班牙文</option>
<option value="pt">葡萄牙文</option>
<option value="it">意大利文</option>
<option value="nl">荷兰文</option>
<option value="ja">日文</option>
<option value="ko">韩文</option>
<option value="ru">俄文</option>
<option value="ar">阿拉伯文</option>
</select>
</div>
</div>
<div class="settings-row">
<!-- 译风设置:借鉴 foguang.ai 的多维风格控制 -->
<details class="style-panel" id="style-panel">
<summary class="style-summary-row">
<span class="style-title"><svg class="icon" aria-hidden="true"><use href="#i-sliders"></use></svg> 译风设置</span>
<span class="style-summary" id="style-summary"></span>
</summary>
<div class="style-grid" id="style-grid"></div>
</details>
<!-- 多本合参:同一段落的多语种写本一起送入 -->
<div class="witness-bar">
<label class="witness-switch" for="multi-witness-toggle">
<input type="checkbox" id="multi-witness-toggle">
<span><svg class="icon" aria-hidden="true"><use href="#i-layers"></use></svg> 多本合参</span>
</label>
<span class="witness-hint">同一段落的梵/巴/汉/藏写本一起送入,得到一份权衡各本的译文</span>
</div>
</div>
<div class="witness-grid" id="witness-grid" hidden>
<div class="witness-autofill">
<button type="button" class="btn btn-secondary" id="autofill-witnesses">
<svg class="icon" aria-hidden="true"><use href="#i-book"></use></svg>
自动取回平行本
</button>
<span class="witness-autofill-status" id="autofill-status"></span>
</div>
<div class="witness-field" data-lang="sa">
<label for="witness-sa">梵文</label>
<textarea id="witness-sa" class="witness-input" rows="3" placeholder="Devanagari 或 IAST"></textarea>
</div>
<div class="witness-field" data-lang="pi">
<label for="witness-pi">巴利文</label>
<textarea id="witness-pi" class="witness-input" rows="3" placeholder="罗马转写"></textarea>
</div>
<div class="witness-field" data-lang="zh-classical">
<label for="witness-zh">汉文</label>
<textarea id="witness-zh" class="witness-input" rows="3" placeholder="文言/汉译佛典"></textarea>
</div>
<div class="witness-field" data-lang="bo">
<label for="witness-bo">藏文</label>
<textarea id="witness-bo" class="witness-input" rows="3" placeholder="藏文 Unicode 或 Wylie"></textarea>
</div>
<div class="witness-focus">
<label for="focus-select">侧重写本</label>
<select id="focus-select" class="lang-select">
<option value="">等量齐观</option>
<option value="sa">以梵本为主</option>
<option value="pi">以巴利本为主</option>
<option value="zh-classical">以汉本为主</option>
<option value="bo">以藏本为主</option>
</select>
</div>
</div>
<div class="translation-area">
<div class="input-section">
<div class="text-area-header">
<span class="language-label" id="source-label">自动检测</span>
<button class="clear-btn" id="clear-input">
<svg class="icon" aria-hidden="true"><use href="#i-close"></use></svg>
</button>
</div>
<textarea
id="source-text"
class="text-input"
placeholder="请输入要翻译的佛教文本..."
rows="8"
></textarea>
<div class="input-tools">
<button class="tool-btn" id="voice-input" title="语音输入">
<svg class="icon" aria-hidden="true"><use href="#i-mic"></use></svg>
</button>
<button class="tool-btn" id="paste-btn" title="粘贴">
<svg class="icon" aria-hidden="true"><use href="#i-paste"></use></svg>
</button>
<span class="char-count">0 / 5000</span>
</div>
</div>
<div class="translate-button-container">
<button class="translate-btn" id="translate-btn">
<svg class="icon" aria-hidden="true"><use href="#i-language"></use></svg>
翻译
</button>
</div>
<div class="output-section">
<div class="text-area-header">
<span class="language-label" id="target-label">现代中文</span>
<div class="output-tools">
<button class="tool-btn" id="copy-btn" title="复制">
<svg class="icon" aria-hidden="true"><use href="#i-copy"></use></svg>
</button>
<button class="tool-btn" id="download-btn" title="下载译文">
<svg class="icon" aria-hidden="true"><use href="#i-download"></use></svg>
</button>
<button class="tool-btn" id="speaker-btn" title="朗读">
<svg class="icon" aria-hidden="true"><use href="#i-volume"></use></svg>
</button>
</div>
</div>
<div id="translation-result" class="text-output">
<div class="placeholder">翻译结果将显示在这里...</div>
</div>
<div class="result-meta" id="result-meta" hidden></div>
</div>
</div>
</div>
</div>
</section>
</main>
<!-- API设置模态框 -->
<div class="modal-overlay" id="api-modal-overlay">
<div class="modal">
<div class="modal-header">
<h3>API设置</h3>
<button class="modal-close" id="modal-close">
<svg class="icon" aria-hidden="true"><use href="#i-close"></use></svg>
</button>
</div>
<div class="modal-body">
<p class="modal-note">
梵、巴、汉、藏四种佛典语言的翻译走 MITRA 引擎,<strong>不需要任何密钥</strong>,
但需要一个 Worker 中转(浏览器不能直连 Dharmamitra)。
只有译入文言文、或从现代语言译出等 MITRA 不受理的语种对,才需要 DeepSeek 密钥。
</p>
<div class="form-group">
<label for="proxy-url-input">Worker 中转地址</label>
<input type="url" id="proxy-url-input" class="form-control" placeholder="https://your-worker.workers.dev">
<small class="form-text">
本站已内置一个中转,<strong>留空即可正常使用</strong>,无需填写。
<br>这里只给自部署的人用:部署 <code>worker/</code> 后填自己的地址,中转本身不需要任何密钥。
<br><strong>注意:</strong>出于安全考虑,本站的 CSP 只放行内置的那一个中转地址
(避免留下可被滥用的外发通道)。要用自己的中转,需 fork 本仓库并同时修改
<code>index.html</code> 的 <code>connect-src</code>。
</small>
</div>
<div class="form-group">
<label for="api-key-input">DeepSeek API密钥(可选,填了才用得上下面这些语种)</label>
<input type="password" id="api-key-input" class="form-control" placeholder="请输入您的DeepSeek API密钥">
<small class="form-text">
<strong>不填也能用</strong>——梵文、巴利文、藏文、文言文译成现代中文/英文/法文等
12 种现代语言,走 MITRA 佛典引擎,不需要任何密钥。
<br><strong>这些情况才需要填:</strong>
<br>• 译成文言文、梵文、藏文、巴利文(MITRA 只输出现代语言)
<br>• 源语言不是梵/巴/汉/藏(例如从英文、日文译出)
<br>密钥在 <a href="https://platform.deepseek.com" target="_blank" rel="noopener noreferrer">DeepSeek 平台</a> 申请,
用量记在你自己账上。
<br><strong>安全提示:</strong>
<br>• 密钥只存在你自己的浏览器里,直接发往 DeepSeek,不经过本站的中转
<br>• 请勿在公共设备上保存密钥
<br>• 定期更换API密钥以确保安全
</small>
</div>
<div class="api-status" id="api-status"></div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" id="cancel-btn">取消</button>
<button class="btn btn-primary" id="save-api-key">保存</button>
</div>
</div>
</div>
<footer class="footer-simple">
<div class="container">
<!-- 起始年写死当兜底,当前年由 src/main.js 接上(见 utils.js 的 copyrightYears)。
硬编码整个年份必然过期——这里曾经一直停在 2025。 -->
<p>
© <span id="copyright-years">2025</span> 佛教文本AI翻译器
· <a href="https://github.com/xr843/Buddhist-AI-Translator" target="_blank" rel="noopener noreferrer">源码</a>
</p>
<!-- ⚠️ 只写页面上真做得到的事。这里曾经写「佛典翻译与语料检索由…提供」,
但藏经溯源面板在 #80 就移除了,界面上没有任何检索入口——
客户端与 Worker 路由还在,用户点不到。空头承诺按删处理。
「分发」而不是「使用」:CC BY 的义务由分发触发,这份数据随本站一起发出去。 -->
<p class="footer-credit">
佛典翻译由
<a href="https://dharmamitra.org" target="_blank" rel="noopener noreferrer">Dharmamitra / MITRA</a>
(东北大学,Tohoku University)提供;本站随附的术语对照数据派生自
<a href="https://github.com/dharmamitra/dharmamitra-lexicon" target="_blank" rel="noopener noreferrer">dharmamitra-lexicon</a>
(© Dharmamitra project),<strong>经筛选与聚合改编</strong>,依
<a href="https://creativecommons.org/licenses/by/4.0/" target="_blank" rel="noopener noreferrer">CC BY 4.0</a>
分发。改动详情见
<a href="https://github.com/xr843/Buddhist-AI-Translator/blob/master/NOTICE.md" target="_blank" rel="noopener noreferrer">NOTICE</a>。
</p>
</div>
</footer>
<script type="module" src="src/main.js"></script>
</body>
</html>