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 { /// /// 蓝鲸字库接口 /// [ApiController] [Route("LJZK/[action]")] public class LJZK_Controller : ControllerBase { private readonly ILogger _logger; private readonly IMapper mp; private readonly Repository nodesubscriptionDB; private readonly IBserGPT chatGPT; public LJZK_Controller(ILogger logger, IMapper mp, IBserGPT chatGPT, Repository nodesubscriptionDB) { _logger = logger; this.mp = mp; this.chatGPT = chatGPT; this.nodesubscriptionDB = nodesubscriptionDB; } /// /// 蓝鲸智库_添加文件节点监控 /// /// 请求体 /// [HttpPost(Name = "NodeSubscription")] public async Task 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); } /// /// 获取任务类型 /// /// [HttpGet(Name = "TaskTypList")] public IActionResult TaskType() { Type type = typeof(TaskTypeEnum); return Ok(Enum.GetValues(type).Cast() .Select(s => new { Text = s.ToString(), Value = (int)s })); } /// /// 获取学科类型 /// /// [HttpGet(Name = "SubjectList")] public IActionResult Subject() { Type type = typeof(SubjectEnum); return Ok(Enum.GetValues(type).Cast() .Select(s => new { Text = s.ToString(), Value = (int)s })); } } }