← Back to Files
AppConfig.cs
namespace KaiChat.Models;
public class KaiChatConfig
{
public string ApiEndpoint { get; set; } = "https://api.openai.com/v1/chat/completions";
public string ApiKey { get; set; } = "";
public string Model { get; set; } = "gpt-4";
public ModelLimitsConfig ModelLimits { get; set; } = new();
public int MaxCompletionTokens { get; set; } = 0;
public string AppVersion { get; set; } = "";
public string BaseFolder { get; set; } = "";
public List<string> SystemPromptFiles { get; set; } = new();
public string ConversationsFolder { get; set; } = "Conversations";
public bool TestMode { get; set; } = false;
public CompactionConfig Compaction { get; set; } = new();
public NightscoutConfig Nightscout { get; set; } = new();
public int GetModelInputTokenLimit()
{
return ModelLimits?.InputTokens > 0 ? ModelLimits.InputTokens : 1_000_000;
}
public int GetModelOutputTokenLimit()
{
return ModelLimits?.OutputTokens > 0 ? ModelLimits.OutputTokens : 384_000;
}
public int GetDefaultCompletionTokenLimit()
{
return MaxCompletionTokens > 0 ? MaxCompletionTokens : GetModelOutputTokenLimit();
}
}
public class ModelLimitsConfig
{
public int InputTokens { get; set; } = 1_000_000;
public int OutputTokens { get; set; } = 384_000;
}
public class CompactionConfig
{
public bool Enabled { get; set; } = true;
public int ContextTokenLimit { get; set; } = 0;
public int TriggerTokens { get; set; } = 0;
public int TriggerPercent { get; set; } = 75;
public int RecentContextTargetTokens { get; set; } = 0;
public int RecentContextPercent { get; set; } = 20;
public int MinRecentMessages { get; set; } = 30;
public int ChunkTokenLimit { get; set; } = 0;
public int MergeBatchTokenLimit { get; set; } = 0;
public int SummaryMaxTokens { get; set; } = 0;
public int MaxArchiveTitleLength { get; set; } = 80;
}
public class NightscoutConfig
{
public bool Enabled { get; set; } = false;
public string BaseUrl { get; set; } = "";
public string ApiSecret { get; set; } = "";
public string DisplayUnits { get; set; } = "mmol/L";
public bool AttachLocalReadingsToMessages { get; set; } = true;
public string BridgeHost { get; set; } = "127.0.0.1";
public int BridgePort { get; set; } = 30283;
public int BridgeReadingCount { get; set; } = 10;
public int BridgeTimeoutMs { get; set; } = 2500;
}