You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
using AI.Interface;
|
|
|
|
|
|
using Microsoft.SemanticKernel;
|
|
|
|
|
|
|
|
|
|
|
|
namespace AI.Plugin
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 表单请求插件:AI 需要用户填写参数时调用此插件,在聊天中插入对应表单。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class FormRequestPlugin(IFormRequestNotifier notifier)
|
|
|
|
|
|
{
|
|
|
|
|
|
private readonly IFormRequestNotifier _notifier = notifier;
|
|
|
|
|
|
|
|
|
|
|
|
[KernelFunction]
|
|
|
|
|
|
[Description("当需要用户填写表单(如文件路径、参数等)时调用。调用后界面会自动弹出表单供用户填写。")]
|
|
|
|
|
|
[return: Description("通知结果,告知表单是否已发送给用户")]
|
|
|
|
|
|
public string ShowForm(
|
|
|
|
|
|
[Description("表单 ID。可选值:gridding-load-xyz(散点文件加载卡片,自动完成文件选择、数据预览和列头匹配);gridding-parameters(网格化参数设置卡片,自动加载参数,用户确认后点击生成完成成图)")]
|
|
|
|
|
|
string formId)
|
|
|
|
|
|
{
|
|
|
|
|
|
_notifier.RequestForm(formId);
|
|
|
|
|
|
return $"已向用户展示表单,等待用户填写并提交。";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|