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,