1
0

Refactor: Reorganize project structure by moving core components into dedicated directories and introducing new configuration and API models.

This commit is contained in:
2026-02-26 21:51:36 +01:00
parent fbff8c98ff
commit d60730c4bf
13 changed files with 83 additions and 60 deletions

View File

@@ -2,43 +2,10 @@ using System.Net.Http.Headers;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Toak; using Toak.Api.Models;
using Toak.Serialization;
public class WhisperResponse namespace Toak.Api;
{
[JsonPropertyName("text")]
public string Text { get; set; } = string.Empty;
}
public class LlamaRequestMessage
{
[JsonPropertyName("role")]
public string Role { get; set; } = string.Empty;
[JsonPropertyName("content")]
public string Content { get; set; } = string.Empty;
}
public class LlamaRequest
{
[JsonPropertyName("model")]
public string Model { get; set; } = "llama-3.1-8b-instant";
[JsonPropertyName("messages")]
public LlamaRequestMessage[] Messages { get; set; } = Array.Empty<LlamaRequestMessage>();
[JsonPropertyName("temperature")]
public double Temperature { get; set; } = 0.0;
}
public class LlamaResponse
{
[JsonPropertyName("choices")]
public LlamaChoice[] Choices { get; set; } = Array.Empty<LlamaChoice>();
}
public class LlamaChoice
{
[JsonPropertyName("message")]
public LlamaRequestMessage Message { get; set; } = new();
}
public class GroqApiClient public class GroqApiClient
{ {

33
Api/Models/LlamaModels.cs Normal file
View File

@@ -0,0 +1,33 @@
using System.Text.Json.Serialization;
namespace Toak.Api.Models;
public class LlamaRequestMessage
{
[JsonPropertyName("role")]
public string Role { get; set; } = string.Empty;
[JsonPropertyName("content")]
public string Content { get; set; } = string.Empty;
}
public class LlamaRequest
{
[JsonPropertyName("model")]
public string Model { get; set; } = "llama-3.1-8b-instant";
[JsonPropertyName("messages")]
public LlamaRequestMessage[] Messages { get; set; } = Array.Empty<LlamaRequestMessage>();
[JsonPropertyName("temperature")]
public double Temperature { get; set; } = 0.0;
}
public class LlamaResponse
{
[JsonPropertyName("choices")]
public LlamaChoice[] Choices { get; set; } = Array.Empty<LlamaChoice>();
}
public class LlamaChoice
{
[JsonPropertyName("message")]
public LlamaRequestMessage Message { get; set; } = new();
}

View File

@@ -0,0 +1,9 @@
using System.Text.Json.Serialization;
namespace Toak.Api.Models;
public class WhisperResponse
{
[JsonPropertyName("text")]
public string Text { get; set; } = string.Empty;
}

View File

@@ -1,6 +1,9 @@
using System.Diagnostics; using System.Diagnostics;
namespace Toak; using Toak.Core;
using Toak.IO;
namespace Toak.Audio;
public static class AudioRecorder public static class AudioRecorder
{ {

View File

@@ -1,23 +1,9 @@
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Toak; using Toak.Serialization;
public class ToakConfig
{
public string GroqApiKey { get; set; } = string.Empty;
public string TypingBackend { get; set; } = "xdotool"; // wtype or xdotool
public bool ModulePunctuation { get; set; } = true;
public bool ModuleTechnicalSanitization { get; set; } = true;
public string StyleMode { get; set; } = "Professional";
public bool StructureBulletPoints { get; set; } = false;
public bool StructureSmartParagraphing { get; set; } = true;
public string WhisperLanguage { get; set; } = string.Empty;
public string LlmModel { get; set; } = "openai/gpt-oss-20b";
public string WhisperModel { get; set; } = "whisper-large-v3-turbo";
}
namespace Toak.Configuration;
public static class ConfigManager public static class ConfigManager
{ {
private static readonly string ConfigDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config", "toak"); private static readonly string ConfigDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config", "toak");

View File

@@ -0,0 +1,16 @@
namespace Toak.Configuration;
public class ToakConfig
{
public string GroqApiKey { get; set; } = string.Empty;
public string TypingBackend { get; set; } = "xdotool"; // wtype or xdotool
public bool ModulePunctuation { get; set; } = true;
public bool ModuleTechnicalSanitization { get; set; } = true;
public string StyleMode { get; set; } = "Professional";
public bool StructureBulletPoints { get; set; } = false;
public bool StructureSmartParagraphing { get; set; } = true;
public string WhisperLanguage { get; set; } = string.Empty;
public string LlmModel { get; set; } = "openai/gpt-oss-20b";
public string WhisperModel { get; set; } = "whisper-large-v3-turbo";
}

View File

@@ -1,6 +1,8 @@
using System.Text; using System.Text;
namespace Toak; using Toak.Configuration;
namespace Toak.Core;
public static class PromptBuilder public static class PromptBuilder
{ {

View File

@@ -1,4 +1,4 @@
namespace Toak; namespace Toak.Core;
public static class StateTracker public static class StateTracker
{ {

View File

@@ -1,6 +1,6 @@
using System.Diagnostics; using System.Diagnostics;
namespace Toak; namespace Toak.IO;
public static class ClipboardManager public static class ClipboardManager
{ {

View File

@@ -1,6 +1,6 @@
using System.Diagnostics; using System.Diagnostics;
namespace Toak; namespace Toak.IO;
public static class Notifications public static class Notifications
{ {

View File

@@ -1,6 +1,6 @@
using System.Diagnostics; using System.Diagnostics;
namespace Toak; namespace Toak.IO;
public static class TextInjector public static class TextInjector
{ {

View File

@@ -1,5 +1,9 @@
using System.Diagnostics; using System.Diagnostics;
using Toak; using Toak.Audio;
using Toak.Configuration;
using Toak.Api;
using Toak.Core;
using Toak.IO;
bool pipeToStdout = args.Contains("--pipe") || args.Contains("-p") || Console.IsOutputRedirected; bool pipeToStdout = args.Contains("--pipe") || args.Contains("-p") || Console.IsOutputRedirected;
bool copyToClipboard = args.Contains("--copy"); bool copyToClipboard = args.Contains("--copy");

View File

@@ -1,6 +1,9 @@
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Toak; using Toak.Configuration;
using Toak.Api.Models;
namespace Toak.Serialization;
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] [JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
[JsonSerializable(typeof(ToakConfig))] [JsonSerializable(typeof(ToakConfig))]