7.29 git仓库文件拉取+传知识库
This commit is contained in:
parent
e09ec7c70f
commit
5cadfce162
@ -11,6 +11,6 @@ public interface IRAGService {
|
|||||||
|
|
||||||
Response<String> uploadFile(String ragTag, List<MultipartFile> files, List<String> filePaths);
|
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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import edu.whut.api.response.Response;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.eclipse.jgit.api.Git;
|
import org.eclipse.jgit.api.Git;
|
||||||
import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
|
import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
|
||||||
import org.redisson.api.RList;
|
import org.redisson.api.RList;
|
||||||
@ -238,10 +239,13 @@ public class RAGController implements IRAGService {
|
|||||||
public Response<String> analyzeGitRepository(
|
public Response<String> analyzeGitRepository(
|
||||||
@RequestParam("repoUrl") String repoUrl,
|
@RequestParam("repoUrl") String repoUrl,
|
||||||
@RequestParam("userName") String userName,
|
@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 localPath = "./git-cloned-repo";
|
||||||
String repoProjectName = extractProjectName(repoUrl);
|
String repoProjectName = StringUtils.isNotBlank(ragTag) ?
|
||||||
|
ragTag :
|
||||||
|
extractProjectName(repoUrl);
|
||||||
log.info("克隆路径:{}", new File(localPath).getAbsolutePath());
|
log.info("克隆路径:{}", new File(localPath).getAbsolutePath());
|
||||||
|
|
||||||
// 1. 干净克隆
|
// 1. 干净克隆
|
||||||
|
@ -29,9 +29,9 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
const response = await fetch('/api/v1/rag/analyze_git_repository', {
|
const response = await fetch('/api/v1/rag/analyze_git_repository', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: new URLSearchParams({
|
||||||
repoUrl,
|
repoUrl,
|
||||||
userName,
|
userName,
|
||||||
token,
|
token,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user