-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.html
More file actions
152 lines (141 loc) · 5.92 KB
/
Copy pathoptions.html
File metadata and controls
152 lines (141 loc) · 5.92 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
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Ask GPT 设置</title>
<link rel="stylesheet" href="options.css" />
</head>
<body>
<main class="settings">
<header>
<div class="mark">◎</div>
<div>
<h1>Ask GPT for Chrome</h1>
<p>默认使用 ChatGPT OAuth,也支持 OpenAI API Key 和本机 Codex Bridge。凭据只保存在本机 Chrome 扩展存储里。</p>
</div>
</header>
<form id="settingsForm">
<fieldset class="auth-mode">
<legend>登录方式</legend>
<label><input name="authMode" value="chatgpt-oauth" type="radio" /> ChatGPT OAuth</label>
<label><input name="authMode" value="api-key" type="radio" /> OpenAI API Key</label>
<label><input name="authMode" value="codex-native" type="radio" /> 本机 Codex Bridge</label>
</fieldset>
<section class="oauth-box">
<div class="oauth-copy">
<strong id="oauthStatus">未登录</strong>
<p id="oauthDetail">使用 ChatGPT Pro 账号登录,走 Codex 同款 device-code OAuth。</p>
<div id="deviceCodePanel" class="device-code-panel" hidden>
<span>在 OpenAI 授权页输入这个 9 位代码</span>
<code id="deviceCodeValue"></code>
<div class="device-code-actions">
<button id="copyDeviceCode" type="button">复制代码</button>
<button id="openDevicePage" type="button">打开授权页</button>
</div>
</div>
</div>
<div class="oauth-actions">
<button id="loginChatGPT" type="button">获取登录码</button>
<button id="logoutChatGPT" type="button">登出</button>
</div>
</section>
<label>
<span>OpenAI API Key</span>
<input id="apiKey" type="password" autocomplete="off" placeholder="sk-..." />
</label>
<label>
<span>API Key 模型</span>
<input id="model" type="text" placeholder="gpt-4.1-mini" />
</label>
<label>
<span>ChatGPT OAuth 模型</span>
<input id="codexModel" type="text" placeholder="gpt-5.4-mini" />
</label>
<label>
<span>Responses API 地址</span>
<input id="endpoint" type="url" placeholder="https://api.openai.com/v1/responses" />
</label>
<section class="native-box">
<div class="native-copy">
<strong>本机 Codex Bridge</strong>
<p>通过 Chrome Native Messaging 调用本机 Codex。当前默认走 `codex exec`;如果本机有 ACP stdio agent,可切换到 ACP 命令。</p>
</div>
<label>
<span>传输模式</span>
<select id="codexNativeMode">
<option value="exec">Codex CLI exec</option>
<option value="acp">ACP stdio command</option>
</select>
</label>
<label>
<span>Codex 路径</span>
<input id="codexNativePath" type="text" placeholder="codex" />
</label>
<label>
<span>ACP 命令</span>
<input id="codexAcpCommand" type="text" placeholder="codex acp" />
</label>
<label>
<span>工作目录</span>
<input id="codexNativeCwd" type="text" placeholder="/Users/you/project" />
</label>
<label>
<span>Codex 模型</span>
<input id="codexNativeModel" type="text" placeholder="留空使用 ~/.codex/config.toml" />
</label>
<label>
<span>Codex Profile</span>
<input id="codexNativeProfile" type="text" placeholder="可选" />
</label>
<div class="native-grid">
<label>
<span>Sandbox</span>
<select id="codexNativeSandbox">
<option value="workspace-write">workspace-write</option>
<option value="read-only">read-only</option>
<option value="danger-full-access">danger-full-access</option>
</select>
</label>
<label>
<span>审批策略</span>
<select id="codexNativeApproval">
<option value="never">never</option>
<option value="on-request">on-request</option>
<option value="untrusted">untrusted</option>
</select>
</label>
</div>
<label>
<span>超时秒数</span>
<input id="codexNativeTimeout" type="number" min="30" max="3600" step="30" placeholder="900" />
</label>
</section>
<div class="checks">
<label><input id="includePage" type="checkbox" /> 默认带入页面正文</label>
<label><input id="includeSelection" type="checkbox" /> 默认带入选中文本</label>
<label><input id="showFloatingButton" type="checkbox" /> 在页面右下角显示“问问 ChatGPT”</label>
</div>
<section class="vault-box">
<div class="vault-copy">
<strong>Obsidian Vault</strong>
<p id="vaultStatus">未选择 vault。Agent 保存笔记前需要先授权一个本地目录。</p>
</div>
<div class="vault-actions">
<button id="selectVault" type="button">选择 Vault</button>
<button id="clearVault" type="button">清除</button>
</div>
</section>
<div class="actions">
<button type="submit">保存</button>
<button id="testConnection" type="button">测试连接</button>
</div>
</form>
<p id="status" role="status"></p>
</main>
<script src="auth.js"></script>
<script src="codex_bridge.js"></script>
<script src="vault.js"></script>
<script src="options.js"></script>
</body>
</html>