1
0

feat: Implement a modular skill system with hotword detection, streaming text output, and enhanced logging.

This commit is contained in:
2026-02-27 00:39:32 +01:00
parent 4ee4bc5457
commit a365448399
18 changed files with 451 additions and 23 deletions

View File

@@ -22,4 +22,47 @@ public static class Notifications
Console.WriteLine($"[Notifications] Failed to send notification: {ex.Message}");
}
}
public static void PlaySound(string soundPath)
{
if (string.IsNullOrWhiteSpace(soundPath)) return;
try
{
var absolutePath = soundPath;
if (!Path.IsPathRooted(absolutePath))
absolutePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, absolutePath);
if (!File.Exists(absolutePath))
{
var resourceName = "Toak." + soundPath.Replace("/", ".").Replace("\\", ".");
using var stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName);
if (stream != null)
{
absolutePath = Path.Combine(Path.GetTempPath(), "toak_" + Path.GetFileName(soundPath));
if (!File.Exists(absolutePath))
{
using var fileStream = File.Create(absolutePath);
stream.CopyTo(fileStream);
}
}
else
{
return;
}
}
var pInfo = new ProcessStartInfo
{
FileName = "paplay",
Arguments = $"\"{absolutePath}\"",
UseShellExecute = false,
CreateNoWindow = true
};
Process.Start(pInfo);
}
catch (Exception ex)
{
Console.WriteLine($"[Notifications] Failed to play sound: {ex.Message}");
}
}
}