ow
This commit is contained in:
parent
330515ff2c
commit
cfe55502cf
@ -13,6 +13,22 @@ namespace CloudBuilder.AI.Entity
|
||||
{
|
||||
}
|
||||
|
||||
[Column("created_datetime")]
|
||||
public DateTime CreatedDatetime { get; set; }
|
||||
[Column("sentence_index")]
|
||||
public int SentenceIndex { get; set; }
|
||||
[Column("order_index")]
|
||||
public int OrderIndex { get; set; }
|
||||
[Column("person_name")]
|
||||
public string PersonName { get; set; }
|
||||
[Column("person_mapping")]
|
||||
public string? PersonMapping { get; set; }
|
||||
[Column("created_by")]
|
||||
public string CreatedBy { get; set; }
|
||||
[Column("updated_datetime")]
|
||||
public DateTime UpdatedDatetime { get; set; }
|
||||
[Column("updated_by")]
|
||||
public string UpdatedBy { get; set; }
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column("person_id")]
|
||||
@ -21,45 +37,33 @@ namespace CloudBuilder.AI.Entity
|
||||
public int ChapterId { get; set; }
|
||||
[Column("paragraph_index")]
|
||||
public long ParagraphIndex { get; set; }
|
||||
[Column("order_index")]
|
||||
public int OrderIndex { get; set; }
|
||||
[Column("person_name")]
|
||||
public string PersonName { get; set; }
|
||||
[Column("person_mapping")]
|
||||
public string? PersonMapping { get; set; }
|
||||
[Column("created_datetime")]
|
||||
public DateTime CreatedDatetime { get; set; }
|
||||
[Column("created_by")]
|
||||
public string CreatedBy { get; set; }
|
||||
[Column("updated_datetime")]
|
||||
public DateTime UpdatedDatetime { get; set; }
|
||||
[Column("updated_by")]
|
||||
public string UpdatedBy { get; set; }
|
||||
|
||||
public const string PERSON_ID = "PersonId";
|
||||
public const string CHAPTER_ID = "ChapterId";
|
||||
public const string PARAGRAPH_INDEX = "ParagraphIndex";
|
||||
public const string CREATED_DATETIME = "CreatedDatetime";
|
||||
public const string SENTENCE_INDEX = "SentenceIndex";
|
||||
public const string ORDER_INDEX = "OrderIndex";
|
||||
public const string PERSON_NAME = "PersonName";
|
||||
public const string PERSON_MAPPING = "PersonMapping";
|
||||
public const string CREATED_DATETIME = "CreatedDatetime";
|
||||
public const string CREATED_BY = "CreatedBy";
|
||||
public const string UPDATED_DATETIME = "UpdatedDatetime";
|
||||
public const string UPDATED_BY = "UpdatedBy";
|
||||
public const string PERSON_ID = "PersonId";
|
||||
public const string CHAPTER_ID = "ChapterId";
|
||||
public const string PARAGRAPH_INDEX = "ParagraphIndex";
|
||||
|
||||
public const string DB_NAME_AI_CHAPTER_PERSON = "ai_chapter_person";
|
||||
public const string DB_NAME_FIELDS="person_id,chapter_id,paragraph_index,order_index,person_name,person_mapping,created_datetime,created_by,updated_datetime,updated_by";
|
||||
public const string DB_NAME_FIELDS="created_datetime,sentence_index,order_index,person_name,person_mapping,created_by,updated_datetime,updated_by,person_id,chapter_id,paragraph_index";
|
||||
|
||||
public const string DB_PERSON_ID = "person_id";
|
||||
public const string DB_CHAPTER_ID = "chapter_id";
|
||||
public const string DB_PARAGRAPH_INDEX = "paragraph_index";
|
||||
public const string DB_CREATED_DATETIME = "created_datetime";
|
||||
public const string DB_SENTENCE_INDEX = "sentence_index";
|
||||
public const string DB_ORDER_INDEX = "order_index";
|
||||
public const string DB_PERSON_NAME = "person_name";
|
||||
public const string DB_PERSON_MAPPING = "person_mapping";
|
||||
public const string DB_CREATED_DATETIME = "created_datetime";
|
||||
public const string DB_CREATED_BY = "created_by";
|
||||
public const string DB_UPDATED_DATETIME = "updated_datetime";
|
||||
public const string DB_UPDATED_BY = "updated_by";
|
||||
public const string DB_PERSON_ID = "person_id";
|
||||
public const string DB_CHAPTER_ID = "chapter_id";
|
||||
public const string DB_PARAGRAPH_INDEX = "paragraph_index";
|
||||
|
||||
|
||||
public static AiChapterPersonEntity GetInstance()
|
||||
@ -79,16 +83,17 @@ namespace CloudBuilder.AI.Entity
|
||||
throw new NullReferenceException("Source entity is null.");
|
||||
}
|
||||
|
||||
this.PersonId = source.PersonId;
|
||||
this.ChapterId = source.ChapterId;
|
||||
this.ParagraphIndex = source.ParagraphIndex;
|
||||
this.CreatedDatetime = source.CreatedDatetime;
|
||||
this.SentenceIndex = source.SentenceIndex;
|
||||
this.OrderIndex = source.OrderIndex;
|
||||
this.PersonName = source.PersonName;
|
||||
this.PersonMapping = source.PersonMapping;
|
||||
this.CreatedDatetime = source.CreatedDatetime;
|
||||
this.CreatedBy = source.CreatedBy;
|
||||
this.UpdatedDatetime = source.UpdatedDatetime;
|
||||
this.UpdatedBy = source.UpdatedBy;
|
||||
this.PersonId = source.PersonId;
|
||||
this.ChapterId = source.ChapterId;
|
||||
this.ParagraphIndex = source.ParagraphIndex;
|
||||
|
||||
if (includeSystemFields)
|
||||
{
|
||||
|
||||
@ -128,4 +128,85 @@ namespace CloudBuilder.AI.Policy
|
||||
[System.ComponentModel.Description("普通话(中国大陆) 小神精女(女性)-27")]
|
||||
Theresa,
|
||||
}
|
||||
|
||||
public static class ChineseTtsVoiceRandom
|
||||
{
|
||||
private static readonly Random _random = new Random();
|
||||
private static ChineseTtsVoice Default = ChineseTtsVoice.Sherpa2;
|
||||
private static ChineseTtsVoice DefaultFemale = ChineseTtsVoice.Sherpa0;
|
||||
private static ChineseTtsVoice DefaultMale = ChineseTtsVoice.Sherpa4;
|
||||
|
||||
// 所有男性列表(只定义一次)
|
||||
private static readonly List<ChineseTtsVoice> _allMales = new()
|
||||
{
|
||||
ChineseTtsVoice.Sherpa4,
|
||||
ChineseTtsVoice.Sherpa3,
|
||||
ChineseTtsVoice.Sherpa1,
|
||||
ChineseTtsVoice.Aaishe10,
|
||||
ChineseTtsVoice.Aaishe15,
|
||||
ChineseTtsVoice.Fanchen10,
|
||||
ChineseTtsVoice.Fanchen110,
|
||||
ChineseTtsVoice.Fanchen15
|
||||
};
|
||||
|
||||
// 所有女性列表
|
||||
private static readonly List<ChineseTtsVoice> _allFemales = new()
|
||||
{
|
||||
ChineseTtsVoice.Sherpa0,
|
||||
ChineseTtsVoice.Sherpa2,
|
||||
ChineseTtsVoice.Aaishe6,
|
||||
ChineseTtsVoice.Aaishe14,
|
||||
ChineseTtsVoice.Aaishe18,
|
||||
ChineseTtsVoice.Aaishe1,
|
||||
ChineseTtsVoice.Fanchen6,
|
||||
ChineseTtsVoice.Fanchen2,
|
||||
ChineseTtsVoice.Fanchen14,
|
||||
ChineseTtsVoice.Fanchen20,
|
||||
ChineseTtsVoice.Fanchen36,
|
||||
ChineseTtsVoice.Melo,
|
||||
ChineseTtsVoice.Eula,
|
||||
ChineseTtsVoice.Theresa
|
||||
};
|
||||
|
||||
// 1. 随机取任意一个
|
||||
public static ChineseTtsVoice GetRandom()
|
||||
{
|
||||
var all = Enum.GetValues(typeof(ChineseTtsVoice)).Cast<ChineseTtsVoice>().ToList();
|
||||
return all[_random.Next(all.Count)];
|
||||
}
|
||||
|
||||
// 2. 随机女性
|
||||
public static ChineseTtsVoice GetRandomFemale()
|
||||
{
|
||||
return _allFemales[_random.Next(_allFemales.Count)];
|
||||
}
|
||||
|
||||
// 3. 随机男性
|
||||
public static ChineseTtsVoice GetRandomMale()
|
||||
{
|
||||
return _allMales[_random.Next(_allMales.Count)];
|
||||
}
|
||||
|
||||
// 4. 随机男性(传入要排除的声音,通用版 ✅)
|
||||
public static ChineseTtsVoice GetRandomMaleExclude(ChineseTtsVoice excludeVoice = ChineseTtsVoice.Sherpa4)
|
||||
{
|
||||
var filtered = _allMales.Where(m => m != excludeVoice).ToList();
|
||||
return filtered[_random.Next(filtered.Count)];
|
||||
}
|
||||
|
||||
// 5. 随机女性(传入要排除的声音,通用版 ✅)
|
||||
public static ChineseTtsVoice GetRandomFemaleExclude(ChineseTtsVoice excludeVoice = ChineseTtsVoice.Sherpa0)
|
||||
{
|
||||
var filtered = _allFemales.Where(f => f != excludeVoice).ToList();
|
||||
return filtered[_random.Next(filtered.Count)];
|
||||
}
|
||||
|
||||
// 1. 随机取任意一个
|
||||
public static ChineseTtsVoice GetRandomExclude()
|
||||
{
|
||||
var all = Enum.GetValues(typeof(ChineseTtsVoice)).Cast<ChineseTtsVoice>().ToList();
|
||||
all = all.Where(f => f != DefaultFemale && f != DefaultMale).ToList();
|
||||
return all[_random.Next(all.Count)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user