|
@@ -21,9 +21,18 @@ namespace PDF_Master.Helper
|
|
|
{
|
|
|
public static class ChatGTPAIHelper
|
|
|
{
|
|
|
+#if DEBUG
|
|
|
+ //测试环境
|
|
|
+ //纠错重写
|
|
|
private static string host = "https://ai.compdf.com";
|
|
|
-
|
|
|
+ //百度翻译
|
|
|
private static string translate = "http://101.132.103.13:8030";
|
|
|
+#else
|
|
|
+ //纠错重写
|
|
|
+ private static string host ="http://prod-cn.your-api-server.com";
|
|
|
+ //百度翻译
|
|
|
+ private static string translate ="https://api-server.compdf.com";
|
|
|
+#endif
|
|
|
|
|
|
/// <summary>
|
|
|
/// 翻译文档Key接口
|
|
@@ -40,21 +49,6 @@ namespace PDF_Master.Helper
|
|
|
/// </summary>
|
|
|
private static string Uri_texttranslate = translate + "/v1/translate/textTrans";
|
|
|
|
|
|
- ///// <summary>
|
|
|
- ///// FAQ接口
|
|
|
- ///// </summary>
|
|
|
- //private static string Uri_FAQ = host + "/find-faq";
|
|
|
-
|
|
|
- ///// <summary>
|
|
|
- ///// 跳转接口
|
|
|
- ///// </summary>
|
|
|
- //private static string Uri_GoToView = host + "/recognition";
|
|
|
-
|
|
|
- ///// <summary>
|
|
|
- ///// 摘要接口
|
|
|
- ///// </summary>
|
|
|
- //private static string Uri_Summary = host + "/summary";
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 错别字纠正
|
|
|
/// </summary>
|
|
@@ -65,6 +59,8 @@ namespace PDF_Master.Helper
|
|
|
/// </summary>
|
|
|
private static string Uri_Rewrite = host + "/api/rewrite";
|
|
|
|
|
|
+
|
|
|
+ #region AI服务器对接接口
|
|
|
/// <summary>
|
|
|
/// 翻译指定内容,可以指定语言
|
|
|
/// </summary>
|
|
@@ -349,7 +345,7 @@ namespace PDF_Master.Helper
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- namevalue["user_id"] = "3";
|
|
|
+ namevalue["user_id"] = "1";
|
|
|
}
|
|
|
namevalue["content"] = content;
|
|
|
return await PostString(Uri_Correction, namevalue, "content");
|
|
@@ -372,26 +368,12 @@ namespace PDF_Master.Helper
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- namevalue["user_id"] = "3";
|
|
|
+ namevalue["user_id"] = "1";
|
|
|
}
|
|
|
namevalue["content"] = content;
|
|
|
return await PostString(Uri_Rewrite, namevalue, "content");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- ///// <summary>
|
|
|
- ///// 页面跳转
|
|
|
- ///// </summary>
|
|
|
- ///// <param name="content"></param>
|
|
|
- ///// <returns></returns>
|
|
|
- //public async static Task<string> GoToView(string content)
|
|
|
- //{
|
|
|
- // System.Collections.Specialized.NameValueCollection namevalue = new System.Collections.Specialized.NameValueCollection();
|
|
|
- // //需要翻译的内容
|
|
|
- // namevalue["str"] = content;
|
|
|
- // return await PostString(Uri_GoToView, namevalue, "flag");
|
|
|
- //}
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 从链接中返回存在的链接(仅返回第一个找到的链接)
|
|
|
/// </summary>
|
|
@@ -452,7 +434,9 @@ namespace PDF_Master.Helper
|
|
|
}
|
|
|
return repsonseData;
|
|
|
}
|
|
|
+ #endregion
|
|
|
|
|
|
+ #region 支持翻译的语言
|
|
|
public static List<string> FromlanguageFamily { set; get; } = new List<string>();
|
|
|
public static List<string> SetFromlanguageOrigin()
|
|
|
{
|
|
@@ -579,6 +563,7 @@ namespace PDF_Master.Helper
|
|
|
return"";
|
|
|
}
|
|
|
}
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|
|
|
|