chore: initial commit — existing single-user document scanner codebase
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import * as api from '../api/client.js'
|
||||
|
||||
export const useSettingsStore = defineStore('settings', () => {
|
||||
const settings = ref(null)
|
||||
const loading = ref(false)
|
||||
const error = ref(null)
|
||||
|
||||
async function fetchSettings() {
|
||||
loading.value = true
|
||||
error.value = null
|
||||
try {
|
||||
settings.value = await api.getSettings()
|
||||
} catch (e) {
|
||||
error.value = e.message
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function save(patch) {
|
||||
const updated = await api.patchSettings(patch)
|
||||
settings.value = updated
|
||||
return updated
|
||||
}
|
||||
|
||||
async function testConnection(provider) {
|
||||
return api.testProvider(provider)
|
||||
}
|
||||
|
||||
async function resetPrompt() {
|
||||
const data = await api.getDefaultPrompt()
|
||||
return data.system_prompt
|
||||
}
|
||||
|
||||
return { settings, loading, error, fetchSettings, save, testConnection, resetPrompt }
|
||||
})
|
||||
Reference in New Issue
Block a user