First version running with npm run dev

This commit is contained in:
pascalyazid committed 2026-03-11 15:11:57 +00:00
commit f90ec06a4f
28 files changed
+12042

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
import { ref, onMounted } from "vue";
const STORAGE_KEY = "quick-ling-settings";
const DEFAULT_MODEL = "translategemma:4b";
interface Settings {
model: string;
}
const model = ref(DEFAULT_MODEL);
function loadSettings(): void {
if (typeof localStorage !== "undefined") {
try {
const stored = localStorage.getItem(STORAGE_KEY);
if (stored) {
const parsed: Settings = JSON.parse(stored);
if (parsed.model) {
model.value = parsed.model;
}
}
} catch {
// ignore parse errors
}
}
}
function saveSettings(): void {
if (typeof localStorage !== "undefined") {
const settings: Settings = { model: model.value };
localStorage.setItem(STORAGE_KEY, JSON.stringify(settings));
}
}
export function useSettings() {
function setModel(newModel: string): void {
model.value = newModel;
saveSettings();
}
onMounted(() => {
loadSettings();
});
return {
model,
setModel,
};
}