summaryrefslogtreecommitdiff
path: root/src/options
diff options
context:
space:
mode:
Diffstat (limited to 'src/options')
-rw-r--r--src/options/options.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/options/options.js b/src/options/options.js
index b4fc349..09d0a5f 100644
--- a/src/options/options.js
+++ b/src/options/options.js
@@ -102,6 +102,11 @@ function fillModels(models, selected) {
$model.append(option);
showStatus('保存済みモデルがOllama上に見つかりません。', true);
}
+ if (!selected && models.length > 0) {
+ // No model saved yet: explicitly select the first one so the UI value
+ // matches what will be saved (see popup fillModels note).
+ $model.selectedIndex = 0;
+ }
}
async function loadModels(selected) {
@@ -158,6 +163,13 @@ async function loadSettings() {
const settings = result.settings || defaultSettings();
applySettings(settings);
await loadModels(settings.model);
+ // If no model was saved yet and the list just loaded, sync the
+ // auto-selected first model into storage so it matches the UI.
+ if (!settings.model && $model.value) {
+ await browser.storage.local.set({
+ settings: sanitizeSettings({ ...settings, model: $model.value })
+ });
+ }
}
function readForm() {