Repository navigation
Expand file tree
/
Copy pathoptions.html
More file actions
70 lines (60 loc) · 5.32 KB
/
Copy pathoptions.html
File metadata and controls
70 lines (60 loc) · 5.32 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
<!doctype html>
<html lang="zh-Hant">
<head>
<meta charset="utf-8" />
<title>Kindle 翻譯設定</title>
<style>
body { font:14px/1.6 system-ui,"PingFang TC","Microsoft JhengHei",sans-serif; max-width:560px; margin:32px auto; padding:0 16px; color:#222; background:#fff; }
@media (prefers-color-scheme: dark) { body { color:#e8e6e3; background:#1d1f21; } input,select { background:#26292c; color:inherit; } }
label { display:block; margin:16px 0 4px; font-weight:600; }
input, select { width:100%; padding:8px; border:1px solid #aaa; border-radius:6px; font-size:14px; }
.hint { color:#888; font-size:12px; margin-top:4px; }
button { margin-top:20px; background:#146e78; color:#fff; border:0; border-radius:6px; padding:8px 18px; font-size:14px; cursor:pointer; }
#saved { margin-left:10px; color:#146e78; }
details { margin-top:32px; }
summary { cursor:pointer; color:#888; }
label.check { font-weight:400; display:flex; gap:8px; align-items:center; }
label.check input { width:auto; }
button.link { margin:0 0 0 8px; padding:0; background:none; color:#146e78; font-size:12px; text-decoration:underline; }
#cleared { margin-left:8px; }
</style>
</head>
<body>
<h1>Kindle 翻譯設定</h1>
<label for="apiKey">Anthropic API key</label>
<input id="apiKey" type="password" placeholder="sk-ant-..." autocomplete="off" />
<div class="hint">到 console.anthropic.com 建立。key 只存在這台瀏覽器的 Chrome 同步儲存區,只會送往 api.anthropic.com。</div>
<label for="mode">翻譯方式</label>
<select id="mode">
<option value="haiku">1. 快速:本機辨識文字,Haiku 翻譯(約 9 秒,每頁約 0.1 美分)</option>
<option value="review">2. 精修:本機辨識文字,Haiku 翻譯後由 Sonnet 校對(約 10 秒,每頁約 1 美分)</option>
<option value="vision">3. 看圖:截圖直接交給 Opus 辨識並翻譯(20 秒以上,可處理非英文書)</option>
</select>
<div class="hint">1、2 用閱讀器自己的頁面資料找出段落和標題,在瀏覽器裡用 Tesseract 辨識文字,只把文字送給 Claude,書頁圖片不會離開電腦,目前只支援英文書。某一欄被拒絕或只給摘要時,那一欄會自動改用 Opus 翻譯。2 的 Sonnet 只回傳需要修改的段落,校對失敗時沿用 Haiku 的譯文。<br />3 把截圖送給 Opus,排版辨識較好,也能處理其他語言,但比較慢,偶爾會以版權為由拒絕或只給摘要。<br />已翻過的段落會用快取,改了字級或視窗大小也一樣;改了設定後可按「重新翻譯本頁」。</div>
<div id="effortRow">
<label for="effort">Opus 思考程度(effort)</label>
<select id="effort">
<option value="low">low(最快,翻譯通常夠用)</option>
<option value="medium">medium</option>
<option value="high">high</option>
</select>
</div>
<label class="check"><input type="checkbox" id="prefetch" /> 預先翻譯下一頁</label>
<div class="hint">讀目前這一頁時就先把下一頁翻好,翻過去就能直接顯示。照順序往後讀時不會多花;跳頁、往回翻或停止閱讀時,預先翻好但沒讀到的頁照樣計費。只用於翻譯方式 1、2,而且只在側邊欄開著、勾選「翻頁自動翻譯」時。</div>
<label class="check"><input type="checkbox" id="referencePages" /> 校對時參考前面的頁(實驗)</label>
<div class="hint">用於翻譯方式 2。兩件事:<br />・把同一本書在目前這一頁之前讀過的段落(原文和定稿的譯文)一起送給 Sonnet 校對,統一專有名詞、稱呼和語氣。畫上去的段落會存在這台電腦上,保留 1 週。<br />・每本書記一份人名對照表(英文原名 → 譯名),由 Sonnet 校對時整理,之後每次翻譯和校對都照它翻人名,不管隔了多少頁。每個名字最後一次出現後保留 30 天。已經記下的譯名不會被改掉。<br />上限 16000 時,連續閱讀每頁約多 1.3 美分。</div>
<label for="referenceTokens">參考段落的上限(tokens)</label>
<input id="referenceTokens" type="number" min="2000" max="100000" step="1000" />
<div class="hint">雙頁一個畫面約 3,000–3,500 tokens。超過上限時一次丟掉較舊的一半。人名對照表不受這個上限限制。<button id="clearReference" type="button" class="link">刪除已存的參考段落和人名對照表</button><span id="cleared"></span></div>
<label for="targetLang">目標語言</label>
<input id="targetLang" />
<div class="hint">例如「繁體中文(台灣用語)」、「繁體中文(香港用語)」。</div>
<button id="save">儲存</button><span id="saved"></span>
<details id="developer">
<summary>開發者</summary>
<label class="check"><input type="checkbox" id="devCapture" /> 允許測試工具觸發「存下頁面資料」</label>
<div class="hint">讓操作 Kindle 頁面的測試工具要求目前這一頁的頁面資料,直接送到這台電腦上的接收程式(127.0.0.1:8765,<code>tests/tools/receive-pages.js</code>),用來除錯。頁面只會知道成功或失敗,拿不到資料。資料裡有書的字型輪廓,不要放進 repo。只存在這台電腦,立即生效;不做開發請保持關閉。</div>
</details>
<script src="options.js"></script>
</body>
</html>