|
@@ -2,6 +2,8 @@
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using Microsoft.Extensions.Options;
|
|
|
using MySqlX.XDevAPI;
|
|
|
+using OASystem.API.OAMethodLib.ChatGPT;
|
|
|
+using OASystem.API.OAMethodLib.GoogleMapAPI;
|
|
|
using OASystem.API.OAMethodLib.JuHeAPI;
|
|
|
using OASystem.API.OAMethodLib.YouDaoAPI;
|
|
|
using OASystem.Domain.Dtos.Groups;
|
|
@@ -13,6 +15,7 @@ using System.Buffers;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Collections.Immutable;
|
|
|
using System.Collections.Specialized;
|
|
|
+using System.Diagnostics;
|
|
|
using System.Text.Json;
|
|
|
using System.Text.Json.Nodes;
|
|
|
using System.Transactions;
|
|
@@ -47,7 +50,7 @@ namespace OASystem.API.Controllers
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
- public async Task<IActionResult> GeRateCurrency()
|
|
|
+ public async Task<IActionResult> GetCurrencys()
|
|
|
{
|
|
|
var rateCurrencyData = AppSettingsHelper.Get<RateCurrencyModel>("RateCurrency");
|
|
|
|
|
@@ -61,7 +64,7 @@ namespace OASystem.API.Controllers
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
- public async Task<IActionResult> GeExchangeRate(ExchangeRateDto rateDto)
|
|
|
+ public async Task<IActionResult> GetCurrencyExchange(ExchangeRateDto rateDto)
|
|
|
{
|
|
|
#region 参数处理
|
|
|
if (string.IsNullOrEmpty(rateDto.CurrencyCodePer) || string.IsNullOrEmpty(rateDto.CurrencyCodeSuf))
|
|
@@ -144,5 +147,66 @@ namespace OASystem.API.Controllers
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
+ #region googleMapApi
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// googleMapApi 获取距离And时间
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto">
|
|
|
+ /// 请求参数默认值
|
|
|
+ /// origin:"FERİT RECAİ ERTUĞRUL CAD. NO: 18 ORAN / ANKARA,Turkey";
|
|
|
+ /// destination : "Dudullu Mh. Imes Sanayi Sitesi 504. Sk. No:4/B1 Umraniye/Istanbul";
|
|
|
+ /// </param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> GetGooglMapForeignAndTime(GoogleMapDirectionsDto dto)
|
|
|
+ {
|
|
|
+ var data = await GoogleMapTools.GetForeignAndTime(dto.origin,dto.destination);
|
|
|
+
|
|
|
+ if (data == null || data.Code != 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, data.Msg));
|
|
|
+ }
|
|
|
+
|
|
|
+ return Ok(JsonView(data.Data));
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region ChatGPT
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// ChatGPT 自动补全
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"> </param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> ChatGptCompletions(CompletionsDto dto)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(dto.Prompt))
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false,"待自动补全的文本为空!"));
|
|
|
+ }
|
|
|
+
|
|
|
+ Stopwatch sw = new Stopwatch();
|
|
|
+ sw.Start();
|
|
|
+ Thread.Sleep(999);
|
|
|
+ Console.WriteLine($"程序耗时:{sw.ElapsedMilliseconds}ms.");
|
|
|
+
|
|
|
+ var data = await ChatGPTTools.Completions(dto.Prompt);
|
|
|
+
|
|
|
+ sw.Stop();
|
|
|
+ if (data == null || data.Code != 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, data.Msg+"【耗时:"+ sw.ElapsedMilliseconds/1000+ "ms】"));
|
|
|
+ }
|
|
|
+
|
|
|
+ return Ok(JsonView(200, "【耗时:"+ sw.ElapsedMilliseconds/1000 + "s】", data.Data));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|