mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-12-22 03:19:55 +08:00
feat(openai): 移除 NLP 相关接口及模型
This commit is contained in:
@@ -2,7 +2,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 userEnter 事件的数据。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/platform/thirdkefu/recivemsg.html </para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/confapi/thirdkefu/recivemsg.html </para>
|
||||
/// </summary>
|
||||
public class UserEnterEvent : WechatOpenAIEvent, WechatOpenAIEvent.Serialization.IXmlSerializable
|
||||
{
|
||||
@@ -39,14 +39,14 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Events
|
||||
/// <summary>
|
||||
/// 获取或设置客服接入状态。
|
||||
/// </summary>
|
||||
[System.Xml.Serialization.XmlElement("status")]
|
||||
public int Status { get; set; }
|
||||
[System.Xml.Serialization.XmlElement("kfstate")]
|
||||
public int KfState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置渠道。
|
||||
/// </summary>
|
||||
[System.Xml.Serialization.XmlElement("channel", IsNullable = true)]
|
||||
public string? Channel { get; set; }
|
||||
[System.Xml.Serialization.XmlElement("channel")]
|
||||
public int Channel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户评价。
|
||||
|
||||
@@ -2,7 +2,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 userQuit 事件的数据。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/platform/thirdkefu/recivemsg.html </para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/confapi/thirdkefu/recivemsg.html </para>
|
||||
/// </summary>
|
||||
public class UserQuitEvent : UserEnterEvent
|
||||
{
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Flurl.Http;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
{
|
||||
public static class WechatOpenAIClientExecuteLivingExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /batchreply/{TOKEN} 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/platform/living/batchreply.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.BatchReplyResponse> ExecuteBatchReplyAsync(this WechatOpenAIClient client, Models.BatchReplyRequest 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, "batchreply", client.Credentials.Token!);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.BatchReplyResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /generatereport/{TOKEN} 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/platform/living/setautoreply.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.GenerateReportResponse> ExecuteGenerateReportAsync(this WechatOpenAIClient client, Models.GenerateReportRequest 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, "generatereport", client.Credentials.Token!);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.GenerateReportResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,239 +0,0 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Flurl.Http;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
{
|
||||
public static class WechatOpenAIClientExecuteNLPExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /nlp/tokenize/{TOKEN} 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/platform/nlp/tokenize.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.NLPTokenizeResponse> ExecuteNLPTokenizeAsync(this WechatOpenAIClient client, Models.NLPTokenizeRequest 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, "nlp", "tokenize", client.Credentials.Token!);
|
||||
|
||||
return await client.SendRequestWithUrlEncodedAsync<Models.NLPTokenizeResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /nlp/ner/{TOKEN} 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/platform/nlp/ner.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.NLPNERResponse> ExecuteNLPNERAsync(this WechatOpenAIClient client, Models.NLPNERRequest 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, "nlp", "ner", client.Credentials.Token!);
|
||||
|
||||
return await client.SendRequestWithUrlEncodedAsync<Models.NLPNERResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /nlp/sentiment/{TOKEN} 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/platform/nlp/sentiment.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.NLPSentimentResponse> ExecuteNLPSentimentAsync(this WechatOpenAIClient client, Models.NLPSentimentRequest 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, "nlp", "sentiment", client.Credentials.Token!);
|
||||
|
||||
return await client.SendRequestWithUrlEncodedAsync<Models.NLPSentimentResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /nlp/ner-product/{TOKEN} 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/platform/nlp/nerproduct.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.NLPNERProductResponse> ExecuteNLPNERProductAsync(this WechatOpenAIClient client, Models.NLPNERProductRequest 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, "nlp", "ner-product", client.Credentials.Token!);
|
||||
|
||||
return await client.SendRequestWithUrlEncodedAsync<Models.NLPNERProductResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /nlp/sensitive/{TOKEN} 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/platform/nlp/sensitive.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.NLPSensitiveResponse> ExecuteNLPSensitiveAsync(this WechatOpenAIClient client, Models.NLPSensitiveRequest 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, "nlp", "sensitive", client.Credentials.Token!);
|
||||
|
||||
return await client.SendRequestWithUrlEncodedAsync<Models.NLPSensitiveResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /nlp/rank/{TOKEN} 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/platform/nlp/rank.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.NLPRankResponse> ExecuteNLPRankAsync(this WechatOpenAIClient client, Models.NLPRankRequest 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, "nlp", "rank", client.Credentials.Token!);
|
||||
|
||||
return await client.SendRequestWithUrlEncodedAsync<Models.NLPRankResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /nlp/translate_en2cn/{TOKEN} 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/platform/nlp/translate.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.NLPTranslateEnglish2ChineseResponse> ExecuteNLPTranslateEnglish2ChineseAsync(this WechatOpenAIClient client, Models.NLPTranslateEnglish2ChineseRequest 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, "nlp", "translate_en2cn", client.Credentials.Token!);
|
||||
|
||||
return await client.SendRequestWithUrlEncodedAsync<Models.NLPTranslateEnglish2ChineseResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /nlp/translate_cn2en/{TOKEN} 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/platform/nlp/translate.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.NLPTranslateChinese2EnglishResponse> ExecuteNLPTranslateChinese2EnglishAsync(this WechatOpenAIClient client, Models.NLPTranslateChinese2EnglishRequest 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, "nlp", "translate_cn2en", client.Credentials.Token!);
|
||||
|
||||
return await client.SendRequestWithUrlEncodedAsync<Models.NLPTranslateChinese2EnglishResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /nlp/get_similar_query/{TOKEN} 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/platform/nlp/similar_recommend.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.NLPGetSimilarQueryResponse> ExecuteNLPGetSimilarQueryAsync(this WechatOpenAIClient client, Models.NLPGetSimilarQueryRequest 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, "nlp", "get_similar_query", client.Credentials.Token!);
|
||||
|
||||
return await client.SendRequestWithUrlEncodedAsync<Models.NLPGetSimilarQueryResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /nlp/news-abstraction/{TOKEN} 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/platform/nlp/summarize.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.NLPNewsAbstractionResponse> ExecuteNLPNewsAbstractionAsync(this WechatOpenAIClient client, Models.NLPNewsAbstractionRequest 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, "nlp", "news-abstraction", client.Credentials.Token!);
|
||||
|
||||
return await client.SendRequestWithUrlEncodedAsync<Models.NLPNewsAbstractionResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /nlp/document_classify/{TOKEN} 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/platform/nlp/summarize.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.NLPDocumentClassifyResponse> ExecuteNLPDocumentClassifyAsync(this WechatOpenAIClient client, Models.NLPDocumentClassifyRequest 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, "nlp", "document_classify", client.Credentials.Token!);
|
||||
|
||||
return await client.SendRequestWithUrlEncodedAsync<Models.NLPDocumentClassifyResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /nlp/recommend_questions/{TOKEN} 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/aispeech/platform/nlp/rec_chat.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.NLPRecommendQuestionsResponse> ExecuteNLPRecommendQuestionsAsync(this WechatOpenAIClient client, Models.NLPRecommendQuestionsRequest 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, "nlp", "recommend_questions", client.Credentials.Token!);
|
||||
|
||||
return await client.SendRequestWithUrlEncodedAsync<Models.NLPRecommendQuestionsResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
@@ -28,14 +28,14 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <summary>
|
||||
/// 获取或设置相似问题列表。
|
||||
/// </summary>
|
||||
[XmlElement("question")]
|
||||
public List<string> QuestionList { get; set; } = new List<string>();
|
||||
[XmlElement("question", Type = typeof(string))]
|
||||
public IList<string> QuestionList { get; set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置机器人回答列表。
|
||||
/// </summary>
|
||||
[XmlElement("answer")]
|
||||
public List<string> AnswerList { get; set; } = new List<string>();
|
||||
[XmlElement("answer", Type = typeof(string))]
|
||||
public IList<string> AnswerList { get; set; } = new List<string>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <summary>
|
||||
/// 获取或设置技能列表。
|
||||
/// </summary>
|
||||
[XmlElement("skill")]
|
||||
public List<Types.Skill> SkillList { get; set; } = new List<Types.Skill>();
|
||||
[XmlElement("skill", Type = typeof(Types.Skill))]
|
||||
public IList<Types.Skill> SkillList { get; set; } = new List<Types.Skill>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /batchimportskill/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class BatchImportSkillResponse : WechatOpenAIResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("code")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("code")]
|
||||
public override int? ReturnCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取微信智能对话 API 返回的错误描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("msg")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("msg")]
|
||||
public string? ReturnMessage { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
@@ -38,6 +38,6 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// </summary>
|
||||
[XmlArray("list")]
|
||||
[XmlArrayItem("openid", Type = typeof(string))]
|
||||
public List<string> OpenIdList { get; set; } = new List<string>();
|
||||
public IList<string> OpenIdList { get; set; } = new List<string>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /label/batchset/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class LabelBatchSetResponse : WechatOpenAIResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("code")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("code")]
|
||||
public override int? ReturnCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取微信智能对话 API 返回的错误描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("msg")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("msg")]
|
||||
public string? ReturnMessage { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /publish_progress/{TOKEN} 接口的响应。</para>
|
||||
@@ -24,5 +24,19 @@
|
||||
public int Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("code")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("code")]
|
||||
public override int? ReturnCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取微信智能对话 API 返回的错误描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("msg")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("msg")]
|
||||
public string? ReturnMessage { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /publish/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class PublishResponse : WechatOpenAIResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("code")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("code")]
|
||||
public override int? ReturnCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取微信智能对话 API 返回的错误描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("msg")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("msg")]
|
||||
public string? ReturnMessage { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
@@ -38,6 +38,6 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// </summary>
|
||||
[XmlArray("list")]
|
||||
[XmlArrayItem("question", Type = typeof(string))]
|
||||
public List<string> QuestionList { get; set; } = new List<string>();
|
||||
public IList<string> QuestionList { get; set; } = new List<string>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /setautoreply/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class SetAutoReplyResponse : WechatOpenAIResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("code")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("code")]
|
||||
public override int? ReturnCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取微信智能对话 API 返回的错误描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("msg")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("msg")]
|
||||
public string? ReturnMessage { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,13 +78,13 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("code")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("code")]
|
||||
public override int? ErrorCode { get; set; }
|
||||
public override int? ReturnCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
/// 获取微信智能对话 API 返回的错误描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("msg")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("msg")]
|
||||
public override string? ErrorMessage { get; set; }
|
||||
public string? ReturnMessage { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,13 +119,13 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("code")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("code")]
|
||||
public override int? ErrorCode { get; set; }
|
||||
public override int? ReturnCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
/// 获取微信智能对话 API 返回的错误描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("msg")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("msg")]
|
||||
public override string? ErrorMessage { get; set; }
|
||||
public string? ReturnMessage { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /batchreply/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
[XmlRoot("xml")]
|
||||
public class BatchReplyRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置直播 ID。
|
||||
/// </summary>
|
||||
[XmlElement("liveid")]
|
||||
public string LiveId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置回复内容。
|
||||
/// </summary>
|
||||
[XmlElement("content")]
|
||||
public string Content { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置希望展示给用户的客服人员的名字。
|
||||
/// </summary>
|
||||
[XmlElement("waitername", IsNullable = true)]
|
||||
public string? WaiterName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置客希望展示给用户的客服人员的头像 URL。
|
||||
/// </summary>
|
||||
[XmlElement("waiteravatar", IsNullable = true)]
|
||||
public string? WaiterAvatarUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置要设置标签的 OpenId 列表。
|
||||
/// </summary>
|
||||
[XmlArray("list")]
|
||||
[XmlArrayItem("openid", Type = typeof(string))]
|
||||
public List<string> OpenIdList { get; set; } = new List<string>();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /batchreply/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class BatchReplyResponse : WechatOpenAIResponse
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /generatereport/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
[XmlRoot("xml")]
|
||||
public class GenerateReportRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置直播 ID。
|
||||
/// </summary>
|
||||
[XmlElement("liveid")]
|
||||
public string LiveId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置房间 ID。
|
||||
/// </summary>
|
||||
[XmlElement("bucket")]
|
||||
public string Bucket { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /generatereport/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class GenerateReportResponse : WechatOpenAIResponse
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/document_classify/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class NLPDocumentClassifyRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedUrlEncoded
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Data
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置文章标题。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("title")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("title")]
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置文章正文内容。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("content")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("content")]
|
||||
public string Content { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("uid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("uid")]
|
||||
public string UserId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置请求数据。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("data")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("data")]
|
||||
public Types.Data Data { get; set; } = new Types.Data();
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/document_classify/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class NLPDocumentClassifyResponse : WechatOpenAIResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Result
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置一级分类结果。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("level1_cls")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("level1_cls")]
|
||||
public string Level1Classification { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置二级分类结果。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("level2_cls")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("level2_cls")]
|
||||
public string Level2Classification { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置三级分类结果。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("level3_cls")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("level3_cls")]
|
||||
public string Level3lassification { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置文章分类的结果。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("preds")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("preds")]
|
||||
public Types.Result Result { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/get_similar_query/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class NLPGetSimilarQueryRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedUrlEncoded
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Data
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置输入文本。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("query")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("query")]
|
||||
public string QueryString { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("uid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("uid")]
|
||||
public string UserId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置请求数据。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("data")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("data")]
|
||||
public Types.Data Data { get; set; } = new Types.Data();
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/get_similar_query/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class NLPGetSimilarQueryResponse : WechatOpenAIResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Result
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置相似问题信息项。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("question")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("question")]
|
||||
public string Sentiment { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置分值(范围:0~1)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("score")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("score")]
|
||||
public double Score { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置来源。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("source")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("source")]
|
||||
public string Source { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置结果。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("data")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("data")]
|
||||
public Types.Result[] ResultList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置耗时(单位:毫秒)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("costime")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("costime")]
|
||||
public int CostTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/ner-product/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class NLPNERProductRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedUrlEncoded
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Data
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置输入文本。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("q")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("q")]
|
||||
public string QueryString { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("uid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("uid")]
|
||||
public string UserId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置请求数据。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("data")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("data")]
|
||||
public Types.Data Data { get; set; } = new Types.Data();
|
||||
}
|
||||
}
|
||||
@@ -1,254 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/ner-product/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class NLPNERProductResponse : WechatOpenAIResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Result
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class ProductProperty
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置商品属性名。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string Name { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品属性值。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string Value { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置起始字符位置。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public int StartIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置结束字符位置。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public int EndIndex { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置结果。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("product")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Converters.ResponsePropertyProductPropertyArrayNewtonsoftJsonConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("product")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(Converters.ResponsePropertyProductPropertyArraySystemTextJsonConverter))]
|
||||
public Types.ProductProperty[] ProductPropertyList { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
internal static class Converters
|
||||
{
|
||||
internal class ResponsePropertyProductPropertyArrayNewtonsoftJsonConverter : Newtonsoft.Json.JsonConverter<Types.Result.Types.ProductProperty[]?>
|
||||
{
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override Types.Result.Types.ProductProperty[]? ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, Types.Result.Types.ProductProperty[]? existingValue, bool hasExistingValue, Newtonsoft.Json.JsonSerializer serializer)
|
||||
{
|
||||
if (reader.TokenType == Newtonsoft.Json.JsonToken.Null)
|
||||
{
|
||||
return existingValue;
|
||||
}
|
||||
else if (reader.TokenType == Newtonsoft.Json.JsonToken.StartArray)
|
||||
{
|
||||
reader.Read();
|
||||
|
||||
var tmpList = new List<Types.Result.Types.ProductProperty>();
|
||||
|
||||
while (reader.TokenType != Newtonsoft.Json.JsonToken.EndArray)
|
||||
{
|
||||
if (reader.TokenType == Newtonsoft.Json.JsonToken.StartArray)
|
||||
{
|
||||
reader.Read();
|
||||
|
||||
int offset = 0;
|
||||
var tmpItem = new Types.Result.Types.ProductProperty();
|
||||
|
||||
while (reader.TokenType != Newtonsoft.Json.JsonToken.EndArray)
|
||||
{
|
||||
if (offset == 0)
|
||||
{
|
||||
tmpItem.Value = serializer.Deserialize<string>(reader)!;
|
||||
}
|
||||
else if (offset == 1)
|
||||
{
|
||||
tmpItem.Name = serializer.Deserialize<string>(reader)!;
|
||||
}
|
||||
else if (offset == 2)
|
||||
{
|
||||
tmpItem.StartIndex = serializer.Deserialize<int>(reader);
|
||||
}
|
||||
else if (offset == 3)
|
||||
{
|
||||
tmpItem.EndIndex = serializer.Deserialize<int>(reader);
|
||||
}
|
||||
|
||||
offset++;
|
||||
reader.Read();
|
||||
}
|
||||
|
||||
tmpList.Add(tmpItem);
|
||||
}
|
||||
|
||||
reader.Read();
|
||||
}
|
||||
|
||||
return tmpList.ToArray();
|
||||
}
|
||||
|
||||
throw new Newtonsoft.Json.JsonReaderException();
|
||||
}
|
||||
|
||||
public override void WriteJson(Newtonsoft.Json.JsonWriter writer, Types.Result.Types.ProductProperty[]? value, Newtonsoft.Json.JsonSerializer serializer)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
writer.WriteStartArray();
|
||||
|
||||
foreach (var item in value)
|
||||
{
|
||||
writer.WriteStartArray();
|
||||
writer.WriteValue(item.Value);
|
||||
writer.WriteValue(item.Name);
|
||||
writer.WriteValue(item.StartIndex);
|
||||
writer.WriteValue(item.EndIndex);
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteNull();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class ResponsePropertyProductPropertyArraySystemTextJsonConverter : System.Text.Json.Serialization.JsonConverter<Types.Result.Types.ProductProperty[]?>
|
||||
{
|
||||
public override Types.Result.Types.ProductProperty[]? Read(ref System.Text.Json.Utf8JsonReader reader, Type typeToConvert, System.Text.Json.JsonSerializerOptions options)
|
||||
{
|
||||
if (reader.TokenType == System.Text.Json.JsonTokenType.Null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if (reader.TokenType == System.Text.Json.JsonTokenType.StartArray)
|
||||
{
|
||||
reader.Read();
|
||||
|
||||
var tmpList = new List<Types.Result.Types.ProductProperty>();
|
||||
var tmpOptions = new System.Text.Json.JsonSerializerOptions(options);
|
||||
|
||||
while (reader.TokenType != System.Text.Json.JsonTokenType.EndArray)
|
||||
{
|
||||
if (reader.TokenType == System.Text.Json.JsonTokenType.StartArray)
|
||||
{
|
||||
reader.Read();
|
||||
|
||||
int offset = 0;
|
||||
var tmpItem = new Types.Result.Types.ProductProperty();
|
||||
|
||||
while (reader.TokenType != System.Text.Json.JsonTokenType.EndArray)
|
||||
{
|
||||
if (offset == 0)
|
||||
{
|
||||
tmpItem.Value = System.Text.Json.JsonSerializer.Deserialize<string>(ref reader, tmpOptions)!;
|
||||
}
|
||||
else if (offset == 1)
|
||||
{
|
||||
tmpItem.Name = System.Text.Json.JsonSerializer.Deserialize<string>(ref reader, tmpOptions)!;
|
||||
}
|
||||
else if (offset == 2)
|
||||
{
|
||||
tmpItem.StartIndex = System.Text.Json.JsonSerializer.Deserialize<int>(ref reader, tmpOptions);
|
||||
}
|
||||
else if (offset == 3)
|
||||
{
|
||||
tmpItem.EndIndex = System.Text.Json.JsonSerializer.Deserialize<int>(ref reader, tmpOptions);
|
||||
}
|
||||
|
||||
offset++;
|
||||
reader.Read();
|
||||
}
|
||||
|
||||
tmpList.Add(tmpItem);
|
||||
}
|
||||
|
||||
reader.Read();
|
||||
}
|
||||
|
||||
return tmpList.ToArray();
|
||||
}
|
||||
|
||||
throw new System.Text.Json.JsonException();
|
||||
}
|
||||
|
||||
public override void Write(System.Text.Json.Utf8JsonWriter writer, Types.Result.Types.ProductProperty[]? value, System.Text.Json.JsonSerializerOptions options)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
writer.WriteStartArray();
|
||||
|
||||
foreach (var item in value)
|
||||
{
|
||||
writer.WriteStartArray();
|
||||
writer.WriteStringValue(item.Value);
|
||||
writer.WriteStringValue(item.Name);
|
||||
writer.WriteNumberValue(item.StartIndex);
|
||||
writer.WriteNumberValue(item.EndIndex);
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteNullValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置预处理后的文本。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("preprocessed_text")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("preprocessed_text")]
|
||||
public string PreprocessedText { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置抽取结果信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("entities")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("entities")]
|
||||
public Types.Result Result { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/ner/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class NLPNERRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedUrlEncoded
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Data
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置输入文本。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("q")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("q")]
|
||||
public string QueryString { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("uid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("uid")]
|
||||
public string UserId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置请求数据。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("data")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("data")]
|
||||
public Types.Data Data { get; set; } = new Types.Data();
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/ner/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class NLPNERResponse : WechatOpenAIResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Result
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置结果类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("type")]
|
||||
public string Type { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置范围列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("span")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("span")]
|
||||
public int[] SpanList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置文本。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("text")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("text")]
|
||||
public string Text { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置范数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("norm")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("norm")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.DynamicObjectConverter))]
|
||||
public dynamic Norm { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置结果。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("result")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("result")]
|
||||
public Types.Result[] ResultList { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/news-abstraction/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class NLPNewsAbstractionRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedUrlEncoded
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Data
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置新闻标题。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("title")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("title")]
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置新闻正文内容。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("content")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("content")]
|
||||
public string Content { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置新闻所属的一级类别标签。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("category")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("category")]
|
||||
public string? Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否在提取摘要前先进行新闻分类标志。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("do_news_classify")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("do_news_classify")]
|
||||
public bool? RequireDoNewsClassify { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("uid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("uid")]
|
||||
public string UserId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置请求数据。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("data")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("data")]
|
||||
public Types.Data Data { get; set; } = new Types.Data();
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/news-abstraction/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class NLPNewsAbstractionResponse : WechatOpenAIResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置摘要提取的结果。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("abstraction")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("abstraction")]
|
||||
public string Result { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否适合提取摘要的分类标签。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("classification")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("classification")]
|
||||
public bool HasClassification { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置分值(范围:0~1)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("prob")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("prob")]
|
||||
public double Score { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/rank/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class NLPRankRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedUrlEncoded
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Data
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Candidate
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置候选词。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("text")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("text")]
|
||||
public string Text { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置输入文本。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("query")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("query")]
|
||||
public string QueryString { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置候选词列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("candidates")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("candidates")]
|
||||
public IList<Types.Candidate> CandidateList { get; set; } = new List<Types.Candidate>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("uid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("uid")]
|
||||
public string UserId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置请求数据。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("data")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("data")]
|
||||
public Types.Data Data { get; set; } = new Types.Data();
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/rank/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class NLPRankResponse : WechatOpenAIResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Result
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置候选词信息项。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("question")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("question")]
|
||||
public string Sentiment { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置分值(范围:0~1)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("score")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("score")]
|
||||
public double Score { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置结果。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("results")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("results")]
|
||||
public Types.Result[] ResultList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否有 Exact Match 候选。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("exact_match")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("exact_match")]
|
||||
public bool HasExactMatch { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/recommend_questions/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class NLPRecommendQuestionsRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedUrlEncoded
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Data
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("uid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("uid")]
|
||||
public string UserId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置请求数据。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("data")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("data")]
|
||||
public Types.Data Data { get; set; } = new Types.Data();
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/recommend_questions/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class NLPRecommendQuestionsResponse : WechatOpenAIResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置推荐的结果。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("results")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("results")]
|
||||
public string[] ResultList { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/sensitive/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class NLPSensitiveRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedUrlEncoded
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Data
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置输入文本。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("q")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("q")]
|
||||
public string QueryString { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置模型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("model")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("model")]
|
||||
public string? Model { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("uid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("uid")]
|
||||
public string UserId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置请求数据。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("data")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("data")]
|
||||
public Types.Data Data { get; set; } = new Types.Data();
|
||||
}
|
||||
}
|
||||
@@ -1,200 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/sensitive/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class NLPSensitiveResponse : WechatOpenAIResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Result
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置敏感信息项。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string Sensitive { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置分值(范围:0~1)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public double Score { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
internal static class Converters
|
||||
{
|
||||
internal class ResponsePropertyResultArrayNewtonsoftJsonConverter : Newtonsoft.Json.JsonConverter<Types.Result[]?>
|
||||
{
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override Types.Result[]? ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, Types.Result[]? existingValue, bool hasExistingValue, Newtonsoft.Json.JsonSerializer serializer)
|
||||
{
|
||||
if (reader.TokenType == Newtonsoft.Json.JsonToken.Null)
|
||||
{
|
||||
return existingValue;
|
||||
}
|
||||
else if (reader.TokenType == Newtonsoft.Json.JsonToken.StartArray)
|
||||
{
|
||||
reader.Read();
|
||||
|
||||
var tmpList = new List<Types.Result>();
|
||||
|
||||
while (reader.TokenType != Newtonsoft.Json.JsonToken.EndArray)
|
||||
{
|
||||
if (reader.TokenType == Newtonsoft.Json.JsonToken.StartArray)
|
||||
{
|
||||
reader.Read();
|
||||
|
||||
int offset = 0;
|
||||
var tmpItem = new Types.Result();
|
||||
|
||||
while (reader.TokenType != Newtonsoft.Json.JsonToken.EndArray)
|
||||
{
|
||||
if (offset == 0)
|
||||
{
|
||||
tmpItem.Sensitive = serializer.Deserialize<string>(reader)!;
|
||||
}
|
||||
else if (offset == 1)
|
||||
{
|
||||
tmpItem.Score = serializer.Deserialize<double>(reader);
|
||||
}
|
||||
|
||||
offset++;
|
||||
reader.Read();
|
||||
}
|
||||
|
||||
tmpList.Add(tmpItem);
|
||||
}
|
||||
|
||||
reader.Read();
|
||||
}
|
||||
|
||||
return tmpList.ToArray();
|
||||
}
|
||||
|
||||
throw new Newtonsoft.Json.JsonReaderException();
|
||||
}
|
||||
|
||||
public override void WriteJson(Newtonsoft.Json.JsonWriter writer, Types.Result[]? value, Newtonsoft.Json.JsonSerializer serializer)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
writer.WriteStartArray();
|
||||
|
||||
foreach (var item in value)
|
||||
{
|
||||
writer.WriteStartArray();
|
||||
writer.WriteValue(item.Sensitive);
|
||||
writer.WriteValue(item.Score);
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteNull();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class ResponsePropertyResultArraySystemTextJsonConverter : System.Text.Json.Serialization.JsonConverter<Types.Result[]?>
|
||||
{
|
||||
public override Types.Result[]? Read(ref System.Text.Json.Utf8JsonReader reader, Type typeToConvert, System.Text.Json.JsonSerializerOptions options)
|
||||
{
|
||||
if (reader.TokenType == System.Text.Json.JsonTokenType.Null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if (reader.TokenType == System.Text.Json.JsonTokenType.StartArray)
|
||||
{
|
||||
reader.Read();
|
||||
|
||||
var tmpList = new List<Types.Result>();
|
||||
var tmpOptions = new System.Text.Json.JsonSerializerOptions(options);
|
||||
|
||||
while (reader.TokenType != System.Text.Json.JsonTokenType.EndArray)
|
||||
{
|
||||
if (reader.TokenType == System.Text.Json.JsonTokenType.StartArray)
|
||||
{
|
||||
reader.Read();
|
||||
|
||||
int offset = 0;
|
||||
var tmpItem = new Types.Result();
|
||||
|
||||
while (reader.TokenType != System.Text.Json.JsonTokenType.EndArray)
|
||||
{
|
||||
if (offset == 0)
|
||||
{
|
||||
tmpItem.Sensitive = System.Text.Json.JsonSerializer.Deserialize<string>(ref reader, tmpOptions)!;
|
||||
}
|
||||
else if (offset == 1)
|
||||
{
|
||||
tmpItem.Score = System.Text.Json.JsonSerializer.Deserialize<double>(ref reader, tmpOptions);
|
||||
}
|
||||
|
||||
offset++;
|
||||
reader.Read();
|
||||
}
|
||||
|
||||
tmpList.Add(tmpItem);
|
||||
}
|
||||
|
||||
reader.Read();
|
||||
}
|
||||
|
||||
return tmpList.ToArray();
|
||||
}
|
||||
|
||||
throw new System.Text.Json.JsonException();
|
||||
}
|
||||
|
||||
public override void Write(System.Text.Json.Utf8JsonWriter writer, Types.Result[]? value, System.Text.Json.JsonSerializerOptions options)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
writer.WriteStartArray();
|
||||
|
||||
foreach (var item in value)
|
||||
{
|
||||
writer.WriteStartArray();
|
||||
writer.WriteStringValue(item.Sensitive);
|
||||
writer.WriteNumberValue(item.Score);
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteNullValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置结果。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("result")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Converters.ResponsePropertyResultArrayNewtonsoftJsonConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("result")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(Converters.ResponsePropertyResultArraySystemTextJsonConverter))]
|
||||
public Types.Result[] ResultList { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/sentiment/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class NLPSentimentRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedUrlEncoded
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Data
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置输入文本。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("q")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("q")]
|
||||
public string QueryString { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置模式。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("mode")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("mode")]
|
||||
public string? Mode { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("uid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("uid")]
|
||||
public string UserId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置请求数据。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("data")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("data")]
|
||||
public Types.Data Data { get; set; } = new Types.Data();
|
||||
}
|
||||
}
|
||||
@@ -1,200 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/sentiment/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class NLPSentimentResponse : WechatOpenAIResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Result
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置情感信息项。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string Sentiment { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置分值(范围:0~1)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public double Score { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
internal static class Converters
|
||||
{
|
||||
internal class ResponsePropertyResultArrayNewtonsoftJsonConverter : Newtonsoft.Json.JsonConverter<Types.Result[]?>
|
||||
{
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override Types.Result[]? ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, Types.Result[]? existingValue, bool hasExistingValue, Newtonsoft.Json.JsonSerializer serializer)
|
||||
{
|
||||
if (reader.TokenType == Newtonsoft.Json.JsonToken.Null)
|
||||
{
|
||||
return existingValue;
|
||||
}
|
||||
else if (reader.TokenType == Newtonsoft.Json.JsonToken.StartArray)
|
||||
{
|
||||
reader.Read();
|
||||
|
||||
var tmpList = new List<Types.Result>();
|
||||
|
||||
while (reader.TokenType != Newtonsoft.Json.JsonToken.EndArray)
|
||||
{
|
||||
if (reader.TokenType == Newtonsoft.Json.JsonToken.StartArray)
|
||||
{
|
||||
reader.Read();
|
||||
|
||||
int offset = 0;
|
||||
var tmpItem = new Types.Result();
|
||||
|
||||
while (reader.TokenType != Newtonsoft.Json.JsonToken.EndArray)
|
||||
{
|
||||
if (offset == 0)
|
||||
{
|
||||
tmpItem.Sentiment = serializer.Deserialize<string>(reader)!;
|
||||
}
|
||||
else if (offset == 1)
|
||||
{
|
||||
tmpItem.Score = serializer.Deserialize<double>(reader);
|
||||
}
|
||||
|
||||
offset++;
|
||||
reader.Read();
|
||||
}
|
||||
|
||||
tmpList.Add(tmpItem);
|
||||
}
|
||||
|
||||
reader.Read();
|
||||
}
|
||||
|
||||
return tmpList.ToArray();
|
||||
}
|
||||
|
||||
throw new Newtonsoft.Json.JsonReaderException();
|
||||
}
|
||||
|
||||
public override void WriteJson(Newtonsoft.Json.JsonWriter writer, Types.Result[]? value, Newtonsoft.Json.JsonSerializer serializer)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
writer.WriteStartArray();
|
||||
|
||||
foreach (var item in value)
|
||||
{
|
||||
writer.WriteStartArray();
|
||||
writer.WriteValue(item.Sentiment);
|
||||
writer.WriteValue(item.Score);
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteNull();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class ResponsePropertyResultArraySystemTextJsonConverter : System.Text.Json.Serialization.JsonConverter<Types.Result[]?>
|
||||
{
|
||||
public override Types.Result[]? Read(ref System.Text.Json.Utf8JsonReader reader, Type typeToConvert, System.Text.Json.JsonSerializerOptions options)
|
||||
{
|
||||
if (reader.TokenType == System.Text.Json.JsonTokenType.Null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if (reader.TokenType == System.Text.Json.JsonTokenType.StartArray)
|
||||
{
|
||||
reader.Read();
|
||||
|
||||
var tmpList = new List<Types.Result>();
|
||||
var tmpOptions = new System.Text.Json.JsonSerializerOptions(options);
|
||||
|
||||
while (reader.TokenType != System.Text.Json.JsonTokenType.EndArray)
|
||||
{
|
||||
if (reader.TokenType == System.Text.Json.JsonTokenType.StartArray)
|
||||
{
|
||||
reader.Read();
|
||||
|
||||
int offset = 0;
|
||||
var tmpItem = new Types.Result();
|
||||
|
||||
while (reader.TokenType != System.Text.Json.JsonTokenType.EndArray)
|
||||
{
|
||||
if (offset == 0)
|
||||
{
|
||||
tmpItem.Sentiment = System.Text.Json.JsonSerializer.Deserialize<string>(ref reader, tmpOptions)!;
|
||||
}
|
||||
else if (offset == 1)
|
||||
{
|
||||
tmpItem.Score = System.Text.Json.JsonSerializer.Deserialize<double>(ref reader, tmpOptions);
|
||||
}
|
||||
|
||||
offset++;
|
||||
reader.Read();
|
||||
}
|
||||
|
||||
tmpList.Add(tmpItem);
|
||||
}
|
||||
|
||||
reader.Read();
|
||||
}
|
||||
|
||||
return tmpList.ToArray();
|
||||
}
|
||||
|
||||
throw new System.Text.Json.JsonException();
|
||||
}
|
||||
|
||||
public override void Write(System.Text.Json.Utf8JsonWriter writer, Types.Result[]? value, System.Text.Json.JsonSerializerOptions options)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
writer.WriteStartArray();
|
||||
|
||||
foreach (var item in value)
|
||||
{
|
||||
writer.WriteStartArray();
|
||||
writer.WriteStringValue(item.Sentiment);
|
||||
writer.WriteNumberValue(item.Score);
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteNullValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置结果。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("result")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Converters.ResponsePropertyResultArrayNewtonsoftJsonConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("result")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(Converters.ResponsePropertyResultArraySystemTextJsonConverter))]
|
||||
public Types.Result[] ResultList { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/tokenize/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class NLPTokenizeRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedUrlEncoded
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Data
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置输入文本。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("q")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("q")]
|
||||
public string QueryString { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("uid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("uid")]
|
||||
public string UserId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置请求数据。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("data")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("data")]
|
||||
public Types.Data Data { get; set; } = new Types.Data();
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/tokenize/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class NLPTokenizeResponse : WechatOpenAIResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置常规粒度分词结果列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("words")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("words")]
|
||||
public string[] WordList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置常规粒度词性标签列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("POSs")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("POSs")]
|
||||
public int[] POSList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置混合粒度分词结果列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("words_mix")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("words_mix")]
|
||||
public string[] WordMixList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置混合粒度词性标签列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("POSs_mix")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("POSs_mix")]
|
||||
public int[] POSMixList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置短语提取结果列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("entities")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("entities")]
|
||||
public string[] EntityList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置短语类型标签列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("entity_types")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("entity_types")]
|
||||
public int[] EntityTypeList { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/translate_cn2en/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class NLPTranslateChinese2EnglishRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedUrlEncoded
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Data
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置输入文本。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("q")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("q")]
|
||||
public string QueryString { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("uid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("uid")]
|
||||
public string UserId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置请求数据。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("data")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("data")]
|
||||
public Types.Data Data { get; set; } = new Types.Data();
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/translate_cn2en/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class NLPTranslateChinese2EnglishResponse : WechatOpenAIResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置结果。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("result")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("result")]
|
||||
public string Result { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/translate_en2cn/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class NLPTranslateEnglish2ChineseRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedUrlEncoded
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Data
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置输入文本。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("q")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("q")]
|
||||
public string QueryString { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("uid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("uid")]
|
||||
public string UserId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置请求数据。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("data")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("data")]
|
||||
public Types.Data Data { get; set; } = new Types.Data();
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /nlp/translate_en2cn/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class NLPTranslateEnglish2ChineseResponse : WechatOpenAIResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置结果。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("result")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("result")]
|
||||
public string Result { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// 获取或设置客服接入状态。
|
||||
/// </summary>
|
||||
[XmlElement("kefustate")]
|
||||
public string State { get; set; } = string.Empty;
|
||||
public string KfState { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置有效期(单位:秒)。
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("kefustate")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("kefustate")]
|
||||
public string State { get; set; } = default!;
|
||||
public string KfState { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置人工客服接入状态。
|
||||
|
||||
Reference in New Issue
Block a user