frontend fixes & db rewrite with serde

This commit is contained in:
Priler 2026-01-04 09:00:51 +05:00
parent 61b7a79455
commit 091a41ac33
37 changed files with 910 additions and 663 deletions

View file

@ -1,15 +1,15 @@
<!-- src/App.svelte -->
<script>
import { Router } from "@roxi/routify";
import { routes } from "../.routify/routes";
import routes from "../.routify/routes.default.js";
import { SvelteUIProvider } from '@svelteuidev/core';
import Events from "./Events.svelte";
/** START LISTENING **/
import { startListening } from "./functions";
startListening();
// import { startListening } from "./functions";
// startListening();
</script>
<SvelteUIProvider themeObserver='dark' withNormalizeCSS withGlobalStyles>

View file

@ -8,7 +8,7 @@
let assistant_voice_val = "jarvis-og";
import { assistant_voice } from "@/stores"
import { invoke } from '@tauri-apps/api/tauri';
import { invoke } from "@tauri-apps/api/core";
assistant_voice.subscribe(value => {
assistant_voice_val = value;
});
@ -34,11 +34,11 @@
});
await listen('assistant-greet', (event) => {
document.getElementById("arc-reactor").classList.add("active");
document.getElementById("arc-reactor")?.classList.add("active");
});
await listen('assistant-waiting', (event) => {
document.getElementById("arc-reactor").classList.remove("active");
document.getElementById("arc-reactor")?.classList.remove("active");
});
});
</script>

View file

@ -1,5 +1,5 @@
<script>
import { invoke } from "@tauri-apps/api/tauri"
import { invoke } from "@tauri-apps/api/core"
import { tg_official_link, github_repository_link } from "@/stores";

View file

@ -1,5 +1,5 @@
<script lang="ts">
import { invoke } from "@tauri-apps/api/tauri"
import { invoke } from "@tauri-apps/api/core"
import { Dashboard, Gear } from 'radix-icons-svelte'
import {isActive} from '@roxi/routify'

View file

@ -1,6 +1,6 @@
<script>
// IMPORTS
import { invoke } from "@tauri-apps/api/tauri"
import { invoke } from "@tauri-apps/api/core"
import { onMount } from 'svelte'
import { capitalizeFirstLetter } from "@/functions";

View file

@ -2,13 +2,13 @@ import { invoke } from "@tauri-apps/api/core"
import { is_listening, isListening } from "@/stores"
import { clearInterval, clearTimeout, setInterval, setTimeout } from 'worker-timers';
setInterval(() => {
(async () => {
is_listening.set(await invoke("is_listening"));
})().catch(err => {
console.error(err);
});
}, 1000);
// setInterval(() => {
// (async () => {
// is_listening.set(await invoke("is_listening"));
// })().catch(err => {
// console.error(err);
// });
// }, 1000);
export function startListening() {
(async () => {
@ -26,7 +26,7 @@ export function startListening() {
});
}
export function stopListening(callback) {
export function stopListening(callback: () => void) {
(async () => {
invoke('stop_listening')
.then((message) => {
@ -43,11 +43,11 @@ export function stopListening(callback) {
});
}
export function capitalizeFirstLetter(string) {
export function capitalizeFirstLetter(string: string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
export function showInExplorer(path) {
export function showInExplorer(path: any) {
(async () => {
invoke('show_in_folder', {path: path})
.then((message) => {})

View file

@ -7,7 +7,7 @@ import "./css/styles.scss";
// deploy app
import App from "./App.svelte";
const app = new App({
target: document.getElementById("app"),
target: document.getElementById("app")!,
});
export default app;

View file

@ -1,10 +1,10 @@
<script lang="ts">
// IMPORTS
import { invoke } from "@tauri-apps/api/tauri"
import { invoke } from "@tauri-apps/api/core"
import { goto } from '@roxi/routify'
import { onMount } from 'svelte'
import { startListening, stopListening, showInExplorer } from "@/functions";
import { setTimeout } from 'worker-timers';
// import { setTimeout } from 'worker-timers';
import { feedback_link, log_file_path } from "@/stores";
@ -17,7 +17,7 @@
// VARIABLES
let available_microphones = [];
let available_microphones: { label: string; value: number }[] = [];
let settings_saved = false;
let save_button_disabled = false;
@ -70,10 +70,10 @@
let _available_microphones: Array<Number> = await invoke("pv_get_audio_devices");
Object.entries(_available_microphones).forEach(entry => {
const [k, v] = entry;
available_microphones.push({
label: v,
value: k
label: String(v),
value: Number(k)
});
});
@ -134,9 +134,9 @@
<Space h="sm" />
<NativeSelect data={[
{ label: 'Rustpotter', value: 'rustpotter' },
{ label: 'Vosk (медленный)', value: 'vosk' },
{ label: 'Picovoice Porcupine (требует API ключ)', value: 'picovoice' }
{ label: 'Rustpotter', value: 'Rustpotter' },
{ label: 'Vosk (медленный)', value: 'Vosk' },
{ label: 'Picovoice Porcupine (требует API ключ)', value: 'Picovoice' }
]}
label="Распознавание активационной фразы (Wake Word)"
description="Выберите, какая нейросеть будет отвечать за распознавание активационной фразы."