mirror of
https://github.com/Priler/jarvis.git
synced 2026-05-26 07:08:11 +00:00
App window size lowered
Open logs button added Better links handling Multiple UI fixes/improvements etc
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/media/app-icon.png" />
|
||||
<link rel="icon" type="image/svg+xml" href="/media/header-logo.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Tauri + Svelte + TS</title>
|
||||
<title>Проект J.A.R.V.I.S.</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 38 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 30 KiB |
BIN
public/media/header-logo.png
Normal file
BIN
public/media/header-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
BIN
public/media/icons/github-logo.png
Normal file
BIN
public/media/icons/github-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
BIN
public/media/icons/howdy-logo.png
Normal file
BIN
public/media/icons/howdy-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -1,45 +0,0 @@
|
||||
[tasks.format]
|
||||
install_crate = "rustfmt"
|
||||
command = "cargo"
|
||||
args = ["fmt", "--", "--emit=files"]
|
||||
|
||||
[tasks.clean]
|
||||
command = "cargo"
|
||||
args = ["clean"]
|
||||
|
||||
[tasks.build_debug]
|
||||
command = "cargo"
|
||||
args = ["build"]
|
||||
|
||||
[tasks.run]
|
||||
command = "cargo"
|
||||
args = ["run"]
|
||||
|
||||
[tasks.build_release]
|
||||
command = "cargo"
|
||||
args = ["build", "--release"]
|
||||
dependencies = ["clean"]
|
||||
|
||||
[tasks.test]
|
||||
command = "cargo"
|
||||
args = ["test"]
|
||||
# dependencies = ["clean"]
|
||||
|
||||
[tasks.vosk]
|
||||
script_runner = "python"
|
||||
script_extension = "py"
|
||||
script = { file = "vosk_build.py" }
|
||||
|
||||
[tasks.debug]
|
||||
dependencies = [
|
||||
"format",
|
||||
"build_debug",
|
||||
"vosk"
|
||||
]
|
||||
|
||||
[tasks.release]
|
||||
dependencies = [
|
||||
"format",
|
||||
"build_release",
|
||||
"vosk"
|
||||
]
|
||||
@@ -29,3 +29,4 @@ list:
|
||||
- закрой калькулятор
|
||||
- отключи калькулятор
|
||||
- выключи калькулятор
|
||||
- убери калькулятор
|
||||
@@ -1,3 +1,7 @@
|
||||
use std::iter::Once;
|
||||
|
||||
use once_cell::sync::OnceCell;
|
||||
|
||||
// use const_concat::const_concat;
|
||||
|
||||
// pub const IS_DEV: bool = cfg!(debug_assertions);// cfg!(debug_assertions);
|
||||
@@ -22,6 +26,8 @@ pub const LOG_FILE_NAME: &str = "log.txt";
|
||||
pub const APP_VERSION: Option<&str> = option_env!("CARGO_PKG_VERSION");
|
||||
pub const AUTHOR_NAME: Option<&str> = option_env!("CARGO_PKG_AUTHORS");
|
||||
pub const REPOSITORY_LINK: Option<&str> = option_env!("CARGO_PKG_REPOSITORY");
|
||||
pub const TG_OFFICIAL_LINK: Option<&str> = Some("https://t.me/howdyho_official");
|
||||
pub const FEEDBACK_LINK: Option<&str> = Some("https://t.me/jarvis_feedback_bot");
|
||||
|
||||
// RUSPOTTER
|
||||
pub const RUSPOTTER_MIN_SCORE: f32 = 0.62;
|
||||
@@ -38,10 +44,11 @@ pub const VOSK_MIN_RATIO: f64 = 70.0;
|
||||
|
||||
// ETC
|
||||
pub const CMD_RATIO_THRESHOLD: f64 = 60f64;
|
||||
pub const CMS_WAIT_DELAY: std::time::Duration = std::time::Duration::from_secs(10);
|
||||
pub const CMS_WAIT_DELAY: std::time::Duration = std::time::Duration::from_secs(15);
|
||||
|
||||
pub const ASSISTANT_GREET_PHRASES: [&str; 3] = ["greet1", "greet2", "greet3"];
|
||||
pub const ASSISTANT_PHRASES_TBR: [&str; 16] = [
|
||||
pub const ASSISTANT_PHRASES_TBR: [&str; 17] = [
|
||||
"джарвис",
|
||||
"сэр",
|
||||
"слушаю сэр",
|
||||
"всегда к услугам",
|
||||
|
||||
@@ -78,7 +78,7 @@ fn main() {
|
||||
// log to file
|
||||
let log_file_path = format!("{}/{}", APP_LOG_DIR.lock().unwrap(), config::LOG_FILE_NAME);
|
||||
println!("!!!===============!!!\nLOGGING TO {}\n!!!===============!!!\n", &log_file_path);
|
||||
simple_logging::log_to_file(log_file_path, LevelFilter::max()).expect("Failed to start logger ... is directory writable?");
|
||||
simple_logging::log_to_file(&log_file_path, LevelFilter::max()).expect("Failed to start logger ... is directory writable?");
|
||||
|
||||
Ok(())
|
||||
})
|
||||
@@ -100,10 +100,15 @@ fn main() {
|
||||
tauri_commands::get_cpu_usage,
|
||||
// sound commands
|
||||
tauri_commands::play_sound,
|
||||
// fs commands
|
||||
tauri_commands::show_in_folder,
|
||||
// etc commands
|
||||
tauri_commands::get_app_version,
|
||||
tauri_commands::get_author_name,
|
||||
tauri_commands::get_repository_link
|
||||
tauri_commands::get_repository_link,
|
||||
tauri_commands::get_tg_official_link,
|
||||
tauri_commands::get_feedback_link,
|
||||
tauri_commands::get_log_file_path
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
|
||||
@@ -18,6 +18,10 @@ pub use sys::*;
|
||||
mod voice;
|
||||
pub use voice::*;
|
||||
|
||||
// import FS commands
|
||||
mod fs;
|
||||
pub use fs::*;
|
||||
|
||||
// import ETC commands
|
||||
mod etc;
|
||||
pub use etc::*;
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
use crate::config::APP_VERSION;
|
||||
use crate::config::AUTHOR_NAME;
|
||||
use crate::config::REPOSITORY_LINK;
|
||||
use crate::config;
|
||||
use crate::APP_LOG_DIR;
|
||||
|
||||
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_app_version() -> String {
|
||||
if let Some(ver) = APP_VERSION {
|
||||
ver.to_string()
|
||||
if let Some(res) = config::APP_VERSION {
|
||||
res.to_string()
|
||||
} else {
|
||||
String::from("error")
|
||||
}
|
||||
@@ -15,8 +14,8 @@ pub fn get_app_version() -> String {
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_author_name() -> String {
|
||||
if let Some(ver) = AUTHOR_NAME {
|
||||
ver.to_string()
|
||||
if let Some(res) = config::AUTHOR_NAME {
|
||||
res.to_string()
|
||||
} else {
|
||||
String::from("error")
|
||||
}
|
||||
@@ -24,9 +23,32 @@ pub fn get_author_name() -> String {
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_repository_link() -> String {
|
||||
if let Some(ver) = REPOSITORY_LINK {
|
||||
if let Some(res) = config::REPOSITORY_LINK {
|
||||
res.to_string()
|
||||
} else {
|
||||
String::from("error")
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_tg_official_link() -> String {
|
||||
if let Some(ver) = config::TG_OFFICIAL_LINK {
|
||||
ver.to_string()
|
||||
} else {
|
||||
String::from("error")
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_feedback_link() -> String {
|
||||
if let Some(res) = config::FEEDBACK_LINK {
|
||||
res.to_string()
|
||||
} else {
|
||||
String::from("error")
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_log_file_path() -> String {
|
||||
format!("{}", APP_LOG_DIR.lock().unwrap())
|
||||
}
|
||||
47
src-tauri/src/tauri_commands/fs.rs
Normal file
47
src-tauri/src/tauri_commands/fs.rs
Normal file
@@ -0,0 +1,47 @@
|
||||
use std::process::Command;
|
||||
|
||||
// taken from https://github.com/tauri-apps/tauri/issues/4062#issuecomment-1338048169
|
||||
#[tauri::command]
|
||||
pub fn show_in_folder(path: String) {
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
Command::new("explorer")
|
||||
.args(["/select,", &path]) // The comma after select is not a typo
|
||||
.spawn()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
if path.contains(",") {
|
||||
// see https://gitlab.freedesktop.org/dbus/dbus/-/issues/76
|
||||
let new_path = match metadata(&path).unwrap().is_dir() {
|
||||
true => path,
|
||||
false => {
|
||||
let mut path2 = PathBuf::from(path);
|
||||
path2.pop();
|
||||
path2.into_os_string().into_string().unwrap()
|
||||
}
|
||||
};
|
||||
Command::new("xdg-open")
|
||||
.arg(&new_path)
|
||||
.spawn()
|
||||
.unwrap();
|
||||
} else {
|
||||
Command::new("dbus-send")
|
||||
.args(["--session", "--dest=org.freedesktop.FileManager1", "--type=method_call",
|
||||
"/org/freedesktop/FileManager1", "org.freedesktop.FileManager1.ShowItems",
|
||||
format!("array:string:\"file://{path}\"").as_str(), "string:\"\""])
|
||||
.spawn()
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
Command::new("open")
|
||||
.args(["-R", &path])
|
||||
.spawn()
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
@@ -134,6 +134,7 @@ fn keyword_callback(_keyword_index: i32) {
|
||||
for tbr in config::ASSISTANT_PHRASES_TBR {
|
||||
test = test.replace(tbr, "");
|
||||
}
|
||||
test = test.trim().into();
|
||||
|
||||
// infer command
|
||||
if let Some((cmd_path, cmd_config)) =
|
||||
|
||||
@@ -60,8 +60,8 @@
|
||||
"fullscreen": false,
|
||||
"resizable": false,
|
||||
"title": "Jarvis Voice Assistant",
|
||||
"width": 550,
|
||||
"height": 820
|
||||
"width": 500,
|
||||
"height": 700
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
# Simple python script used to
|
||||
# copy Vosk libraries to the "target" directory
|
||||
# after Rust build
|
||||
|
||||
# Note that Rust build should be run via "cargo make <cmd>" command
|
||||
# in order to automate all the compile process
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
|
||||
# some config vars
|
||||
VOSK_LIBRARIES_PATH = "D:/Rust/vosk"
|
||||
TARGET_DIRS = (
|
||||
os.getcwd() + "/target/debug",
|
||||
os.getcwd() + "/target/release"
|
||||
)
|
||||
|
||||
for tdir in TARGET_DIRS:
|
||||
if not Path(tdir).is_dir():
|
||||
continue
|
||||
|
||||
vosk_lib_testfile = Path(tdir + "/libvosk.dll")
|
||||
|
||||
if vosk_lib_testfile.is_file():
|
||||
# skip
|
||||
print("[Vosk] library files already exist in " + tdir)
|
||||
else:
|
||||
# copy lib files
|
||||
src_files = os.listdir(VOSK_LIBRARIES_PATH)
|
||||
for file_name in src_files:
|
||||
full_file_name = os.path.join(VOSK_LIBRARIES_PATH, file_name)
|
||||
if os.path.isfile(full_file_name):
|
||||
shutil.copy(full_file_name, tdir)
|
||||
|
||||
print("[Vosk] library files was copied to " + tdir)
|
||||
@@ -1,13 +1,14 @@
|
||||
<script>
|
||||
import { invoke } from "@tauri-apps/api/tauri"
|
||||
|
||||
import { tg_official_link, github_repository_link } from "@/stores";
|
||||
|
||||
let current_year = new Date().getFullYear();
|
||||
let author_name = "";
|
||||
let github_repository_link = "";
|
||||
|
||||
(async () => {
|
||||
author_name = await invoke("get_author_name")
|
||||
github_repository_link = await invoke("get_repository_link")
|
||||
|
||||
})().catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
@@ -15,7 +16,10 @@
|
||||
|
||||
<footer id="footer">
|
||||
<p>© {current_year}. Автор проекта: {author_name}</p>
|
||||
<p><a href="{github_repository_link}" target="_blank">Github репозиторий</a> проекта.</p>
|
||||
<p style="margin-top: 5px;margin-bottom: 15px;">
|
||||
<a href="{tg_official_link}" target="_blank" class="special-link"><img src="/media/icons/howdy-logo.png" alt="" width="20px"> Наш телеграм</a> канал.
|
||||
|
||||
<a href="{github_repository_link}" target="_blank"><img src="/media/icons/github-logo.png" alt="" width="18px"> Github репозиторий</a> проекта.</p>
|
||||
</footer>
|
||||
|
||||
<style lang="scss">
|
||||
@@ -35,9 +39,34 @@
|
||||
a {
|
||||
color: #185876;
|
||||
text-decoration: none;
|
||||
transition: opacity .5s;
|
||||
|
||||
img {
|
||||
opacity: .5;
|
||||
transition: opacity .5s;
|
||||
margin-top: -4px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: #2A9CD0;
|
||||
|
||||
img {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&.special-link {
|
||||
color: #941d92;
|
||||
display: inline-block;
|
||||
|
||||
&:hover {
|
||||
color: #FF07FC;
|
||||
|
||||
background: url(/media/images/bg/bg24.gif);
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
</script>
|
||||
<header id="header">
|
||||
<div class="logo">
|
||||
<a href="/" title="Хауди Хо!"><img src="/media/app-logo.png" alt=""></a>
|
||||
<a href="/" title="Проект канала Хауди Хо!"><img src="/media/header-logo.png" alt=""></a>
|
||||
<div>
|
||||
<h1><a href="/">JARVIS</a></h1>
|
||||
<h2>v{app_version} <small style="color: #8AC832;opacity: .9;font-size: 13px;">BETA</small></h2>
|
||||
|
||||
@@ -49,12 +49,14 @@
|
||||
|
||||
.reactor-container {
|
||||
width: 300px;
|
||||
height: 400px;
|
||||
height: 320px;
|
||||
margin: auto;
|
||||
// border: 1px dashed #888;
|
||||
position: relative;
|
||||
border-radius: 50%;
|
||||
transition: scale 1s;
|
||||
transition: scale 1s ease, opacity .5s ease;
|
||||
scale: 0.9;
|
||||
opacity: .9;
|
||||
// background-color: #384c50;
|
||||
// border: 1px solid #121414;
|
||||
// box-shadow: 0px 0px 32px 8px #121414, 0px 0px 4px 1px #121414 inset;
|
||||
@@ -113,7 +115,7 @@
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
animation: 8s infinite linear reactor-anim;
|
||||
animation: 10s infinite linear reactor-anim;
|
||||
transition: animation 1s;
|
||||
}
|
||||
.coil {
|
||||
@@ -586,7 +588,8 @@
|
||||
$colour3: rgba(2, 255, 255, 0.3);
|
||||
$cshadow: rgba(2, 254, 255, 0.8);
|
||||
|
||||
scale: 1.07;
|
||||
scale: 1.1;
|
||||
opacity: 1;
|
||||
.coil-container {
|
||||
animation: 3s infinite linear reactor-anim;
|
||||
}
|
||||
|
||||
@@ -46,3 +46,16 @@ export function stopListening(callback) {
|
||||
export function capitalizeFirstLetter(string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
}
|
||||
|
||||
export function showInExplorer(path) {
|
||||
(async () => {
|
||||
invoke('show_in_folder', {path: path})
|
||||
.then((message) => {})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
// alert("Ошибка: " + error);
|
||||
})
|
||||
})().catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
@@ -2,13 +2,22 @@
|
||||
import HDivider from "@/components/elements/HDivider.svelte"
|
||||
import Footer from "@/components/Footer.svelte"
|
||||
|
||||
import { Notification } from '@svelteuidev/core';
|
||||
import { Notification, Space } from '@svelteuidev/core';
|
||||
import { InfoCircled } from 'radix-icons-svelte';
|
||||
|
||||
import { tg_official_link } from "@/stores";
|
||||
</script>
|
||||
|
||||
<HDivider />
|
||||
<Notification title='404' icon={InfoCircled} color='blue' withCloseButton={false}>
|
||||
Этот раздел еще находится в разработке.
|
||||
<Space h="xl" />
|
||||
|
||||
<Notification title='[404] Этот раздел еще находится в разработке!' icon={InfoCircled} color='blue' withCloseButton={false}>
|
||||
Тут будет список команд + полноценный редактор команд.<br>
|
||||
Следите за обновлениями в <a href="{tg_official_link}" target="_blank">нашем телеграм канале</a>!
|
||||
</Notification>
|
||||
|
||||
<div style="text-align: center;margin-top: 25px;">
|
||||
<img src="/media/images/tenor.gif" alt="bruh" width="320px">
|
||||
</div>
|
||||
|
||||
<HDivider />
|
||||
<Footer />
|
||||
@@ -3,17 +3,20 @@
|
||||
import { invoke } from "@tauri-apps/api/tauri"
|
||||
import { goto } from '@roxi/routify'
|
||||
import { onMount } from 'svelte'
|
||||
import { startListening, stopListening } from "@/functions";
|
||||
import { startListening, stopListening, showInExplorer } from "@/functions";
|
||||
import { setTimeout } from 'worker-timers';
|
||||
|
||||
import { feedback_link, log_file_path } from "@/stores";
|
||||
|
||||
// COMPONENTS & STUFF
|
||||
import HDivider from "@/components/elements/HDivider.svelte"
|
||||
import Footer from "@/components/Footer.svelte"
|
||||
|
||||
import { Notification, Button, Text, Tabs, Space, Alert, Input, InputWrapper, NativeSelect } from '@svelteuidev/core';
|
||||
import { Check, Mix, Cube, Code, Gear, QuestionMarkCircled } from 'radix-icons-svelte';
|
||||
import { Check, Mix, Cube, Code, Gear, QuestionMarkCircled, CrossCircled } from 'radix-icons-svelte';
|
||||
|
||||
// VARIABLES
|
||||
|
||||
let available_microphones = [];
|
||||
let settings_saved = false;
|
||||
let save_button_disabled = false;
|
||||
@@ -91,7 +94,9 @@
|
||||
|
||||
<Notification title='БЕТА версия!' icon={QuestionMarkCircled} color='blue' withCloseButton={false}>
|
||||
Часть функций может работать некорректно.<br />
|
||||
Сообщайте обо всех найденных багах в <a href="https://t.me/hhsharebot" target="_blank">наш телеграм бот</a>.
|
||||
Сообщайте обо всех найденных багах в <a href="{feedback_link}" target="_blank">наш телеграм бот</a>.
|
||||
<Space h="sm" />
|
||||
<Button color="gray" radius="md" size="xs" uppercase on:click={() => {showInExplorer(log_file_path)}}>Открыть папку с логами</Button>
|
||||
</Notification>
|
||||
|
||||
<Space h="xl" />
|
||||
@@ -143,7 +148,15 @@
|
||||
<Space h="sm" />
|
||||
<Alert title="Внимание!" color="#868E96" variant="outline">
|
||||
|
||||
<Text size='sm' color="gray">Введите сюда свой ключ Picovoice.<br />Он выдается бесплатно при регистрации в <a href='https://console.picovoice.ai/' target="_blank">Picovoice Console</a>.</Text>
|
||||
<Notification title='Эта нейросеть работает не у всех!' icon={CrossCircled} color='orange' withCloseButton={false}>
|
||||
Мы ждем официального патча от разработчиков.
|
||||
</Notification>
|
||||
<Space h="sm" />
|
||||
|
||||
<Text size='sm' color="gray">
|
||||
Введите сюда свой ключ Picovoice.<br />
|
||||
Он выдается бесплатно при регистрации в <a href='https://console.picovoice.ai/' target="_blank">Picovoice Console</a>.<br>
|
||||
</Text>
|
||||
<Space h="sm" />
|
||||
<Input icon={Code} placeholder='Ключ Picovoice' variant='filled' autocomplete="off" bind:value={api_key__picovoice}/>
|
||||
|
||||
|
||||
@@ -17,3 +17,18 @@ export const assistant_voice = writable("");
|
||||
})().catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
// etc
|
||||
export let tg_official_link = "";
|
||||
export let feedback_link = "";
|
||||
export let github_repository_link = "";
|
||||
export let log_file_path = "";
|
||||
|
||||
(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);
|
||||
});
|
||||
Reference in New Issue
Block a user