From 5cadfce1622f717f8d83e51e12c4ce784b40af0b Mon Sep 17 00:00:00 2001 From: zhangsan <646228430@qq.com> Date: Tue, 29 Jul 2025 20:41:47 +0800 Subject: [PATCH] =?UTF-8?q?7.29=20git=E4=BB=93=E5=BA=93=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=8B=89=E5=8F=96+=E4=BC=A0=E7=9F=A5=E8=AF=86=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/edu/whut/api/IRAGService.java | 2 +- .../main/java/edu/whut/trigger/http/RAGController.java | 8 ++++++-- docs/tag/v1.0/nginx/html/js/git.js | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ai-rag-knowledge-api/src/main/java/edu/whut/api/IRAGService.java b/ai-rag-knowledge-api/src/main/java/edu/whut/api/IRAGService.java index 25c477f..577177a 100644 --- a/ai-rag-knowledge-api/src/main/java/edu/whut/api/IRAGService.java +++ b/ai-rag-knowledge-api/src/main/java/edu/whut/api/IRAGService.java @@ -11,6 +11,6 @@ public interface IRAGService { Response uploadFile(String ragTag, List files, List filePaths); - Response analyzeGitRepository(String repoUrl, String userName, String token) throws Exception; + Response analyzeGitRepository(String repoUrl, String userName, String token,String ragTag) throws Exception; } diff --git a/ai-rag-knowledge-trigger/src/main/java/edu/whut/trigger/http/RAGController.java b/ai-rag-knowledge-trigger/src/main/java/edu/whut/trigger/http/RAGController.java index f032cb5..73ffc84 100644 --- a/ai-rag-knowledge-trigger/src/main/java/edu/whut/trigger/http/RAGController.java +++ b/ai-rag-knowledge-trigger/src/main/java/edu/whut/trigger/http/RAGController.java @@ -5,6 +5,7 @@ import edu.whut.api.response.Response; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider; import org.redisson.api.RList; @@ -238,10 +239,13 @@ public class RAGController implements IRAGService { public Response analyzeGitRepository( @RequestParam("repoUrl") String repoUrl, @RequestParam("userName") String userName, - @RequestParam("token") String token) throws Exception { + @RequestParam("token") String token, + @RequestParam("ragTag") String ragTag) throws Exception { String localPath = "./git-cloned-repo"; - String repoProjectName = extractProjectName(repoUrl); + String repoProjectName = StringUtils.isNotBlank(ragTag) ? + ragTag : + extractProjectName(repoUrl); log.info("克隆路径:{}", new File(localPath).getAbsolutePath()); // 1. 干净克隆 diff --git a/docs/tag/v1.0/nginx/html/js/git.js b/docs/tag/v1.0/nginx/html/js/git.js index 7640fc8..07ddfe4 100644 --- a/docs/tag/v1.0/nginx/html/js/git.js +++ b/docs/tag/v1.0/nginx/html/js/git.js @@ -29,9 +29,9 @@ document.addEventListener('DOMContentLoaded', function() { const response = await fetch('/api/v1/rag/analyze_git_repository', { method: 'POST', headers: { - 'Content-Type': 'application/json', + 'Content-Type': 'application/x-www-form-urlencoded', }, - body: JSON.stringify({ + body: new URLSearchParams({ repoUrl, userName, token,