feat(openai): 新增意图相关接口

This commit is contained in:
Fu Diwei 2021-10-08 18:39:11 +08:00
parent 03d49a0012
commit 75bb97f2f3
41 changed files with 2200 additions and 0 deletions

View File

@ -0,0 +1,209 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Flurl;
using Flurl.Http;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI
{
public static class WechatOpenAIClientExecuteIntentExtensions
{
/// <summary>
/// <para>异步调用 [POST] /v2/intent/save 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v2/intent/batch_save.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.IntentSaveResponse> ExecuteIntentSaveAsync(this WechatOpenAIClient client, Models.IntentSaveRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "v2", "intent", "save");
return await client.SendRequestWithJsonAsync<Models.IntentSaveResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /v2/intent/search 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v2/intent/search .html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.IntentSearchResponse> ExecuteIntentSearchAsync(this WechatOpenAIClient client, Models.IntentSearchRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "v2", "intent", "search");
return await client.SendRequestWithJsonAsync<Models.IntentSearchResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /v2/intent/get_detail 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v2/intent/get_detail .html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.IntentGetDetailResponse> ExecuteIntentGetDetailAsync(this WechatOpenAIClient client, Models.IntentGetDetailRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "v2", "intent", "get_detail");
return await client.SendRequestWithJsonAsync<Models.IntentGetDetailResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /v2/intent/name_exist 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v2/intent/name_exist .html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.IntentNameExistResponse> ExecuteIntentNameExistAsync(this WechatOpenAIClient client, Models.IntentNameExistRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "v2", "intent", "name_exist");
return await client.SendRequestWithJsonAsync<Models.IntentNameExistResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /v2/intent/delete 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v2/intent/batch_delete.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.IntentDeleteResponse> ExecuteIntentDeleteAsync(this WechatOpenAIClient client, Models.IntentDeleteRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "v2", "intent", "delete");
return await client.SendRequestWithJsonAsync<Models.IntentDeleteResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /v1/intent/switch/batch 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v2/intent/batch_delete.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.IntentSwitchBatchResponse> ExecuteIntentSwitchBatchAsync(this WechatOpenAIClient client, Models.IntentSwitchBatchRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "v1", "intent", "switch", "batch");
return await client.SendRequestWithJsonAsync<Models.IntentSwitchBatchResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#region Config
/// <summary>
/// <para>异步调用 [POST] /v2/intent/config/save 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v2/intent/save_config.html </para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v2/intent/save_config_normal_answer_config.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.IntentConfigSaveResponse> ExecuteIntentConfigSaveAsync(this WechatOpenAIClient client, Models.IntentConfigSaveRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "v2", "intent", "config", "save");
return await client.SendRequestWithJsonAsync<Models.IntentConfigSaveResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /v2/intent/config/get 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v2/intent/get_config.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.IntentConfigGetResponse> ExecuteIntentConfigGetAsync(this WechatOpenAIClient client, Models.IntentConfigGetRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "v2", "intent", "config", "get");
return await client.SendRequestWithJsonAsync<Models.IntentConfigGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#region Question
/// <summary>
/// <para>异步调用 [POST] /v2/intent/question/save 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v2/intent/batch_save_question.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.IntentQuestionSaveResponse> ExecuteIntentQuestionSaveAsync(this WechatOpenAIClient client, Models.IntentQuestionSaveRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "v2", "intent", "question", "save");
return await client.SendRequestWithJsonAsync<Models.IntentQuestionSaveResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /v2/intent/question/delete 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/openapi/api/v2/intent/batch_delete_question.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.IntentQuestionDeleteResponse> ExecuteIntentQuestionDeleteAsync(this WechatOpenAIClient client, Models.IntentQuestionDeleteRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "v2", "intent", "question", "delete");
return await client.SendRequestWithJsonAsync<Models.IntentQuestionDeleteResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/intent/config/get 接口的请求。</para>
/// </summary>
public class IntentConfigGetRequest : WechatOpenAIRequest
{
/// <summary>
/// 获取或设置意图 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("intent_id")]
[System.Text.Json.Serialization.JsonPropertyName("intent_id")]
public long IntentId { get; set; }
/// <summary>
/// 获取或设置技能 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("skill_id")]
[System.Text.Json.Serialization.JsonPropertyName("skill_id")]
public long SkillId { get; set; }
}
}

View File

@ -0,0 +1,447 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/intent/config/get 接口的响应。</para>
/// </summary>
public class IntentConfigGetResponse : WechatOpenAIResponse<IntentConfigGetResponse.Types.Data>
{
public static class Types
{
public class Data
{
public static class Types
{
public class Slot
{
/// <summary>
/// 获取或设置语义槽名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string Name { get; set; } = default!;
/// <summary>
/// 获取或设置词典名称列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("dicts")]
[System.Text.Json.Serialization.JsonPropertyName("dicts")]
public string[] DictionaryNameList { get; set; } = default!;
/// <summary>
/// 获取或设置是否追问。
/// </summary>
[Newtonsoft.Json.JsonProperty("keep_ask")]
[System.Text.Json.Serialization.JsonPropertyName("keep_ask")]
public bool IsKeepAsk { get; set; }
/// <summary>
/// 获取或设置追问话术列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("ask_content")]
[System.Text.Json.Serialization.JsonPropertyName("ask_content")]
public string[]? AskContentList { get; set; } = default!;
}
public class Previous
{
/// <summary>
/// 获取或设置意图名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("intent")]
[System.Text.Json.Serialization.JsonPropertyName("intent")]
public string IntentName { get; set; } = default!;
/// <summary>
/// 获取或设置技能名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("skill")]
[System.Text.Json.Serialization.JsonPropertyName("skill")]
public string SkillName { get; set; } = default!;
}
public class Next : Previous
{
}
public class NormalAnswerConfig
{
public static class Types
{
public class Answer
{
/// <summary>
/// 获取或设置类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("type")]
[System.Text.Json.Serialization.JsonPropertyName("type")]
public int Type { get; set; }
/// <summary>
/// 获取或设置回答内容。
/// </summary>
[Newtonsoft.Json.JsonProperty("content")]
[System.Text.Json.Serialization.JsonPropertyName("content")]
public object Content { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置是否合并。
/// </summary>
[Newtonsoft.Json.JsonProperty("merge_answer")]
[System.Text.Json.Serialization.JsonPropertyName("merge_answer")]
public bool RequireMergeAnswer { get; set; }
/// <summary>
/// 获取或设置回答列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("answer")]
[System.Text.Json.Serialization.JsonPropertyName("answer")]
public Types.Answer[] AnswerList { get; set; } = default!;
}
public class ApiAnswerConfig
{
public static class Types
{
public class Argument
{
public static class Types
{
public class Item
{
/// <summary>
/// 获取或设置参数名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string Name { get; set; } = default!;
/// <summary>
/// 获取或设置是否必填。
/// </summary>
[Newtonsoft.Json.JsonProperty("input")]
[System.Text.Json.Serialization.JsonPropertyName("input")]
public bool IsRequired { get; set; }
/// <summary>
/// 获取或设置参数含义。
/// </summary>
[Newtonsoft.Json.JsonProperty("desc")]
[System.Text.Json.Serialization.JsonPropertyName("desc")]
public string Description { get; set; } = default!;
/// <summary>
/// 获取或设置对应语义槽。
/// </summary>
[Newtonsoft.Json.JsonProperty("slot")]
[System.Text.Json.Serialization.JsonPropertyName("slot")]
public string Slot { get; set; } = default!;
/// <summary>
/// 获取或设置默认值。
/// </summary>
[Newtonsoft.Json.JsonProperty("default_value")]
[System.Text.Json.Serialization.JsonPropertyName("default_value")]
public string DefaultValue { get; set; } = default!;
/// <summary>
/// 获取或设置追问话术列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("ask_content")]
[System.Text.Json.Serialization.JsonPropertyName("ask_content")]
public string[]? AskContentList { get; set; }
}
}
/// <summary>
/// 获取或设置入参列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("input")]
[System.Text.Json.Serialization.JsonPropertyName("input")]
public Types.Item[]? InputArgumentList { get; set; }
/// <summary>
/// 获取或设置出参列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("output")]
[System.Text.Json.Serialization.JsonPropertyName("output")]
public Types.Item[]? OutArgumentList { get; set; }
}
}
/// <summary>
/// 获取或设置服务接口调用 API。
/// </summary>
[Newtonsoft.Json.JsonProperty("api")]
[System.Text.Json.Serialization.JsonPropertyName("api")]
public string Api { get; set; } = default!;
/// <summary>
/// 获取或设置 API 类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("http_method")]
[System.Text.Json.Serialization.JsonPropertyName("http_method")]
public string HttpMethod { get; set; } = default!;
/// <summary>
/// 获取或设置 API 地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("http_url")]
[System.Text.Json.Serialization.JsonPropertyName("http_url")]
public string HttpUrl { get; set; } = default!;
/// <summary>
/// 获取或设置是否征求用户意见。
/// </summary>
[Newtonsoft.Json.JsonProperty("need_confirm")]
[System.Text.Json.Serialization.JsonPropertyName("need_confirm")]
public bool RequireConfirm { get; set; }
/// <summary>
/// 获取或设置征求语句。
/// </summary>
[Newtonsoft.Json.JsonProperty("need_confirm_response")]
[System.Text.Json.Serialization.JsonPropertyName("need_confirm_response")]
public string? ConfirmResponse { get; set; }
/// <summary>
/// 获取或设置参数信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("arguments")]
[System.Text.Json.Serialization.JsonPropertyName("arguments")]
public Types.Argument Argument { get; set; } = default!;
/// <summary>
/// 获取或设置结果列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("result")]
[System.Text.Json.Serialization.JsonPropertyName("result")]
public Result[] ResultList { get; set; } = default!;
}
public class AskSlotAnswerConfig
{
public static class Types
{
public class Argument
{
/// <summary>
/// 获取或设置参数名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string Name { get; set; } = default!;
/// <summary>
/// 获取或设置对应语义槽。
/// </summary>
[Newtonsoft.Json.JsonProperty("slot")]
[System.Text.Json.Serialization.JsonPropertyName("slot")]
public string Slot { get; set; } = default!;
/// <summary>
/// 获取或设置追问话术列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("ask_content")]
[System.Text.Json.Serialization.JsonPropertyName("ask_content")]
public string[]? AskContentList { get; set; }
}
}
/// <summary>
/// 获取或设置语义槽信息追问 API。
/// </summary>
[Newtonsoft.Json.JsonProperty("api")]
[System.Text.Json.Serialization.JsonPropertyName("api")]
public string Api { get; set; } = default!;
/// <summary>
/// 获取或设置参数列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("arguments")]
[System.Text.Json.Serialization.JsonPropertyName("arguments")]
public Types.Argument[]? ArgumentList { get; set; }
/// <summary>
/// 获取或设置结果列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("result")]
[System.Text.Json.Serialization.JsonPropertyName("result")]
public Result[] ResultList { get; set; } = default!;
}
public class AskAnswerConfig
{
/// <summary>
/// 获取或设置机器人提问 API。
/// </summary>
[Newtonsoft.Json.JsonProperty("api")]
[System.Text.Json.Serialization.JsonPropertyName("api")]
public string Api { get; set; } = default!;
/// <summary>
/// 获取或设置问题。
/// </summary>
[Newtonsoft.Json.JsonProperty("question")]
[System.Text.Json.Serialization.JsonPropertyName("question")]
public string Question { get; set; } = default!;
/// <summary>
/// 获取或设置结果列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("result")]
[System.Text.Json.Serialization.JsonPropertyName("result")]
public Result[] ResultList { get; set; } = default!;
}
public class Result
{
/// <summary>
/// 获取或设置错误码。
/// </summary>
[Newtonsoft.Json.JsonProperty("code")]
[System.Text.Json.Serialization.JsonPropertyName("code")]
public string ErrorCode { get; set; } = default!;
/// <summary>
/// 获取或设置错误描述。
/// </summary>
[Newtonsoft.Json.JsonProperty("desc")]
[System.Text.Json.Serialization.JsonPropertyName("desc")]
public string ErrorDescription { get; set; } = default!;
/// <summary>
/// 获取或设置回答配置类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("answer_config_type")]
[System.Text.Json.Serialization.JsonPropertyName("answer_config_type")]
public int AnswerConfigType { get; set; }
/// <summary>
/// 获取或设置回答。
/// </summary>
[Newtonsoft.Json.JsonProperty("answer")]
[System.Text.Json.Serialization.JsonPropertyName("answer")]
public string Answer { get; set; } = default!;
/// <summary>
/// 获取或设置普通技能信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("normal_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("normal_answer_config")]
public NormalAnswerConfig? AnswerConfigForNormal { get; set; }
/// <summary>
/// 获取或设置服务接口调用信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("api_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("api_answer_config")]
public ApiAnswerConfig? AnswerConfigForApi { get; set; }
/// <summary>
/// 获取或设置语义槽追问信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("ask_slot_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("ask_slot_answer_config")]
public AskSlotAnswerConfig? AnswerConfigForAskSlot { get; set; }
/// <summary>
/// 获取或设置机器人提问信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("ask_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("ask_answer_config")]
public AskAnswerConfig? AnswerConfigForAsk { get; set; }
/// <summary>
/// 获取或设置机器人动态提问信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("dynamic_ask_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("dynamic_ask_answer_config")]
public AskAnswerConfig? AnswerConfigForAskDynamic { get; set; }
}
}
/// <summary>
/// 获取或设置语义槽列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("slots")]
[System.Text.Json.Serialization.JsonPropertyName("slots")]
public Types.Slot[] IntentQuestionList { get; set; } = default!;
/// <summary>
/// 获取或设置前置对话列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("pre")]
[System.Text.Json.Serialization.JsonPropertyName("pre")]
public Types.Previous[] PreviousList { get; set; } = default!;
/// <summary>
/// 获取或设置后续对话列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("next")]
[System.Text.Json.Serialization.JsonPropertyName("next")]
public Types.Next[] NextList { get; set; } = default!;
/// <summary>
/// 获取或设置是否追问。
/// </summary>
[Newtonsoft.Json.JsonProperty("keep_ask")]
[System.Text.Json.Serialization.JsonPropertyName("keep_ask")]
public bool IsKeepAsk { get; set; }
/// <summary>
/// 获取或设置最大追问次数。
/// </summary>
[Newtonsoft.Json.JsonProperty("keep_ask_num")]
[System.Text.Json.Serialization.JsonPropertyName("keep_ask_num")]
public int KeepAskCount { get; set; }
/// <summary>
/// 获取或设置回答配置类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("answer_config_type")]
[System.Text.Json.Serialization.JsonPropertyName("answer_config_type")]
public int AnswerConfigType { get; set; }
/// <summary>
/// 获取或设置普通技能信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("normal_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("normal_answer_config")]
public Types.NormalAnswerConfig? AnswerConfigForNormal { get; set; }
/// <summary>
/// 获取或设置服务接口调用信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("api_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("api_answer_config")]
public Types.ApiAnswerConfig? AnswerConfigForApi { get; set; }
/// <summary>
/// 获取或设置语义槽追问信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("ask_slot_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("ask_slot_answer_config")]
public Types.AskSlotAnswerConfig? AnswerConfigForAskSlot { get; set; }
/// <summary>
/// 获取或设置机器人提问信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("ask_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("ask_answer_config")]
public Types.AskAnswerConfig? AnswerConfigForAsk { get; set; }
/// <summary>
/// 获取或设置机器人动态提问信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("dynamic_ask_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("dynamic_ask_answer_config")]
public Types.AskAnswerConfig? AnswerConfigForAskDynamic { get; set; }
}
}
}
}

View File

@ -0,0 +1,455 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/intent/config/save 接口的请求。</para>
/// </summary>
public class IntentConfigSaveRequest : WechatOpenAIRequest
{
public static class Types
{
public class Slot
{
/// <summary>
/// 获取或设置语义槽名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
/// <summary>
/// 获取或设置词典名称列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("dicts")]
[System.Text.Json.Serialization.JsonPropertyName("dicts")]
public IList<string> DictionaryNameList { get; set; } = new List<string>();
/// <summary>
/// 获取或设置是否追问。
/// </summary>
[Newtonsoft.Json.JsonProperty("keep_ask")]
[System.Text.Json.Serialization.JsonPropertyName("keep_ask")]
public bool IsKeepAsk { get; set; }
/// <summary>
/// 获取或设置追问话术列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("ask_content")]
[System.Text.Json.Serialization.JsonPropertyName("ask_content")]
public IList<string>? AskContentList { get; set; }
}
public class Previous
{
/// <summary>
/// 获取或设置意图名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("intent")]
[System.Text.Json.Serialization.JsonPropertyName("intent")]
public string IntentName { get; set; } = string.Empty;
/// <summary>
/// 获取或设置技能名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("skill")]
[System.Text.Json.Serialization.JsonPropertyName("skill")]
public string SkillName { get; set; } = string.Empty;
}
public class Next : Previous
{
}
public class NormalAnswerConfig
{
public static class Types
{
public class Answer
{
/// <summary>
/// 获取或设置类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("type")]
[System.Text.Json.Serialization.JsonPropertyName("type")]
public int Type { get; set; }
/// <summary>
/// 获取或设置回答内容。
/// </summary>
[Newtonsoft.Json.JsonProperty("content")]
[System.Text.Json.Serialization.JsonPropertyName("content")]
public string Content { get; set; } = string.Empty;
}
}
/// <summary>
/// 获取或设置是否合并。
/// </summary>
[Newtonsoft.Json.JsonProperty("merge_answer")]
[System.Text.Json.Serialization.JsonPropertyName("merge_answer")]
public bool RequireMergeAnswer { get; set; }
/// <summary>
/// 获取或设置回答列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("answer")]
[System.Text.Json.Serialization.JsonPropertyName("answer")]
public IList<Types.Answer> AnswerList { get; set; } = new List<Types.Answer>();
}
public class ApiAnswerConfig
{
public static class Types
{
public class Argument
{
public static class Types
{
public class Item
{
/// <summary>
/// 获取或设置参数名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
/// <summary>
/// 获取或设置是否必填。
/// </summary>
[Newtonsoft.Json.JsonProperty("input")]
[System.Text.Json.Serialization.JsonPropertyName("input")]
public bool IsRequired { get; set; }
/// <summary>
/// 获取或设置参数含义。
/// </summary>
[Newtonsoft.Json.JsonProperty("desc")]
[System.Text.Json.Serialization.JsonPropertyName("desc")]
public string Description { get; set; } = string.Empty;
/// <summary>
/// 获取或设置对应语义槽。
/// </summary>
[Newtonsoft.Json.JsonProperty("slot")]
[System.Text.Json.Serialization.JsonPropertyName("slot")]
public string Slot { get; set; } = string.Empty;
/// <summary>
/// 获取或设置默认值。
/// </summary>
[Newtonsoft.Json.JsonProperty("default_value")]
[System.Text.Json.Serialization.JsonPropertyName("default_value")]
public string DefaultValue { get; set; } = string.Empty;
/// <summary>
/// 获取或设置追问话术列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("ask_content")]
[System.Text.Json.Serialization.JsonPropertyName("ask_content")]
public IList<string>? AskContentList { get; set; }
}
}
/// <summary>
/// 获取或设置入参列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("input")]
[System.Text.Json.Serialization.JsonPropertyName("input")]
public IList<Types.Item>? InputArgumentList { get; set; }
/// <summary>
/// 获取或设置出参列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("output")]
[System.Text.Json.Serialization.JsonPropertyName("output")]
public IList<Types.Item>? OutArgumentList { get; set; }
}
}
/// <summary>
/// 获取或设置服务接口调用 API。
/// </summary>
[Newtonsoft.Json.JsonProperty("api")]
[System.Text.Json.Serialization.JsonPropertyName("api")]
public string Api { get; set; } = string.Empty;
/// <summary>
/// 获取或设置 API 类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("http_method")]
[System.Text.Json.Serialization.JsonPropertyName("http_method")]
public string HttpMethod { get; set; } = string.Empty;
/// <summary>
/// 获取或设置 API 地址。
/// </summary>
[Newtonsoft.Json.JsonProperty("http_url")]
[System.Text.Json.Serialization.JsonPropertyName("http_url")]
public string HttpUrl { get; set; } = string.Empty;
/// <summary>
/// 获取或设置是否征求用户意见。
/// </summary>
[Newtonsoft.Json.JsonProperty("need_confirm")]
[System.Text.Json.Serialization.JsonPropertyName("need_confirm")]
public bool RequireConfirm { get; set; }
/// <summary>
/// 获取或设置征求语句。
/// </summary>
[Newtonsoft.Json.JsonProperty("need_confirm_response")]
[System.Text.Json.Serialization.JsonPropertyName("need_confirm_response")]
public string? ConfirmResponse { get; set; }
/// <summary>
/// 获取或设置参数信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("arguments")]
[System.Text.Json.Serialization.JsonPropertyName("arguments")]
public Types.Argument Argument { get; set; } = new Types.Argument();
/// <summary>
/// 获取或设置结果列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("result")]
[System.Text.Json.Serialization.JsonPropertyName("result")]
public IList<Result> ResultList { get; set; } = new List<Result>();
}
public class AskSlotAnswerConfig
{
public static class Types
{
public class Argument
{
/// <summary>
/// 获取或设置参数名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
/// <summary>
/// 获取或设置对应语义槽。
/// </summary>
[Newtonsoft.Json.JsonProperty("slot")]
[System.Text.Json.Serialization.JsonPropertyName("slot")]
public string Slot { get; set; } = string.Empty;
/// <summary>
/// 获取或设置追问话术列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("ask_content")]
[System.Text.Json.Serialization.JsonPropertyName("ask_content")]
public IList<string>? AskContentList { get; set; }
}
}
/// <summary>
/// 获取或设置语义槽信息追问 API。
/// </summary>
[Newtonsoft.Json.JsonProperty("api")]
[System.Text.Json.Serialization.JsonPropertyName("api")]
public string Api { get; set; } = string.Empty;
/// <summary>
/// 获取或设置参数信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("arguments")]
[System.Text.Json.Serialization.JsonPropertyName("arguments")]
public IList<Types.Argument> Argument { get; set; } = new List<Types.Argument>();
/// <summary>
/// 获取或设置结果列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("result")]
[System.Text.Json.Serialization.JsonPropertyName("result")]
public IList<Result> ResultList { get; set; } = new List<Result>();
}
public class AskAnswerConfig
{
/// <summary>
/// 获取或设置机器人提问 API。
/// </summary>
[Newtonsoft.Json.JsonProperty("api")]
[System.Text.Json.Serialization.JsonPropertyName("api")]
public string Api { get; set; } = string.Empty;
/// <summary>
/// 获取或设置问题。
/// </summary>
[Newtonsoft.Json.JsonProperty("question")]
[System.Text.Json.Serialization.JsonPropertyName("question")]
public string Question { get; set; } = string.Empty;
/// <summary>
/// 获取或设置结果列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("result")]
[System.Text.Json.Serialization.JsonPropertyName("result")]
public IList<Result> ResultList { get; set; } = new List<Result>();
}
public class Result
{
/// <summary>
/// 获取或设置错误码。
/// </summary>
[Newtonsoft.Json.JsonProperty("code")]
[System.Text.Json.Serialization.JsonPropertyName("code")]
public string ErrorCode { get; set; } = string.Empty;
/// <summary>
/// 获取或设置错误描述。
/// </summary>
[Newtonsoft.Json.JsonProperty("desc")]
[System.Text.Json.Serialization.JsonPropertyName("desc")]
public string ErrorDescription { get; set; } = string.Empty;
/// <summary>
/// 获取或设置回答配置类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("answer_config_type")]
[System.Text.Json.Serialization.JsonPropertyName("answer_config_type")]
public int AnswerConfigType { get; set; }
/// <summary>
/// 获取或设置回答。
/// </summary>
[Newtonsoft.Json.JsonProperty("answer")]
[System.Text.Json.Serialization.JsonPropertyName("answer")]
public string Answer { get; set; } = string.Empty;
/// <summary>
/// 获取或设置普通技能信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("normal_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("normal_answer_config")]
public NormalAnswerConfig? AnswerConfigForNormal { get; set; }
/// <summary>
/// 获取或设置服务接口调用信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("api_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("api_answer_config")]
public ApiAnswerConfig? AnswerConfigForApi { get; set; }
/// <summary>
/// 获取或设置语义槽追问信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("ask_slot_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("ask_slot_answer_config")]
public AskSlotAnswerConfig? AnswerConfigForAskSlot { get; set; }
/// <summary>
/// 获取或设置机器人提问信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("ask_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("ask_answer_config")]
public AskAnswerConfig? AnswerConfigForAsk { get; set; }
/// <summary>
/// 获取或设置机器人动态提问信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("dynamic_ask_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("dynamic_ask_answer_config")]
public AskAnswerConfig? AnswerConfigForAskDynamic { get; set; }
}
}
/// <summary>
/// 获取或设置意图 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("intent_id")]
[System.Text.Json.Serialization.JsonPropertyName("intent_id")]
public long IntentId { get; set; }
/// <summary>
/// 获取或设置技能 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("skill_id")]
[System.Text.Json.Serialization.JsonPropertyName("skill_id")]
public long SkillId { get; set; }
/// <summary>
/// 获取或设置语义槽列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("slots")]
[System.Text.Json.Serialization.JsonPropertyName("slots")]
public IList<Types.Slot> IntentQuestionList { get; set; } = new List<Types.Slot>();
/// <summary>
/// 获取或设置前置对话列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("pre")]
[System.Text.Json.Serialization.JsonPropertyName("pre")]
public IList<Types.Previous> PreviousList { get; set; } = new List<Types.Previous>();
/// <summary>
/// 获取或设置后续对话列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("next")]
[System.Text.Json.Serialization.JsonPropertyName("next")]
public IList<Types.Next> NextList { get; set; } = new List<Types.Next>();
/// <summary>
/// 获取或设置是否追问。
/// </summary>
[Newtonsoft.Json.JsonProperty("keep_ask")]
[System.Text.Json.Serialization.JsonPropertyName("keep_ask")]
public bool IsKeepAsk { get; set; }
/// <summary>
/// 获取或设置最大追问次数。
/// </summary>
[Newtonsoft.Json.JsonProperty("keep_ask_num")]
[System.Text.Json.Serialization.JsonPropertyName("keep_ask_num")]
public int KeepAskCount { get; set; }
/// <summary>
/// 获取或设置回答配置类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("answer_config_type")]
[System.Text.Json.Serialization.JsonPropertyName("answer_config_type")]
public int AnswerConfigType { get; set; }
/// <summary>
/// 获取或设置普通技能信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("normal_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("normal_answer_config")]
public Types.NormalAnswerConfig? AnswerConfigForNormal { get; set; }
/// <summary>
/// 获取或设置服务接口调用信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("api_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("api_answer_config")]
public Types.ApiAnswerConfig? AnswerConfigForApi { get; set; }
/// <summary>
/// 获取或设置语义槽追问信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("ask_slot_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("ask_slot_answer_config")]
public Types.AskSlotAnswerConfig? AnswerConfigForAskSlot { get; set; }
/// <summary>
/// 获取或设置机器人提问信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("ask_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("ask_answer_config")]
public Types.AskAnswerConfig? AnswerConfigForAsk { get; set; }
/// <summary>
/// 获取或设置机器人动态提问信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("dynamic_ask_answer_config")]
[System.Text.Json.Serialization.JsonPropertyName("dynamic_ask_answer_config")]
public Types.AskAnswerConfig? AnswerConfigForAskDynamic { get; set; }
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/intent/config/save 接口的响应。</para>
/// </summary>
public class IntentConfigSaveResponse : WechatOpenAIResponse
{
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/intent/delete 接口的请求。</para>
/// </summary>
public class IntentDeleteRequest : WechatOpenAIRequest
{
/// <summary>
/// 获取或设置意图 ID 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("id_list")]
[System.Text.Json.Serialization.JsonPropertyName("id_list")]
public IList<long> IntentIdList { get; set; } = new List<long>();
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/intent/delete 接口的响应。</para>
/// </summary>
public class IntentDeleteResponse : WechatOpenAIResponse
{
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/intent/get_detail 接口的请求。</para>
/// </summary>
public class IntentGetDetailRequest : WechatOpenAIRequest
{
/// <summary>
/// 获取或设置意图 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("id")]
[System.Text.Json.Serialization.JsonPropertyName("id")]
public long IntentId { get; set; }
}
}

View File

@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/intent/get_detail 接口的响应。</para>
/// </summary>
public class IntentGetDetailResponse : WechatOpenAIResponse<IntentGetDetailResponse.Types.Data>
{
public static class Types
{
public class Data
{
public static class Types
{
public class Question
{
/// <summary>
/// 获取或设置问题 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("id")]
[System.Text.Json.Serialization.JsonPropertyName("id")]
public long QuestionId { get; set; }
/// <summary>
/// 获取或设置问题内容。
/// </summary>
[Newtonsoft.Json.JsonProperty("question")]
[System.Text.Json.Serialization.JsonPropertyName("question")]
public string Content { get; set; } = default!;
/// <summary>
/// 获取或设置优先级。
/// </summary>
[Newtonsoft.Json.JsonProperty("rank_level")]
[System.Text.Json.Serialization.JsonPropertyName("rank_level")]
public double RankLevel { get; set; }
/// <summary>
/// 获取或设置相似度。
/// </summary>
[Newtonsoft.Json.JsonProperty("threshold")]
[System.Text.Json.Serialization.JsonPropertyName("threshold")]
public double Threshold { get; set; }
/// <summary>
/// 获取或设置是否为反例。
/// </summary>
[Newtonsoft.Json.JsonProperty("counter_example")]
[System.Text.Json.Serialization.JsonPropertyName("counter_example")]
public bool IsCounterExample { get; set; }
}
}
/// <summary>
/// 获取或设置意图 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("id")]
[System.Text.Json.Serialization.JsonPropertyName("id")]
public long IntentId { get; set; }
/// <summary>
/// 获取或设置技能 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("skill_id")]
[System.Text.Json.Serialization.JsonPropertyName("skill_id")]
public long SkillId { get; set; }
/// <summary>
/// 获取或设置意图名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string Name { get; set; } = default!;
/// <summary>
/// 获取或设置优先级。
/// </summary>
[Newtonsoft.Json.JsonProperty("rank_level")]
[System.Text.Json.Serialization.JsonPropertyName("rank_level")]
public double RankLevel { get; set; }
/// <summary>
/// 获取或设置相似度。
/// </summary>
[Newtonsoft.Json.JsonProperty("threshold")]
[System.Text.Json.Serialization.JsonPropertyName("threshold")]
public double Threshold { get; set; }
/// <summary>
/// 获取或设置意图开关。
/// </summary>
[Newtonsoft.Json.JsonProperty("switch")]
[System.Text.Json.Serialization.JsonPropertyName("switch")]
public bool Switch { get; set; }
/// <summary>
/// 获取或设置命中次数。
/// </summary>
[Newtonsoft.Json.JsonProperty("frequency")]
[System.Text.Json.Serialization.JsonPropertyName("frequency")]
public int Frequency { get; set; }
/// <summary>
/// 获取或设置意图问题列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("questions")]
[System.Text.Json.Serialization.JsonPropertyName("questions")]
public Types.Question[] QuestionList { get; set; } = default!;
/// <summary>
/// 获取或设置更新时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("updated_time")]
[System.Text.Json.Serialization.JsonPropertyName("updated_time")]
public long UpdateTimestamp { get; set; }
}
}
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/intent/name_exist 接口的请求。</para>
/// </summary>
public class IntentNameExistRequest : WechatOpenAIRequest
{
/// <summary>
/// 获取或设置技能 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("skill_id")]
[System.Text.Json.Serialization.JsonPropertyName("skill_id")]
public long SkillId { get; set; }
/// <summary>
/// 获取或设置意图名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("intent_name")]
[System.Text.Json.Serialization.JsonPropertyName("intent_name")]
public string IntentName { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/intent/name_exist 接口的响应。</para>
/// </summary>
public class IntentNameExistResponse : WechatOpenAIResponse<IntentNameExistResponse.Types.Data>
{
public static class Types
{
public class Data
{
/// <summary>
/// 获取或设置是否已存在。
/// </summary>
[Newtonsoft.Json.JsonProperty("exist")]
[System.Text.Json.Serialization.JsonPropertyName("exist")]
public bool IsExisted { get; set; }
}
}
}
}

View File

@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/intent/save 接口的请求。</para>
/// </summary>
public class IntentSaveRequest : WechatOpenAIRequest
{
public static class Types
{
public class Intent
{
/// <summary>
/// 获取或设置意图 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("intent_id")]
[System.Text.Json.Serialization.JsonPropertyName("intent_id")]
public long IntentId { get; set; }
/// <summary>
/// 获取或设置技能 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("skill_id")]
[System.Text.Json.Serialization.JsonPropertyName("skill_id")]
public long SkillId { get; set; }
/// <summary>
/// 获取或设置意图名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("name")]
[System.Text.Json.Serialization.JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
/// <summary>
/// 获取或设置优先级。
/// </summary>
[Newtonsoft.Json.JsonProperty("rank_level")]
[System.Text.Json.Serialization.JsonPropertyName("rank_level")]
public double RankLevel { get; set; }
/// <summary>
/// 获取或设置相似度。
/// </summary>
[Newtonsoft.Json.JsonProperty("threshold")]
[System.Text.Json.Serialization.JsonPropertyName("threshold")]
public double Threshold { get; set; }
/// <summary>
/// 获取或设置意图开关。
/// </summary>
[Newtonsoft.Json.JsonProperty("switch")]
[System.Text.Json.Serialization.JsonPropertyName("switch")]
public bool Switch { get; set; }
}
}
/// <summary>
/// 获取或设置意图列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("intent_list")]
[System.Text.Json.Serialization.JsonPropertyName("intent_list")]
public IList<Types.Intent> IntentList { get; set; } = new List<Types.Intent>();
}
}

View File

@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/intent/save 接口的响应。</para>
/// </summary>
public class IntentSaveResponse : WechatOpenAIResponse<IntentSaveResponse.Types.Data>
{
public static class Types
{
public class Data
{
public static class Types
{
public class Intent
{
/// <summary>
/// 获取或设置意图 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("intent_id")]
[System.Text.Json.Serialization.JsonPropertyName("intent_id")]
public long IntentId { get; set; }
/// <summary>
/// 获取或设置意图名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("intent_name")]
[System.Text.Json.Serialization.JsonPropertyName("intent_name")]
public string Name { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置意图列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("list")]
[System.Text.Json.Serialization.JsonPropertyName("list")]
public Types.Intent[] IntentList { get; set; } = default!;
/// <summary>
/// 获取或设置意图数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("count")]
[System.Text.Json.Serialization.JsonPropertyName("count")]
public int Count { get; set; }
}
}
}
}

View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/intent/search 接口的请求。</para>
/// </summary>
public class IntentSearchRequest : WechatOpenAIRequest
{
/// <summary>
/// 获取或设置关键字。
/// </summary>
[Newtonsoft.Json.JsonProperty("keyword")]
[System.Text.Json.Serialization.JsonPropertyName("keyword")]
public string? Keyword { get; set; }
/// <summary>
/// 获取或设置分页页数。
/// <para>默认值1</para>
/// </summary>
[Newtonsoft.Json.JsonProperty("page")]
[System.Text.Json.Serialization.JsonPropertyName("page")]
public int Page { get; set; } = 1;
/// <summary>
/// 获取或设置分页每页数量。
/// <para>默认值10</para>
/// </summary>
[Newtonsoft.Json.JsonProperty("size")]
[System.Text.Json.Serialization.JsonPropertyName("size")]
public int Limit { get; set; } = 10;
}
}

View File

@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/intent/search 接口的响应。</para>
/// </summary>
public class IntentSearchResponse : WechatOpenAIResponse<IntentSearchResponse.Types.Data>
{
public static class Types
{
public class Data
{
public static class Types
{
public class Intent
{
/// <summary>
/// 获取或设置意图 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("intent_id")]
[System.Text.Json.Serialization.JsonPropertyName("intent_id")]
public long IntentId { get; set; }
/// <summary>
/// 获取或设置意图名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("intent_name")]
[System.Text.Json.Serialization.JsonPropertyName("intent_name")]
public string IntentName { get; set; } = default!;
/// <summary>
/// 获取或设置技能 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("skill_id")]
[System.Text.Json.Serialization.JsonPropertyName("skill_id")]
public long SkillId { get; set; }
/// <summary>
/// 获取或设置技能名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("skill_name")]
[System.Text.Json.Serialization.JsonPropertyName("skill_name")]
public string SkillName { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置意图列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("list")]
[System.Text.Json.Serialization.JsonPropertyName("list")]
public Types.Intent[] IntentList { get; set; } = default!;
/// <summary>
/// 获取或设置意图总数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("count")]
[System.Text.Json.Serialization.JsonPropertyName("count")]
public int TotalCount { get; set; }
}
}
}
}

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v1/intent/switch/batch 接口的请求。</para>
/// </summary>
public class IntentSwitchBatchRequest : WechatOpenAIRequest
{
public static class Types
{
public class Intent
{
/// <summary>
/// 获取或设置意图 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("id")]
[System.Text.Json.Serialization.JsonPropertyName("id")]
public long IntentId { get; set; }
/// <summary>
/// 获取或设置意图开关。
/// </summary>
[Newtonsoft.Json.JsonProperty("switch")]
[System.Text.Json.Serialization.JsonPropertyName("switch")]
public bool Switch { get; set; }
}
}
/// <summary>
/// 获取或设置意图列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("switch_list")]
[System.Text.Json.Serialization.JsonPropertyName("switch_list")]
public IList<Types.Intent> IntentList { get; set; } = new List<Types.Intent>();
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v1/intent/switch/batch 接口的响应。</para>
/// </summary>
public class IntentSwitchBatchResponse : WechatOpenAIResponse
{
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/intent/question/delete 接口的请求。</para>
/// </summary>
public class IntentQuestionDeleteRequest : WechatOpenAIRequest
{
/// <summary>
/// 获取或设置意图问题 ID 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("id_list")]
[System.Text.Json.Serialization.JsonPropertyName("id_list")]
public IList<long> IntentQuestionIdList { get; set; } = new List<long>();
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/intent/question/delete 接口的响应。</para>
/// </summary>
public class IntentQuestionDeleteResponse : WechatOpenAIResponse
{
}
}

View File

@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/intent/question/save 接口的请求。</para>
/// </summary>
public class IntentQuestionSaveRequest : WechatOpenAIRequest
{
public static class Types
{
public class Question
{
/// <summary>
/// 获取或设置问题 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("id")]
[System.Text.Json.Serialization.JsonPropertyName("id")]
public long QuestionId { get; set; }
/// <summary>
/// 获取或设置问题内容。
/// </summary>
[Newtonsoft.Json.JsonProperty("question")]
[System.Text.Json.Serialization.JsonPropertyName("question")]
public string Content { get; set; } = string.Empty;
/// <summary>
/// 获取或设置优先级。
/// </summary>
[Newtonsoft.Json.JsonProperty("rank_level")]
[System.Text.Json.Serialization.JsonPropertyName("rank_level")]
public double RankLevel { get; set; }
/// <summary>
/// 获取或设置相似度。
/// </summary>
[Newtonsoft.Json.JsonProperty("threshold")]
[System.Text.Json.Serialization.JsonPropertyName("threshold")]
public double Threshold { get; set; }
/// <summary>
/// 获取或设置是否为反例。
/// </summary>
[Newtonsoft.Json.JsonProperty("counter_example")]
[System.Text.Json.Serialization.JsonPropertyName("counter_example")]
public bool IsCounterExample { get; set; }
}
}
/// <summary>
/// 获取或设置保存模式。
/// </summary>
[Newtonsoft.Json.JsonProperty("mode")]
[System.Text.Json.Serialization.JsonPropertyName("mode")]
public int Mode { get; set; }
/// <summary>
/// 获取或设置意图 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("intent_id")]
[System.Text.Json.Serialization.JsonPropertyName("intent_id")]
public long IntentId { get; set; }
/// <summary>
/// 获取或设置意图名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("intent_name")]
[System.Text.Json.Serialization.JsonPropertyName("intent_name")]
public string? IntentName { get; set; }
/// <summary>
/// 获取或设置技能 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("skill_id")]
[System.Text.Json.Serialization.JsonPropertyName("skill_id")]
public long SkillId { get; set; }
/// <summary>
/// 获取或设置技能名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("skill_name")]
[System.Text.Json.Serialization.JsonPropertyName("skill_name")]
public string? SkillName { get; set; }
/// <summary>
/// 获取或设置意图问题列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("data")]
[System.Text.Json.Serialization.JsonPropertyName("data")]
public IList<Types.Question> IntentQuestionList { get; set; } = new List<Types.Question>();
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{
/// <summary>
/// <para>表示 [POST] /v2/intent/question/save 接口的响应。</para>
/// </summary>
public class IntentQuestionSaveResponse : WechatOpenAIResponse
{
}
}

View File

@ -0,0 +1,3 @@
{
"intent_id": 1205882
}

View File

@ -0,0 +1,127 @@
{
"code": 0,
"msg": "请求成功",
"request_id": "255i0ug8-l9q4-3801-44ft-w7csjn9e5142",
"data": {
"slots": [
{
"name": "城市",
"dicts": [ "建筑", "公路" ],
"keep_ask": true,
"ask_content": [ "建筑1", "公路1" ]
}
],
"pre": [
{
"skill": "音乐",
"intent": "点播"
}
],
"next": [
{
"skill": "天气",
"intent": "询问"
}
],
"keep_ask": true,
"keep_ask_num": 10,
"answer_config_type": 4,
"dynamic_ask_answer_config": {
"api": "_dynamic_list_selection_{}",
"question": "AskAnswerConfigQuestion",
"result": [
{
"code": "0",
"desc": "",
"answer_config_type": 3,
"answer": "",
"ask_answer_config": {
"api": "_bot_ask_{}",
"question": "AskAnswerConfigQuestion",
"result": [
{
"code": "0",
"desc": "",
"answer_config_type": 2,
"answer": "",
"ask_slot_answer_config": {
"api": "_bot_getinfo_{}",
"arguments": [
{
"name": "",
"slot": "Slot",
"ask_content": [ "111", "222" ]
}
],
"result": [
{
"code": "0",
"desc": "",
"answer_config_type": 1,
"answer": "",
"api_answer_config": {
"api": "_http_service_{}",
"need_confirm": true,
"need_confirm_response": "城市好啊",
"http_method": "get",
"http_url": "HttpUrl111",
"arguments": {
"input": [
{
"name": "InputName",
"input": true,
"desc": "Inputdesc",
"slot": "InputSlot",
"default_value": "defa",
"ask_content": [ "ask" ]
}
],
"output": [
{
"name": "OutputName",
"input": false,
"desc": "desc",
"slot": "OutputSlot",
"default_value": ""
}
]
},
"result": [
{
"code": "0",
"desc": "",
"answer_config_type": 0,
"answer": "",
"normal_answer_config": {
"merge_answer": true,
"answer": [
{
"type": 0,
"content": "我在哪"
},
{
"type": 1,
"content": {
"title": "我是h5",
"description": "我是Description",
"url": "我是Url",
"pic_url": "我是PicUrl",
"type": "h5"
}
}
]
}
}
]
}
}
]
}
}
]
}
}
]
}
}
}

View File

@ -0,0 +1,125 @@
{
"intent_id": 9617433,
"skill_id": 1549251,
"slots": [
{
"name": "城市",
"dicts": [
"建筑",
"公路"
],
"keep_ask": true,
"ask_content": [
"建筑1",
"公路1"
]
}
],
"pre": [
{
"skill": "音乐",
"intent": "点播"
}
],
"next": [
{
"skill": "天气",
"intent": "询问"
}
],
"keep_ask": true,
"keep_ask_num": 10,
"answer_config_type": 4,
"dynamic_ask_answer_config": {
"api": "_dynamic_list_selection_{}",
"question": "AskAnswerConfig Question",
"result": [
{
"code": "0",
"desc": "",
"answer_config_type": 3,
"answer": "",
"ask_answer_config": {
"api": "_bot_ask_{}",
"question": "AskAnswerConfig Question",
"result": [
{
"code": "0",
"desc": "",
"answer_config_type": 2,
"answer": "",
"ask_slot_answer_config": {
"api": "_bot_getinfo_{}",
"arguments": [
{
"name": "",
"slot": "Slot",
"ask_content": [
"111",
"222"
]
}
],
"result": [
{
"code": "0",
"desc": "",
"answer_config_type": 1,
"answer": "",
"api_answer_config": {
"api": "_http_service_{}",
"need_confirm": true,
"need_confirm_response": "城市好啊",
"http_method": "get",
"http_url": "HttpUrl111",
"arguments": {
"input": [
{
"name": "Input Name",
"input": true,
"desc": "Input desc",
"slot": "Input Slot",
"default_value": "defa",
"ask_content": [
"ask"
]
}
],
"output": [
{
"name": "Output Name",
"input": false,
"desc": "desc",
"slot": "Output Slot",
"default_value": ""
}
]
},
"result": [
{
"code": "0",
"desc": "",
"answer_config_type": 0,
"answer": "",
"normal_answer_config": {
"merge_answer": true,
"answer": [
{
"content": "我在哪"
}
]
}
}
]
}
}
]
}
}
]
}
}
]
}
}

View File

@ -0,0 +1,5 @@
{
"code": 0,
"msg": "请求成功",
"request_id": "255i0ug8-l9q4-3801-44ft-w7csjn9e5142"
}

View File

@ -0,0 +1,3 @@
{
"id_list": [ 1205882, 1205883, 1205884 ]
}

View File

@ -0,0 +1,5 @@
{
"code": 0,
"msg": "success",
"request_id": "255i0ug8-l9q4-3801-44ft-w7csjn9e5142"
}

View File

@ -0,0 +1,24 @@
{
"code": 0,
"data": {
"id": 6326248,
"name": "温度bab1",
"questions": [
{
"counter_example": true,
"id": 92,
"question": "今天温度怎么样e",
"rank_level": 1,
"threshold": 0.9
}
],
"rank_level": 1,
"skill_id": 1205882,
"switch": false,
"threshold": 0.9,
"frequency": 0,
"updated_time": 1588931008
},
"msg": "请求成功",
"request_id": "255i0ug8-l9q4-3801-44ft-w7csjn9e5142"
}

View File

@ -0,0 +1,4 @@
{
"skill_id": 1548171,
"intent_name": "温度"
}

View File

@ -0,0 +1,8 @@
{
"code": 0,
"msg": "success",
"request_id": "255i0ug8-l9q4-3801-44ft-w7csjn9e5142",
"data": {
"exist": true
}
}

View File

@ -0,0 +1,20 @@
{
"intent_list": [
{
"intent_id": 0,
"skill_id": 1,
"name": "测试创建意图1",
"rank_level": 0.65,
"threshold": 0.7,
"switch": false
},
{
"intent_id": 0,
"skill_id": 1,
"name": "测试创建意图2",
"rank_level": 0.75,
"threshold": 0.7,
"switch": true
}
]
}

View File

@ -0,0 +1,18 @@
{
"code": 0,
"msg": "success",
"request_id": "255i0ug8-l9q4-3801-44ft-w7csjn9e5142",
"data": {
"count": 2,
"list": [
{
"intent_id": 45,
"intent_name": "测试创建意图1"
},
{
"intent_id": 20,
"intent_name": "测试创建意图2"
}
]
}
}

View File

@ -0,0 +1,5 @@
{
"keyword": "测试",
"page": 1,
"size": 10
}

View File

@ -0,0 +1,28 @@
{
"code": 0,
"data": {
"count": 3,
"list": [
{
"intent_id": 1516,
"intent_name": "笑什么?",
"skill_id": 7895,
"skill_name": "测试技能4"
},
{
"intent_id": 1517,
"intent_name": "测试意图333",
"skill_id": 7899,
"skill_name": "技能5"
},
{
"intent_id": 2,
"intent_name": "测试意图666",
"skill_id": 7899,
"skill_name": "技能5"
}
]
},
"msg": "请求成功",
"request_id": "255i0ug8-l9q4-3801-44ft-w7csjn9e5142"
}

View File

@ -0,0 +1,12 @@
{
"switch_list": [
{
"id": 1205882,
"switch": true
},
{
"id": 1205883,
"switch": false
}
]
}

View File

@ -0,0 +1,5 @@
{
"code": 0,
"msg": "请求成功",
"request_id": "255i0ug8-l9q4-3801-44ft-w7csjn9e5142"
}

View File

@ -0,0 +1,5 @@
{
"code": 0,
"msg": "success",
"request_id": "255i0ug8-l9q4-3801-44ft-w7csjn9e5142"
}

View File

@ -0,0 +1,23 @@
{
"mode": 0,
"skill_id": 16579,
"skill_name": "",
"intent_id": 1205882,
"intent_name": "",
"data": [
{
"id": 0,
"question": "天气",
"rank_level": 0.9,
"threshold": 0.8,
"counter_example": false
},
{
"id": 0,
"question": "温度",
"rank_level": 0.8,
"threshold": 0.8,
"counter_example": false
}
]
}

View File

@ -0,0 +1,5 @@
{
"code": 0,
"msg": "success",
"request_id": "255i0ug8-l9q4-3801-44ft-w7csjn9e5142"
}