diff --git a/src/App.vue b/src/App.vue index 511e3b6..f9b33ca 100644 --- a/src/App.vue +++ b/src/App.vue @@ -14,7 +14,10 @@ import { Sun, Moon, User, - Type + Type, + Plus, + Save, + Play } from 'lucide-vue-next'; import { invoke } from '@tauri-apps/api/core'; import { listen } from '@tauri-apps/api/event'; @@ -23,7 +26,8 @@ import { LANGUAGES, DEFAULT_TEMPLATE, SPEAKER_IDENTITY_OPTIONS, - TONE_REGISTER_OPTIONS + TONE_REGISTER_OPTIONS, + type ApiProfile } from './stores/settings'; import pkg from '../package.json'; import { clsx, type ClassValue } from 'clsx'; @@ -50,6 +54,36 @@ const toggleTheme = () => { const view = ref<'translate' | 'settings' | 'logs'>('translate'); +// Profile Management +const newProfileName = ref(''); +const isSavingProfile = ref(false); + +const saveCurrentAsProfile = () => { + if (!newProfileName.value.trim()) return; + + const newProfile: ApiProfile = { + id: crypto.randomUUID(), + name: newProfileName.value.trim(), + apiBaseUrl: settings.apiBaseUrl, + apiKey: settings.apiKey, + modelName: settings.modelName + }; + + settings.profiles.push(newProfile); + newProfileName.value = ''; + isSavingProfile.value = false; +}; + +const applyProfile = (p: ApiProfile) => { + settings.apiBaseUrl = p.apiBaseUrl; + settings.apiKey = p.apiKey; + settings.modelName = p.modelName; +}; + +const deleteProfile = (id: string) => { + settings.profiles = settings.profiles.filter(p => p.id !== id); +}; + // Dropdown State const sourceDropdownOpen = ref(false); const targetDropdownOpen = ref(false); @@ -466,7 +500,79 @@ const translate = async () => {
{{ typeof log.content === 'object' ? JSON.stringify(log.content, null, 2) : log.content }}
+ {{ typeof log.content === 'object' ? JSON.stringify(log.content, null, 2) : log.content }}