From 4e7dad0e3082bde77e5b552630f40a4666618557 Mon Sep 17 00:00:00 2001 From: yake Date: Tue, 5 Sep 2023 16:13:28 +0800 Subject: [PATCH] fix(run): ai analyze clone --- backend/app/controllers/app.py | 3 ++- backend/app/pkgs/knowledge/app_info.py | 12 ++++++------ backend/app/pkgs/knowledge/app_info_basic.py | 2 +- backend/app/pkgs/knowledge/app_info_interface.py | 5 +++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/backend/app/controllers/app.py b/backend/app/controllers/app.py index c32dad83..47bad203 100644 --- a/backend/app/controllers/app.py +++ b/backend/app/controllers/app.py @@ -64,9 +64,10 @@ def getAll(): @json_response def analyze_service(): _ = getI18n("controllers") + tenantID = session['tenant_id'] gitPath = request.json.get('service_git_path') - info, success = analyzeService(gitPath) + info, success = analyzeService(tenantID, gitPath) if not success: raise Exception(_("Failed to analysis applications.")) diff --git a/backend/app/pkgs/knowledge/app_info.py b/backend/app/pkgs/knowledge/app_info.py index 55dbc861..04602b4b 100644 --- a/backend/app/pkgs/knowledge/app_info.py +++ b/backend/app/pkgs/knowledge/app_info.py @@ -86,7 +86,7 @@ def getServiceLib(appID, serviceName): obj = AppInfoBasic() else: obj = AppInfoPro() - + return obj.getServiceLib(appID, serviceName) def getServiceStruct(appID, serviceName): @@ -94,7 +94,7 @@ def getServiceStruct(appID, serviceName): obj = AppInfoBasic() else: obj = AppInfoPro() - + return obj.getServiceStruct(appID, serviceName) def getServiceSpecification(appID, serviceName, LibName): @@ -102,13 +102,13 @@ def getServiceSpecification(appID, serviceName, LibName): obj = AppInfoBasic() else: obj = AppInfoPro() - + return obj.getServiceSpecification(appID, serviceName, LibName) -def analyzeService(gitPath): +def analyzeService(tenant_id, gitPath): if GRADE == "base": obj = AppInfoBasic() else: obj = AppInfoPro() - - return obj.analyzeService(gitPath) \ No newline at end of file + + return obj.analyzeService(tenant_id, gitPath) diff --git a/backend/app/pkgs/knowledge/app_info_basic.py b/backend/app/pkgs/knowledge/app_info_basic.py index 133a45b6..393686c5 100644 --- a/backend/app/pkgs/knowledge/app_info_basic.py +++ b/backend/app/pkgs/knowledge/app_info_basic.py @@ -42,7 +42,7 @@ def getServiceSpecification(self, appID, serviceName, LibName): return specification, True - def analyzeService(self, gitPath): + def analyzeService(self, tenant_id, gitPath): time.sleep(2) _ = getI18n("controllers") reJson = { diff --git a/backend/app/pkgs/knowledge/app_info_interface.py b/backend/app/pkgs/knowledge/app_info_interface.py index 1aa9421d..dd7e3e64 100644 --- a/backend/app/pkgs/knowledge/app_info_interface.py +++ b/backend/app/pkgs/knowledge/app_info_interface.py @@ -2,6 +2,7 @@ from config import GRADE + class AppInfoInterface(ABC): @abstractmethod def getServiceLib(self, appID, serviceName): @@ -16,5 +17,5 @@ def getServiceSpecification(self, appID, serviceName, LibName): pass @abstractmethod - def analyzeService(gitPath): - pass \ No newline at end of file + def analyzeService(self, tenant_id, git_path): + pass