7.29 git仓库文件拉取+传知识库

This commit is contained in:
zhangsan 2025-07-29 20:41:47 +08:00
parent e09ec7c70f
commit 5cadfce162
3 changed files with 9 additions and 5 deletions

View File

@ -11,6 +11,6 @@ public interface IRAGService {
Response<String> uploadFile(String ragTag, List<MultipartFile> files, List<String> filePaths);
Response<String> analyzeGitRepository(String repoUrl, String userName, String token) throws Exception;
Response<String> analyzeGitRepository(String repoUrl, String userName, String token,String ragTag) throws Exception;
}

View File

@ -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<String> 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. 干净克隆

View File

@ -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,