-
-
Notifications
You must be signed in to change notification settings - Fork 647
Expand file tree
/
Copy pathConversationSetting.cs
More file actions
82 lines (72 loc) · 3.22 KB
/
Copy pathConversationSetting.cs
File metadata and controls
82 lines (72 loc) · 3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
namespace BotSharp.Abstraction.Conversations.Settings;
public class ConversationSetting
{
public string DataDir { get; set; } = "conversations";
public string ChatCompletion { get; set; }
public bool EnableKnowledgeBase { get; set; }
public bool ShowVerboseLog { get; set; }
public int MaxRecursiveDepth { get; set; } = 3;
public bool EnableLlmCompletionLog { get; set; }
public bool EnableExecutionLog { get; set; }
public bool EnableContentLog { get; set; }
public bool EnableStateLog { get; set; }
public bool EnableTranslationMemory { get; set; }
public CleanConversationSetting CleanSetting { get; set; } = new();
public RateLimitSetting RateLimit { get; set; } = new();
public FileSelectSetting? FileSelect { get; set; }
public AutoCompressionSetting AutoCompression { get; set; } = new();
}
/// <summary>
/// Automatically compress a long conversation once its uncompressed message count grows large,
/// keeping recent turns verbatim and replacing older turns with a generated summary.
/// </summary>
public class AutoCompressionSetting
{
/// <summary>
/// Enable the context layer: summarize old turns and set a breakpoint so the LLM sees
/// [summary] + recent turns. Fully reversible, no stored data is removed.
/// </summary>
public bool Enabled { get; set; } = false;
/// <summary>
/// Enable the storage layer: physically archive old raw dialogs out of the hot dialog record
/// and replace them with a single summary dialog. Requires <see cref="Enabled"/>.
/// </summary>
public bool CompactStorage { get; set; } = false;
/// <summary>
/// Compress when (DialogCount - CompactedDialogCount) reaches this many messages.
/// </summary>
public int TriggerMessageCount { get; set; } = 500;
/// <summary>
/// Number of most recent messages always kept verbatim (never summarized).
/// </summary>
public int KeepRecentCount { get; set; } = 100;
/// <summary>
/// Agent that owns the summary template and whose LLM config (provider, model, max output tokens,
/// reasoning level, response format) is used to generate the summary.
/// When not set, the conversation's own agent is used.
/// </summary>
public string SummaryAgentId { get; set; } = string.Empty;
/// <summary>
/// Template used to generate the compression summary.
/// </summary>
public string SummaryTemplateName { get; set; } = "conversation.compression";
/// <summary>
/// Staleness guard for the persisted compressing flag: if a compaction has been marked in progress
/// for longer than this (e.g. the process crashed mid-run), the next request is allowed to take over.
/// </summary>
public int CompressionTimeoutSeconds { get; set; } = 300;
}
public class CleanConversationSetting
{
public bool Enable { get; set; }
public int BatchSize { get; set; }
public int MessageLimit { get; set; }
public int BufferHours { get; set; }
public int LogRetentionDays { get; set; }
public int LogBatchSize { get; set; } = 2000;
public IEnumerable<string> ExcludeAgentIds { get; set; } = new List<string>();
}
public class FileSelectSetting : LlmConfigBase
{
public int? MessageLimit { get; set; }
}