Commit 047eab17 authored by 吴春's avatar 吴春

1

parent 579d8299
...@@ -48,6 +48,10 @@ namespace Edu.Model.Entity.AI ...@@ -48,6 +48,10 @@ namespace Edu.Model.Entity.AI
/// </summary> /// </summary>
public DateTime CreateTime { get; set; } public DateTime CreateTime { get; set; }
/// <summary>
/// 关键字类型
/// </summary>
public int KeyWordType { get; set; }
/// <summary> /// <summary>
/// 学校Id /// 学校Id
...@@ -64,6 +68,15 @@ namespace Edu.Model.Entity.AI ...@@ -64,6 +68,15 @@ namespace Edu.Model.Entity.AI
/// </summary> /// </summary>
public DateStateEnum Status { get; set; } public DateStateEnum Status { get; set; }
/// <summary>
/// 图片/关键字信息
/// </summary>
public string KeyWord { get; set; }
/// <summary>
/// 返回结果信息
/// </summary>
public string ResultInfo { get; set; }
} }
} }
...@@ -155,6 +155,8 @@ namespace Edu.WebApi.Controllers.AI ...@@ -155,6 +155,8 @@ namespace Edu.WebApi.Controllers.AI
userLogModel.SupplierId = applocationModel.SupplierId; userLogModel.SupplierId = applocationModel.SupplierId;
userLogModel.TokenNum = ""; userLogModel.TokenNum = "";
userLogModel.Charging = ""; userLogModel.Charging = "";
userLogModel.KeyWord = keyWord;
userLogModel.KeyWordType = Type;
userLogModel.Status = Common.Enum.DateStateEnum.Normal; userLogModel.Status = Common.Enum.DateStateEnum.Normal;
if ((supplierModel?.ID ?? 0) == 0) if ((supplierModel?.ID ?? 0) == 0)
{ {
...@@ -185,6 +187,7 @@ namespace Edu.WebApi.Controllers.AI ...@@ -185,6 +187,7 @@ namespace Edu.WebApi.Controllers.AI
string postUrl = ""; string postUrl = "";
if (Type == 1 || Type == 3)//1-英语作文批改(图像识别) if (Type == 1 || Type == 3)//1-英语作文批改(图像识别)
{ {
userLogModel.KeyWord = imgUrl;
userLogModel.Charging = "0.13(元/次)"; userLogModel.Charging = "0.13(元/次)";
postUrl = (Type == 1 ? "https://openapi.youdao.com/v2/correct_writing_image" : "https://openapi.youdao.com/correct_writing_cn_image"); postUrl = (Type == 1 ? "https://openapi.youdao.com/v2/correct_writing_image" : "https://openapi.youdao.com/correct_writing_cn_image");
...@@ -216,6 +219,7 @@ namespace Edu.WebApi.Controllers.AI ...@@ -216,6 +219,7 @@ namespace Edu.WebApi.Controllers.AI
JObject jsonObject = JObject.Parse(resStr); JObject jsonObject = JObject.Parse(resStr);
if (jsonObject.GetStringValue("errorCode") == "0") if (jsonObject.GetStringValue("errorCode") == "0")
{ {
userLogModel.ResultInfo = resStr;
int addId = aiModule.SetAIUseLogModule(userLogModel); int addId = aiModule.SetAIUseLogModule(userLogModel);
// Task.Run(() => { }); // Task.Run(() => { });
return ApiResult.Success(data: new { result = resStr, Id = addId }); return ApiResult.Success(data: new { result = resStr, Id = addId });
...@@ -272,12 +276,6 @@ namespace Edu.WebApi.Controllers.AI ...@@ -272,12 +276,6 @@ namespace Edu.WebApi.Controllers.AI
{ {
Common.Plugin.LogHelper.Write(ex, "GetUserLoginInfo"); Common.Plugin.LogHelper.Write(ex, "GetUserLoginInfo");
} }
//foreach (var item in result.Result.Completions)
//{
// answer = item.Text;
//}
} }
return ApiResult.Success(data: new { result = resultModel, Id = addId }); return ApiResult.Success(data: new { result = resultModel, Id = addId });
} }
...@@ -292,7 +290,8 @@ namespace Edu.WebApi.Controllers.AI ...@@ -292,7 +290,8 @@ namespace Edu.WebApi.Controllers.AI
public ApiResult GetOpenAIResult() public ApiResult GetOpenAIResult()
{ {
string dateStr = base.ParmJObj.GetStringValue("TimeUtc"); string dateStr = base.ParmJObj.GetStringValue("TimeUtc");
if (string.IsNullOrWhiteSpace(dateStr)) int Id = base.ParmJObj.GetInt("Id", 0);
if (string.IsNullOrWhiteSpace(dateStr) || Id <= 0)
{ {
return ApiResult.ParamIsNull(); return ApiResult.ParamIsNull();
} }
...@@ -301,6 +300,12 @@ namespace Edu.WebApi.Controllers.AI ...@@ -301,6 +300,12 @@ namespace Edu.WebApi.Controllers.AI
{ {
return ApiResult.Failed("获取失败请重新调用"); return ApiResult.Failed("获取失败请重新调用");
} }
else
{
var model = aiModule.GetAIUseLogEntity(Id);
model.ResultInfo = returnModel.CompletionResultModel;
aiModule.SetAIUseLogModule(model);
}
return ApiResult.Success(data: returnModel); return ApiResult.Success(data: returnModel);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment