diff --git a/gitea-webhook/pom.xml b/gitea-webhook/pom.xml
index 3351ff7..bf1bdc1 100644
--- a/gitea-webhook/pom.xml
+++ b/gitea-webhook/pom.xml
@@ -35,6 +35,13 @@
hutool-http
5.8.27
+
+
+
+ cn.hutool
+ hutool-json
+ 5.8.27
+
\ No newline at end of file
diff --git a/gitea-webhook/src/main/java/cn/hezhaohui/webhook/constant/AIConstant.java b/gitea-webhook/src/main/java/cn/hezhaohui/webhook/constant/AIConstant.java
new file mode 100644
index 0000000..d9e2d0e
--- /dev/null
+++ b/gitea-webhook/src/main/java/cn/hezhaohui/webhook/constant/AIConstant.java
@@ -0,0 +1,7 @@
+package cn.hezhaohui.webhook.constant;
+
+public class AIConstant {
+ public static final String AI_URL = "https://api.siliconflow.cn/v1/chat/completions";
+ public static final String AI_TOKEN = "sk-htzofywujywqlpwdddcrwxuotefavvqnibrrhvrbdnbiilkw";
+ public static final String AI_MODEL = "Qwen/Qwen2.5-Coder-32B-Instruct";
+}
diff --git a/gitea-webhook/src/main/java/cn/hezhaohui/webhook/service/AIService.java b/gitea-webhook/src/main/java/cn/hezhaohui/webhook/service/AIService.java
new file mode 100644
index 0000000..cae3b95
--- /dev/null
+++ b/gitea-webhook/src/main/java/cn/hezhaohui/webhook/service/AIService.java
@@ -0,0 +1,30 @@
+package cn.hezhaohui.webhook.service;
+
+import cn.hezhaohui.webhook.constant.AIConstant;
+import cn.hutool.http.HttpRequest;
+import cn.hutool.http.HttpResponse;
+import cn.hutool.http.HttpUtil;
+import cn.hutool.json.JSONUtil;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class AIService {
+ public String getAIResponse(String prompt) {
+ Map body = new HashMap<>();
+ body.put("model", AIConstant.AI_MODEL);
+ body.put("messages", List.of(Map.of("role", "user", "content", prompt)));
+
+ String jsonBody = JSONUtil.toJsonStr(body);
+
+ HttpResponse response = HttpRequest.post(AIConstant.AI_URL)
+ .header("Content-Type", "application/json")
+ .header("Authorization", "Bearer " + AIConstant.AI_TOKEN)
+ .body(jsonBody)
+ .execute();
+ return "AI response: " + response.body();
+ }
+}
diff --git a/gitea-webhook/src/test/java/cn/hezhaohui/webhook/service/AIServiceTest.java b/gitea-webhook/src/test/java/cn/hezhaohui/webhook/service/AIServiceTest.java
new file mode 100644
index 0000000..d28d6ad
--- /dev/null
+++ b/gitea-webhook/src/test/java/cn/hezhaohui/webhook/service/AIServiceTest.java
@@ -0,0 +1,12 @@
+package cn.hezhaohui.webhook.service;
+
+import junit.framework.TestCase;
+public class AIServiceTest extends TestCase {
+
+ public void testGetAIResponse() {
+ AIService aiService = new AIService();
+ String response = aiService.getAIResponse("你好");
+ System.out.println(response);
+ assertNotNull(response);
+ }
+}
\ No newline at end of file