初版Demo完善
This commit is contained in:
1 parent
1b8f833789
commit
34d658c2b9
10 files changed
+75
-75
No files matched your search
+1
-1
@@ -30,7 +30,7 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h3>⚙️ AI 模型配置</h3>
|
||||
<h3> AI 模型配置</h3>
|
||||
|
||||
<div class="item">
|
||||
<label>API Base URL</label>
|
||||
|
||||
+3
-5
@@ -1,15 +1,14 @@
|
||||
// 页面加载时读取存储的配置
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// 同时获取 aiConfig 和 voiceEnabled 状态
|
||||
|
||||
chrome.storage.sync.get(['aiConfig', 'voiceEnabled'], (result) => {
|
||||
const config = result.aiConfig || {};
|
||||
|
||||
// 填充 API 配置
|
||||
document.getElementById('apiUrl').value = config.apiUrl || DEFAULT_URL;
|
||||
document.getElementById('apiKey').value = config.apiKey || "";
|
||||
document.getElementById('modelName').value = config.modelName || DEFAULT_MODEL;
|
||||
|
||||
// 填充语音开关状态(默认为关闭 false)
|
||||
// 语音开关状态(默认为关闭)
|
||||
document.getElementById('voiceEnabled').checked = result.voiceEnabled || false;
|
||||
});
|
||||
});
|
||||
@@ -26,7 +25,7 @@ document.getElementById('save').addEventListener('click', () => {
|
||||
|
||||
// 验证 API Key 是否填写
|
||||
if (!config.apiKey) {
|
||||
showStatus("❌ 请输入 API Key", "#f56c6c");
|
||||
showStatus("请输入 API Key", "#f56c6c");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,7 +38,6 @@ document.getElementById('save').addEventListener('click', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// 状态提示函数
|
||||
function showStatus(text, color) {
|
||||
const status = document.getElementById('status');
|
||||
status.textContent = text;
|
||||
|
||||
Reference in new issue
Block a user