♻️ Refactored the think message part

This commit is contained in:
2025-11-15 16:21:26 +08:00
parent b5f9faa724
commit 80ea44f2cc
8 changed files with 197 additions and 127 deletions

View File

@@ -8,7 +8,7 @@ public class SnThinkingSequence : ModelBase
{
public Guid Id { get; set; } = Guid.NewGuid();
[MaxLength(4096)] public string? Topic { get; set; }
public long TotalToken { get; set; }
public long PaidToken { get; set; }
@@ -21,33 +21,48 @@ public enum ThinkingThoughtRole
User
}
public enum StreamingContentType
public enum ThinkingMessagePartType
{
Text,
Reasoning,
FunctionCall,
Unknown
FunctionResult
}
public class SnThinkingChunk
public class SnThinkingMessagePart
{
public StreamingContentType Type { get; set; }
public Dictionary<string, object>? Data { get; set; } = new();
public ThinkingMessagePartType Type { get; set; }
public string? Text { get; set; }
public SnFunctionCall? FunctionCall { get; set; }
public SnFunctionResult? FunctionResult { get; set; }
}
public class SnFunctionCall
{
public string Id { get; set; } = null!;
public string Name { get; set; } = null!;
public string Arguments { get; set; } = null!;
}
public class SnFunctionResult
{
public string CallId { get; set; } = null!;
public object Result { get; set; } = null!;
public bool IsError { get; set; }
}
public class SnThinkingThought : ModelBase
{
public Guid Id { get; set; } = Guid.NewGuid();
public string? Content { get; set; }
[Column(TypeName = "jsonb")] public List<SnCloudFileReferenceObject> Files { get; set; } = [];
[Column(TypeName = "jsonb")] public List<SnThinkingChunk> Chunks { get; set; } = [];
[Column(TypeName = "jsonb")] public List<SnThinkingMessagePart> Parts { get; set; } = [];
public ThinkingThoughtRole Role { get; set; }
public long TokenCount { get; set; }
[MaxLength(4096)] public string? ModelName { get; set; }
public Guid SequenceId { get; set; }
[JsonIgnore] public SnThinkingSequence Sequence { get; set; } = null!;
}