123456789101112131415161718192021222324252627282930313233 |
- using HTEXGpt.Models;
- using HTEXGpt.Services;
- using Microsoft.AspNetCore.Mvc;
- using System.Diagnostics.Tracing;
- using System.Net;
- namespace HTEXGpt.Controllers
- {
- [ProducesResponseType(StatusCodes.Status200OK)]
- [ProducesResponseType(StatusCodes.Status400BadRequest)]
- [Route("chat")]
- [ApiController]
- public class ChatController:ControllerBase
- {
- private static int _eventCounter = 0;
- private readonly IAiAppService _aiAppService;
- public ChatController(IAiAppService aiAppService) {
- _aiAppService=aiAppService;
- }
- /// <summary>
- /// 混元大模型
- /// SecretId:AKIDthPvHSSEnCTXNyVfjfWCvZVNLNJ8lBXi
- ///SecretKey:CKKA0e7MROFyY1JPQMD90kLl1JXnw20n
- /// </summary>
- /// <param name="dto"></param>
- /// <returns></returns>
- [HttpPost("message")]
- public async Task<IActionResult > Message(ChatRequest dto) {
- var chatResponse = await _aiAppService.ChatMessage(dto.modelType, dto, HttpContext, Response);
- return Ok(new { response = chatResponse });
- }
- }
- }
|