using Microsoft.Extensions.AI;

namespace DFS.AI.API.Helper
{
    /// <summary>
    /// 模型返回
    /// </summary>
    public class ChatModelResponse
    {
        /// <summary>
        /// 模型名称
        /// </summary>
        public string Model { get; set; }

        /// <summary>
        /// 模型的token 
        /// </summary>
        public long Token { get; set; }

        /// <summary>
        /// 模型返回
        /// </summary>
        public string Text { get; set; }

        
    }


    /// <summary>
    /// 转化模型的结果集
    /// </summary>
    public static class ChartReponseExtension {
        public static ChatModelResponse ToModel(this ChatResponse response)
        {
            return new ChatModelResponse() { 
                Text = response.Text,
                Model= response.ModelId,
                Token= response.Usage?.TotalTokenCount ?? 0,
            };
        }
    }
}
