feat: 完善提示词

This commit is contained in:
chenchun
2025-03-11 13:40:07 +08:00
parent 4afc1cc492
commit ccaebb8ec2
5 changed files with 55 additions and 43 deletions

View File

@@ -4,6 +4,7 @@ using Yi.Framework.Stock.Domain.Entities;
using Yi.Framework.Stock.Domain.Managers.SemanticKernel;
using Yi.Framework.Stock.Domain.Managers.SemanticKernel.Plugins;
using System.Text;
using System.IO;
namespace Yi.Framework.Stock.Domain.Managers;
@@ -64,23 +65,9 @@ public class NewsManager:DomainService
newsContext.AppendLine("目前没有最近的新闻记录。");
}
var question = $$"""
基于以下最近的新闻背景,生成一条新的股市相关新闻。
{{newsContext}}
请生成一条有关联性的新闻,包含以下要素:
1. 新闻标题:吸引人且与股市、金融或经济相关
2. 新闻内容:详细且符合逻辑的报道,篇幅适中
3. 新闻简介:简明扼要的总结
4. 新闻来源:提供一个可信的媒体或机构名称
注意:
- 新闻内容应当与前面的新闻有一定关联性
- 内容应当暗示可能对股市产生某种影响(积极或消极)
- 行业焦点可以包括娱乐、科技、能源、金融等多个领域
- 只需生成一次即可
""";
var promptPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "stock", "newsPrompt.txt");
var question = await File.ReadAllTextAsync(promptPath);
question = question.Replace("{{newsContext}}", newsContext.ToString());
await _skClient.ChatCompletionAsync(question, ("NewsPlugins","save_news"));
}