frontend cleanup
This commit is contained in:
parent
091a41ac33
commit
0c28304840
38 changed files with 2873 additions and 1180 deletions
|
|
@ -1,34 +1,50 @@
|
|||
import { writable, get } from "svelte/store"
|
||||
import { invoke } from "@tauri-apps/api/core"
|
||||
import { writable } from 'svelte/store'
|
||||
|
||||
// listen state
|
||||
export const is_listening = writable(true);
|
||||
let is_listening__val: boolean;
|
||||
is_listening.subscribe(value => {
|
||||
is_listening__val = value;
|
||||
});
|
||||
export function isListening() {return is_listening__val}
|
||||
// ### LISTENING STATE
|
||||
// note: defaults to false since GUI doesn't have listening capability
|
||||
export const isListening = writable(false)
|
||||
|
||||
// assistant voice
|
||||
export const assistant_voice = writable("");
|
||||
// ### ASSISTANT VOICE
|
||||
export const assistantVoice = writable("")
|
||||
|
||||
(async () => {
|
||||
assistant_voice.set(await invoke("db_read", {key: "assistant_voice"}));
|
||||
})().catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
// load voice setting from db
|
||||
async function loadVoiceSetting() {
|
||||
try {
|
||||
const voice = await invoke<string>("db_read", { key: "assistant_voice" })
|
||||
assistantVoice.set(voice)
|
||||
} catch (err) {
|
||||
console.error("failed to load voice setting:", err)
|
||||
}
|
||||
}
|
||||
loadVoiceSetting()
|
||||
|
||||
// etc
|
||||
export let tg_official_link = "";
|
||||
export let feedback_link = "";
|
||||
export let github_repository_link = "";
|
||||
export let log_file_path = "";
|
||||
// ### APP INFO
|
||||
// these are loaded once on startup
|
||||
export const appInfo = writable({
|
||||
tgOfficialLink: "",
|
||||
feedbackLink: "",
|
||||
repositoryLink: "",
|
||||
logFilePath: ""
|
||||
})
|
||||
|
||||
(async () => {
|
||||
tg_official_link = await invoke("get_tg_official_link")
|
||||
feedback_link = await invoke("get_feedback_link")
|
||||
github_repository_link = await invoke("get_repository_link")
|
||||
log_file_path = await invoke("get_log_file_path")
|
||||
})().catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
async function loadAppInfo() {
|
||||
try {
|
||||
const [tg, feedback, repo, logPath] = await Promise.all([
|
||||
invoke<string>("get_tg_official_link"),
|
||||
invoke<string>("get_feedback_link"),
|
||||
invoke<string>("get_repository_link"),
|
||||
invoke<string>("get_log_file_path")
|
||||
])
|
||||
|
||||
appInfo.set({
|
||||
tgOfficialLink: tg,
|
||||
feedbackLink: feedback,
|
||||
repositoryLink: repo,
|
||||
logFilePath: logPath
|
||||
})
|
||||
} catch (err) {
|
||||
console.error("failed to load app info:", err)
|
||||
}
|
||||
}
|
||||
loadAppInfo()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue