142 lines
3.2 KiB
C#
142 lines
3.2 KiB
C#
namespace Service.AgentFramework;
|
||
|
||
/// <summary>
|
||
/// Agent 执行结果的标准化输出模型
|
||
/// </summary>
|
||
/// <typeparam name="T">数据类型</typeparam>
|
||
public record AgentResult<T>
|
||
{
|
||
/// <summary>
|
||
/// Agent 执行的主要数据结果
|
||
/// </summary>
|
||
public T Data { get; init; } = default!;
|
||
|
||
/// <summary>
|
||
/// 多轮提炼后的总结信息(3-5 句,包含关键指标)
|
||
/// </summary>
|
||
public string Summary { get; init; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// Agent 执行的步骤链(用于可视化和调试)
|
||
/// </summary>
|
||
public List<ExecutionStep> Steps { get; init; } = new();
|
||
|
||
/// <summary>
|
||
/// 元数据(统计信息、性能指标等)
|
||
/// </summary>
|
||
public Dictionary<string, object?> Metadata { get; init; } = new();
|
||
|
||
/// <summary>
|
||
/// 执行是否成功
|
||
/// </summary>
|
||
public bool Success { get; init; } = true;
|
||
|
||
/// <summary>
|
||
/// 错误信息(如果有的话)
|
||
/// </summary>
|
||
public string? Error { get; init; }
|
||
}
|
||
|
||
/// <summary>
|
||
/// Agent 执行步骤
|
||
/// </summary>
|
||
public record ExecutionStep
|
||
{
|
||
/// <summary>
|
||
/// 步骤名称
|
||
/// </summary>
|
||
public string Name { get; init; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 步骤描述
|
||
/// </summary>
|
||
public string Description { get; init; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 步骤状态:Pending, Running, Completed, Failed
|
||
/// </summary>
|
||
public string Status { get; init; } = "Pending";
|
||
|
||
/// <summary>
|
||
/// 执行耗时(毫秒)
|
||
/// </summary>
|
||
public long DurationMs { get; init; }
|
||
|
||
/// <summary>
|
||
/// 步骤输出数据(可选)
|
||
/// </summary>
|
||
public object? Output { get; init; }
|
||
|
||
/// <summary>
|
||
/// 错误信息(如果步骤失败)
|
||
/// </summary>
|
||
public string? Error { get; init; }
|
||
}
|
||
|
||
/// <summary>
|
||
/// 分类结果模型
|
||
/// </summary>
|
||
public record ClassificationResult
|
||
{
|
||
/// <summary>
|
||
/// 原始摘要
|
||
/// </summary>
|
||
public string Reason { get; init; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 分类名称
|
||
/// </summary>
|
||
public string Classify { get; init; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 交易类型
|
||
/// </summary>
|
||
public TransactionType Type { get; init; }
|
||
|
||
/// <summary>
|
||
/// AI 置信度评分 (0-1)
|
||
/// </summary>
|
||
public double Confidence { get; init; }
|
||
|
||
/// <summary>
|
||
/// 影响的交易记录 ID
|
||
/// </summary>
|
||
public List<long> TransactionIds { get; init; } = new();
|
||
|
||
/// <summary>
|
||
/// 参考的相似记录
|
||
/// </summary>
|
||
public List<string> References { get; init; } = new();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 账单解析结果模型
|
||
/// </summary>
|
||
public record TransactionParseResult
|
||
{
|
||
/// <summary>
|
||
/// 金额
|
||
/// </summary>
|
||
public decimal Amount { get; init; }
|
||
|
||
/// <summary>
|
||
/// 摘要
|
||
/// </summary>
|
||
public string Reason { get; init; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 日期
|
||
/// </summary>
|
||
public DateTime Date { get; init; }
|
||
|
||
/// <summary>
|
||
/// 交易类型
|
||
/// </summary>
|
||
public TransactionType Type { get; init; }
|
||
|
||
/// <summary>
|
||
/// 分类
|
||
/// </summary>
|
||
public string? Classify { get; init; }
|
||
}
|