修改实体类

This commit is contained in:
zpc 2024-07-14 15:16:40 +08:00
parent 2268c115e3
commit f82e97b4ef
5 changed files with 74 additions and 51 deletions

View File

@ -51,6 +51,7 @@ namespace HuanMeng.MiaoYu.Code.Cache.Special
{
characterCaches.Remove(characterCache);
});
return characterCaches;
}
}

View File

@ -34,17 +34,17 @@ namespace HuanMeng.MiaoYu.Code.Chat
{
//var charactersList = MiaoYuCache.CharactersList;
//List<T_Character> list = _characterCache.GetCharacterFromCache(characterId);
var chatsToDelete = await Dao.daoDbMiaoYu.context.T_Chat.Where(t => id.Contains(t.Id)).ToListAsync();
if (chatsToDelete.Count <= 0)
{
throw new Exception("");
}
var chatList = chatsToDelete.Where(t => t.UserId == _UserId && t.CharacterId == characterId && t.IsDel == false).ToList();
if (chatList.Count > 0)
{
chatList.ForEach(t => t.IsDel = true);
}
Dao.daoDbMiaoYu.context.SaveChanges();
//var chatsToDelete = await Dao.daoDbMiaoYu.context.T_Chat.Where(t => id.Contains(t.Id)).ToListAsync();
//if (chatsToDelete.Count <= 0)
//{
// throw new Exception("");
//}
//var chatList = chatsToDelete.Where(t => t.UserId == _UserId && t.CharacterId == characterId && t.Type == 0).ToList();
//if (chatList.Count > 0)
//{
// chatList.ForEach(t => t.Type = 2);
//}
//Dao.daoDbMiaoYu.context.SaveChanges();
return true;
}
@ -55,12 +55,12 @@ namespace HuanMeng.MiaoYu.Code.Chat
/// <returns></returns>
public async Task<bool> DelChat(int characterId)
{
var tempList = await Dao.daoDbMiaoYu.context.T_Chat.Where(t => t.UserId == _UserId && t.CharacterId == characterId && t.IsDel == false).ToListAsync();
if (tempList.Count > 0)
{
tempList.ForEach(t => t.IsDel = true);
}
Dao.daoDbMiaoYu.context.SaveChanges();
//var tempList = await Dao.daoDbMiaoYu.context.T_Chat.Where(t => t.UserId == _UserId && t.CharacterId == characterId && t.IsDel == false).ToListAsync();
//if (tempList.Count > 0)
//{
// tempList.ForEach(t => t.IsDel = true);
//}
//Dao.daoDbMiaoYu.context.SaveChanges();
return true;
}
}

View File

