86 lines
2.5 KiB
C#
86 lines
2.5 KiB
C#
|
|
using VideoAnalysisCore.Common;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System.Reflection;
|
|
using MapsterMapper;
|
|
using Mapster;
|
|
using VideoAnalysisCore.AICore.SherpaOnnx;
|
|
using UserCenter.Model.Enum;
|
|
using VideoAnalysisCore.AICore.GPT.ChatGPT;
|
|
using VideoAnalysisCore.AICore.GPT;
|
|
using System.Text.Json;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using VideoAnalysisCore.Model.Enum;
|
|
|
|
namespace Learn.VideoAnalysis.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 蓝鲸字库接口
|
|
/// </summary>
|
|
[ApiController]
|
|
[Route("LJZK/[action]")]
|
|
public class LJZK_Controller : ControllerBase
|
|
{
|
|
private readonly ILogger<LJZK_Controller> _logger;
|
|
private readonly IMapper mp;
|
|
private readonly Repository<NodeSubscription> nodesubscriptionDB;
|
|
private readonly IBserGPT chatGPT;
|
|
public LJZK_Controller(ILogger<LJZK_Controller> logger,
|
|
IMapper mp, IBserGPT chatGPT, Repository<NodeSubscription> nodesubscriptionDB)
|
|
{
|
|
_logger = logger;
|
|
this.mp = mp;
|
|
this.chatGPT = chatGPT;
|
|
this.nodesubscriptionDB = nodesubscriptionDB;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 蓝鲸智库_添加文件节点监控
|
|
/// </summary>
|
|
/// <param name="req">请求体</param>
|
|
/// <returns></returns>
|
|
[HttpPost(Name = "NodeSubscription")]
|
|
public async Task<IActionResult> NodeSubscription(NodeMonitoringReq req)
|
|
{
|
|
if (nodesubscriptionDB.IsAny(s => s.NodeId == req.NodeId))
|
|
return BadRequest("重复添加了节点监控任务" + req.NodeId);
|
|
var res = await nodesubscriptionDB.InsertReturnEntityAsync(new NodeSubscription()
|
|
{
|
|
NodeId = req.NodeId,
|
|
TaskType = req.Type ?? default
|
|
});
|
|
return Ok(res);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取任务类型
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet(Name = "TaskTypList")]
|
|
public IActionResult TaskType()
|
|
{
|
|
Type type = typeof(TaskTypeEnum);
|
|
return Ok(Enum.GetValues(type).Cast<object>()
|
|
.Select(s => new { Text = s.ToString(), Value = (int)s }));
|
|
}
|
|
/// <summary>
|
|
/// 获取学科类型
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet(Name = "SubjectList")]
|
|
public IActionResult Subject()
|
|
{
|
|
Type type = typeof(SubjectEnum);
|
|
return Ok(Enum.GetValues(type).Cast<object>()
|
|
.Select(s => new { Text = s.ToString(), Value = (int)s }));
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|