feat: 补充部分功能
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
using Yi.Framework.Stock.Domain.Managers.Plugins;
|
||||
|
||||
using Volo.Abp.Domain.Services;
|
||||
using Yi.Framework.SqlSugarCore.Abstractions;
|
||||
using Yi.Framework.Stock.Domain.Entities;
|
||||
namespace Yi.Framework.Stock.Domain.Managers;
|
||||
|
||||
public class NewsManager
|
||||
public class NewsManager:DomainService
|
||||
{
|
||||
private SemanticKernelClient _skClient;
|
||||
|
||||
public NewsManager(SemanticKernelClient skClient)
|
||||
private ISqlSugarRepository<StockNewsAggregateRoot> _newsRepository;
|
||||
public NewsManager(SemanticKernelClient skClient,ISqlSugarRepository<StockNewsAggregateRoot> newsRepository)
|
||||
{
|
||||
_skClient = skClient;
|
||||
_newsRepository = newsRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -20,4 +23,21 @@ public class NewsManager
|
||||
_skClient.RegisterPlugins<NewsPlugins>("news");
|
||||
await _skClient.ChatCompletionAsync("帮我生成一个新闻");
|
||||
}
|
||||
|
||||
public async Task SaveNewsAsync(NewsModel news)
|
||||
{
|
||||
var newsEntity = new StockNewsAggregateRoot(
|
||||
title: news.Title,
|
||||
content: news.Content,
|
||||
source: news.Source
|
||||
)
|
||||
{
|
||||
Summary = news.Summary,
|
||||
CreationTime = DateTime.Now,
|
||||
IsDeleted = false,
|
||||
OrderNum = 0
|
||||
};
|
||||
|
||||
await _newsRepository.InsertAsync(newsEntity);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user