Files
Yi.Framework/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain/Managers/AiMessageManager.cs
2025-06-21 13:02:38 +08:00

30 lines
965 B
C#

using Volo.Abp.Domain.Services;
using Volo.Abp.Users;
using Yi.Framework.AiHub.Application.Contracts.Dtos;
using Yi.Framework.AiHub.Domain.Entities;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.AiHub.Domain.Managers;
public class AiMessageManager : DomainService
{
private readonly ISqlSugarRepository<MessageAggregateRoot> _repository;
public AiMessageManager(ISqlSugarRepository<MessageAggregateRoot> repository)
{
_repository = repository;
}
/// <summary>
/// 创建消息
/// </summary>
/// <param name="sessionId"></param>
/// <param name="userId"></param>
/// <param name="input"></param>
/// <returns></returns>
public async Task CreateMessageAsync(Guid userId, Guid sessionId, MessageInputDto input)
{
var message = new MessageAggregateRoot(userId, sessionId, input.Content, input.Role, input.ModelId);
await _repository.InsertAsync(message);
}
}