@ -252,28 +252,33 @@ public partial class MiaoYuContext : MultiTenantDbContext//DbContext
.ValueGeneratedNever()
.HasComment("聊天id");
entity.Property(e => e.CharacterId).HasComment("人物表Id");
entity.Property(e => e.ClaudeId)
.HasMaxLength(100)
.HasComment("聊天返回的Id");
entity.Property(e => e.ClaudeModel)
.HasMaxLength(50)
.HasComment("人物模型,聊天返回的模型");
entity.Property(e => e.ClaudeType)
.HasMaxLength(20)
.HasComment("聊天返回的消息的类型");
entity.Property(e => e.Content)
.HasMaxLength(255)
.HasMaxLength(1000)
.HasComment("消息内容");
entity.Property(e => e.CreateDay).HasComment("发送日期");
entity.Property(e => e.CreateTime)
.HasComment("创建时间")
.HasColumnType("datetime");
entity.Property(e => e.Input_tokens).HasComment("输入token");
entity.Property(e => e.IsDel).HasComment("是否假删除0否1是");
entity.Property(e => e.Model)
.HasMaxLength(255)
.IsUnicode(false)
.HasComment("人物模型");
entity.Property(e => e.Output_tokens).HasComment("输出token");
entity.Property(e => e.Role)
.HasMaxLength(50)
.IsUnicode(false)
.HasComment("user/assistant");
entity.Property(e => e.SendDateDay).HasComment("发送消息,天");
entity.Property(e => e.SendMessageDay).HasComment("发送消息时间戳");
entity.Property(e => e.TenantId).HasComment("租户id");
entity.Property(e => e.TimeStamp)
.HasComment("发送时间")
.HasColumnType("datetime");
entity.Property(e => e.Type).HasComment("0正常1重新生成2 删除");
entity.Property(e => e.UpdateTime)
.HasComment("更新时间")
.HasColumnType("datetime");
@ -365,7 +370,7 @@ public partial class MiaoYuContext : MultiTenantDbContext//DbContext
modelBuilder.Entity<T_User_Char>(entity =>
{
entity.Property(e => e.CharacterId).HasComment("角色Id");
entity.Property(e => e.CreateDateTime)
entity.Property(e => e.CreateAt)
.HasComment("创建时间")
.HasColumnType("datetime");
entity.Property(e => e.IsEnable).HasComment("是否启用");
@ -375,7 +380,7 @@ public partial class MiaoYuContext : MultiTenantDbContext//DbContext
.HasMaxLength(50)
.HasComment("会话名称");
entity.Property(e => e.TenantId).HasComment("租户");
entity.Property(e => e.UpdateDateTime)
entity.Property(e => e.UpdateAt)
.HasComment("修改时间")
.HasColumnType("datetime");
entity.Property(e => e.UserId).HasComment("用户Id");

View File

@ -16,7 +16,7 @@ public partial class T_Chat: MultiTenantEntity
/// <summary>
/// 聊天内容
/// </summary>
public int? UserId { get; set; }
public int UserId { get; set; }
/// <summary>
/// 消息内容
@ -26,22 +26,22 @@ public partial class T_Chat: MultiTenantEntity
/// <summary>
/// 发送时间
/// </summary>
public DateTime? TimeStamp { get; set; }
public DateTime TimeStamp { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateTime { get; set; }
public DateTime CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime? UpdateTime { get; set; }
public DateTime UpdateTime { get; set; }
/// <summary>
/// 输入token
/// </summary>
public int? Input_tokens { get; set; }
public int Input_tokens { get; set; }
/// <summary>
/// 输出token
@ -51,25 +51,42 @@ public partial class T_Chat: MultiTenantEntity
/// <summary>
/// 人物表Id
/// </summary>
public int? CharacterId { get; set; }
public int CharacterId { get; set; }
/// <summary>
/// user/assistant
/// </summary>
public string Role { get; set; } = null!;
/// <summary>
/// 发送日期
/// </summary>
public DateOnly? CreateDay { get; set; }
public Guid SessionId { get; set; }
/// <summary>
/// 是否假删除0否1是
/// 发送消息,天
/// </summary>
public bool IsDel { get; set; }
public long SendDateDay { get; set; }
/// <summary>
/// 人物模型
/// 发送消息时间戳
/// </summary>
public string Model { get; set; } = null!;
public long SendMessageDay { get; set; }
/// <summary>
/// 0正常1重新生成2 删除
/// </summary>
public int Type { get; set; }
/// <summary>
/// 聊天返回的消息的类型
/// </summary>
public string? ClaudeType { get; set; }
/// <summary>
/// 聊天返回的Id
/// </summary>
public string? ClaudeId { get; set; }
/// <summary>
/// 人物模型,聊天返回的模型
/// </summary>
public string? ClaudeModel { get; set; }
}

View File

@ -26,16 +26,6 @@ public partial class T_User_Char: MultiTenantEntity
/// </summary>
public int ModelConfigId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateDateTime { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime UpdateDateTime { get; set; }
/// <summary>
/// 是否启用
/// </summary>
@ -46,4 +36,14 @@ public partial class T_User_Char: MultiTenantEntity
/// 用户Id
/// </summary>
public int UserId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateAt { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime UpdateAt { get; set; }
}