feat: 补充部分功能
This commit is contained in:
@@ -1,19 +1,27 @@
|
||||
using System.ComponentModel;
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.SemanticKernel;
|
||||
using Yi.Framework.Stock.Domain.Managers;
|
||||
|
||||
namespace Yi.Framework.Stock.Domain.Managers.Plugins;
|
||||
|
||||
public class NewsPlugins
|
||||
{
|
||||
[KernelFunction("save_news"), Description("生成并且保存一个新闻")]
|
||||
public async Task<string> SaveAsync(NewModel news)
|
||||
private readonly NewsManager _newsManager;
|
||||
|
||||
public NewsPlugins(NewsManager newsManager)
|
||||
{
|
||||
return "成功";
|
||||
_newsManager = newsManager;
|
||||
}
|
||||
|
||||
[KernelFunction("save_news"), Description("生成并且保存一个新闻")]
|
||||
public async Task SaveAsync(NewsModel news)
|
||||
{
|
||||
await _newsManager.SaveNewsAsync(news);
|
||||
}
|
||||
}
|
||||
|
||||
public class NewModel
|
||||
public class NewsModel
|
||||
{
|
||||
[JsonPropertyName("title")]
|
||||
[DisplayName("新闻标题")]
|
||||
@@ -22,4 +30,14 @@ public class NewModel
|
||||
[JsonPropertyName("content")]
|
||||
[DisplayName("新闻内容")]
|
||||
public string? Content { get; set; }
|
||||
|
||||
//新闻简介
|
||||
[JsonPropertyName("summary")]
|
||||
[DisplayName("新闻简介")]
|
||||
public string? Summary { get; set; }
|
||||
|
||||
//新闻来源
|
||||
[JsonPropertyName("source")]
|
||||
[DisplayName("新闻来源")]
|
||||
public string? Source { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user