From 4c7a537427ebdaeba179e918e9e91584ebf81795 Mon Sep 17 00:00:00 2001
From: 10191 <506754232@qq.com>
Date: Wed, 27 May 2026 16:13:25 +0800
Subject: [PATCH] 11
---
SGGL/BLL/Common/Const.cs | 6 ++++
SGGL/BLL/Common/OpenAIhelper.cs | 56 +++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
create mode 100644 SGGL/BLL/Common/OpenAIhelper.cs
diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs
index 37b9fbc6..89f90d62 100644
--- a/SGGL/BLL/Common/Const.cs
+++ b/SGGL/BLL/Common/Const.cs
@@ -2974,7 +2974,13 @@ namespace BLL
///
public const string HJGL_TDMImportMenuId = "B13BFFA5-3112-4209-8562-5329B78B405C";
+ ///
+ /// 数据导入
+ ///
+ public const string HJGL_DataInMenuId = "ERDXV53M-09B1-6UIO-6666-5DVZDF329001";
#endregion
+
+
#region 焊接过程
///
/// 焊口二次设计
diff --git a/SGGL/BLL/Common/OpenAIhelper.cs b/SGGL/BLL/Common/OpenAIhelper.cs
new file mode 100644
index 00000000..907d3a03
--- /dev/null
+++ b/SGGL/BLL/Common/OpenAIhelper.cs
@@ -0,0 +1,56 @@
+
+using FastReport.Utils;
+using Newtonsoft.Json;
+using NPOI.POIFS.Crypt;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+using System.Net.Http;
+
+namespace BLL.Common
+{
+ public class OpenAIhelper
+ {
+ private const string ApiKey = "sk-a5014a22a49049d1b2179a6c0d8eec1c";
+ private const string AIURL = "https://api.deepseek.com/chat/completions";
+
+ public static string ChatCompletion(string content)
+ {
+ try
+ {
+ using (HttpClient client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Add("Authorization", "Bearer " + ApiKey);
+
+ var requestData = new
+ {
+ model = "deepseek-v4-flash",
+ messages = new[] {
+ new { role = "user", content = content }
+ },
+ temperature = 0.3
+ };
+
+ string json = JsonConvert.SerializeObject(requestData);
+ var chatContent = new StringContent(json, Encoding.UTF8, "application/json");
+
+ // 同步请求
+ var response = client.PostAsync(AIURL, chatContent).Result;
+ string resultJson = response.Content.ReadAsStringAsync().Result;
+
+ // 解析返回
+ dynamic result = JsonConvert.DeserializeObject(resultJson);
+ return result.choices[0].message.content.ToString();
+ }
+ }
+ catch (Exception ex)
+ {
+ return ex.ToString();
+ }
+
+ }
+ }
+}