Files
emall-api/FutureMailAPI/DTOs/AIDTOs.cs
2025-10-16 09:56:36 +08:00

127 lines
3.8 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace FutureMailAPI.DTOs
{
public class WritingAssistantRequestDto
{
[Required(ErrorMessage = "提示内容是必填项")]
[StringLength(1000, ErrorMessage = "提示内容长度不能超过1000个字符")]
public string Prompt { get; set; } = string.Empty;
[Required(ErrorMessage = "辅助类型是必填项")]
[EnumDataType(typeof(WritingAssistantType), ErrorMessage = "无效的辅助类型")]
public WritingAssistantType Type { get; set; }
[EnumDataType(typeof(WritingTone), ErrorMessage = "无效的语气类型")]
public WritingTone Tone { get; set; } = WritingTone.CASUAL;
[EnumDataType(typeof(WritingLength), ErrorMessage = "无效的长度类型")]
public WritingLength Length { get; set; } = WritingLength.MEDIUM;
[StringLength(500, ErrorMessage = "上下文信息长度不能超过500个字符")]
public string? Context { get; set; }
}
public class WritingAssistantResponseDto
{
public string Content { get; set; } = string.Empty;
public List<string> Suggestions { get; set; } = new();
public int EstimatedTime { get; set; } // 预计写作时间(分钟)
}
public class SentimentAnalysisRequestDto
{
[Required(ErrorMessage = "内容是必填项")]
[StringLength(2000, ErrorMessage = "内容长度不能超过2000个字符")]
public string Content { get; set; } = string.Empty;
}
public class SentimentAnalysisResponseDto
{
public SentimentType Sentiment { get; set; }
public double Confidence { get; set; } // 0-1 置信度
public List<EmotionScore> Emotions { get; set; } = new();
public List<string> Keywords { get; set; } = new();
public string Summary { get; set; } = string.Empty;
}
public class EmotionScore
{
public EmotionType Type { get; set; }
public double Score { get; set; }
}
public class FuturePredictionRequestDto
{
[Required(ErrorMessage = "预测内容是必填项")]
[StringLength(1000, ErrorMessage = "预测内容长度不能超过1000个字符")]
public string Content { get; set; } = string.Empty;
[Required(ErrorMessage = "预测类型是必填项")]
[EnumDataType(typeof(PredictionType), ErrorMessage = "无效的预测类型")]
public PredictionType Type { get; set; }
[Range(1, 365, ErrorMessage = "预测天数必须在1-365之间")]
public int DaysAhead { get; set; } = 30;
}
public class FuturePredictionResponseDto
{
public string Prediction { get; set; } = string.Empty;
public double Confidence { get; set; } // 0-1 置信度
public List<string> Factors { get; set; } = new();
public List<string> Suggestions { get; set; } = new();
}
// 枚举定义
public enum WritingAssistantType
{
OUTLINE = 0,
DRAFT = 1,
COMPLETE = 2
}
public enum WritingTone
{
FORMAL = 0,
CASUAL = 1,
EMOTIONAL = 2,
INSPIRATIONAL = 3
}
public enum WritingLength
{
SHORT = 0,
MEDIUM = 1,
LONG = 2
}
public enum SentimentType
{
POSITIVE = 0,
NEUTRAL = 1,
NEGATIVE = 2,
MIXED = 3
}
public enum EmotionType
{
HAPPY = 0,
SAD = 1,
HOPEFUL = 2,
NOSTALGIC = 3,
EXCITED = 4,
ANXIOUS = 5,
GRATEFUL = 6,
CONFUSED = 7
}
public enum PredictionType
{
CAREER = 0,
RELATIONSHIP = 1,
HEALTH = 2,
FINANCIAL = 3,
PERSONAL_GROWTH = 4
}
}