Refactor: Reorganize project structure by moving core components into dedicated directories and introducing new configuration and API models.
This commit is contained in:
@@ -2,43 +2,10 @@ using System.Net.Http.Headers;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Toak;
|
||||
using Toak.Api.Models;
|
||||
using Toak.Serialization;
|
||||
|
||||
public class WhisperResponse
|
||||
{
|
||||
[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();
|
||||
}
|
||||
namespace Toak.Api;
|
||||
|
||||
public class GroqApiClient
|
||||
{
|
||||
33
Api/Models/LlamaModels.cs
Normal file
33
Api/Models/LlamaModels.cs
Normal 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();
|
||||
}
|
||||
9
Api/Models/WhisperResponse.cs
Normal file
9
Api/Models/WhisperResponse.cs
Normal 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;
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Toak;
|
||||
using Toak.Core;
|
||||
using Toak.IO;
|
||||
|
||||
namespace Toak.Audio;
|
||||
|
||||
public static class AudioRecorder
|
||||
{
|
||||
@@ -1,23 +1,9 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Toak;
|
||||
|
||||
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";
|
||||
}
|
||||
using Toak.Serialization;
|
||||
|
||||
namespace Toak.Configuration;
|
||||
public static class ConfigManager
|
||||
{
|
||||
private static readonly string ConfigDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config", "toak");
|
||||
16
Configuration/ToakConfig.cs
Normal file
16
Configuration/ToakConfig.cs
Normal 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";
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Text;
|
||||
|
||||
namespace Toak;
|
||||
using Toak.Configuration;
|
||||
|
||||
namespace Toak.Core;
|
||||
|
||||
public static class PromptBuilder
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Toak;
|
||||
namespace Toak.Core;
|
||||
|
||||
public static class StateTracker
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Toak;
|
||||
namespace Toak.IO;
|
||||
|
||||
public static class ClipboardManager
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Toak;
|
||||
namespace Toak.IO;
|
||||
|
||||
public static class Notifications
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Toak;
|
||||
namespace Toak.IO;
|
||||
|
||||
public static class TextInjector
|
||||
{
|
||||
@@ -1,5 +1,9 @@
|
||||
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 copyToClipboard = args.Contains("--copy");
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Toak;
|
||||
using Toak.Configuration;
|
||||
using Toak.Api.Models;
|
||||
|
||||
namespace Toak.Serialization;
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
[JsonSerializable(typeof(ToakConfig))]
|
||||
Reference in New Issue
Block a user