From 70cbad248443c6899bf25946c3977bd6f79879b6 Mon Sep 17 00:00:00 2001 From: H4lo <1179317825@qq.com> Date: Fri, 13 Mar 2026 13:51:08 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[fix]:=20=E4=BF=AE=E5=A4=8D=E5=BF=AB?= =?UTF-8?q?=E9=80=9F=E6=89=AB=E6=8F=8Fgit=E4=BB=93=E5=BA=93=E6=97=B6rule?= =?UTF-8?q?=5Fset=5Fid=E3=80=81prompt=5Ftemplate=5Fid=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=81=97=E6=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/api/v1/endpoints/projects.py | 6 ++++++ frontend/src/shared/api/database.ts | 4 +++- frontend/src/shared/types/index.ts | 10 +++------- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/backend/app/api/v1/endpoints/projects.py b/backend/app/api/v1/endpoints/projects.py index 4cad10a4..abb59e15 100644 --- a/backend/app/api/v1/endpoints/projects.py +++ b/backend/app/api/v1/endpoints/projects.py @@ -565,6 +565,12 @@ def decrypt_config(config_dict: dict, sensitive_fields: list) -> dict: if scan_request and scan_request.file_paths: user_config['scan_config'] = {'file_paths': scan_request.file_paths} + if scan_request: + user_config['scan_config'] = { + 'exclude_patterns': scan_request.exclude_patterns or [], + 'rule_set_id': scan_request.rule_set_id, + 'prompt_template_id': scan_request.prompt_template_id, + } # Trigger Background Task background_tasks.add_task(scan_repo_task, task.id, AsyncSessionLocal, user_config) diff --git a/frontend/src/shared/api/database.ts b/frontend/src/shared/api/database.ts index daeb0616..cf5eec55 100644 --- a/frontend/src/shared/api/database.ts +++ b/frontend/src/shared/api/database.ts @@ -177,7 +177,9 @@ export const api = { file_paths: task.scan_config?.file_paths, full_scan: !task.scan_config?.file_paths || task.scan_config.file_paths.length === 0, exclude_patterns: task.exclude_patterns || [], - branch_name: task.branch_name || "main" + branch_name: task.branch_name || "main", + rule_set_id: task.scan_config?.rule_set_id, + prompt_template_id: task.scan_config?.prompt_template_id, }; const res = await apiClient.post(`/projects/${task.project_id}/scan`, scanRequest); // Fetch the created task diff --git a/frontend/src/shared/types/index.ts b/frontend/src/shared/types/index.ts index e93c95f8..85a0d71c 100644 --- a/frontend/src/shared/types/index.ts +++ b/frontend/src/shared/types/index.ts @@ -167,15 +167,11 @@ export interface CreateAuditTaskForm { task_type: 'repository' | 'instant'; branch_name?: string; exclude_patterns: string[]; - rule_set_id?: string; - prompt_template_id?: string; scan_config: { - include_tests?: boolean; - include_docs?: boolean; - max_file_size?: number; - analysis_depth?: 'basic' | 'standard' | 'deep'; file_paths?: string[]; - }; + rule_set_id?: string; + prompt_template_id?: string; +}; } export interface InstantAnalysisForm { From 872cd2f24e2a6fea9fc1bf4ce3f8e03285426402 Mon Sep 17 00:00:00 2001 From: H4lo <38786981+H4lo@users.noreply.github.com> Date: Fri, 13 Mar 2026 14:20:01 +0800 Subject: [PATCH 2/3] Update projects.py fix syntax error --- backend/app/api/v1/endpoints/projects.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/app/api/v1/endpoints/projects.py b/backend/app/api/v1/endpoints/projects.py index abb59e15..b6238c6c 100644 --- a/backend/app/api/v1/endpoints/projects.py +++ b/backend/app/api/v1/endpoints/projects.py @@ -491,6 +491,8 @@ class ScanRequest(BaseModel): full_scan: bool = True exclude_patterns: Optional[List[str]] = None branch_name: Optional[str] = None + rule_set_id: Optional[str] = None + prompt_template_id: Optional[str] = None @router.post("/{id}/scan") @@ -562,15 +564,13 @@ def decrypt_config(config_dict: dict, sensitive_fields: list) -> dict: } # 将扫描配置注入到 user_config 中,以便 scan_repo_task 使用 - if scan_request and scan_request.file_paths: - user_config['scan_config'] = {'file_paths': scan_request.file_paths} - if scan_request: user_config['scan_config'] = { + 'file_paths': scan_request.file_paths or [], 'exclude_patterns': scan_request.exclude_patterns or [], 'rule_set_id': scan_request.rule_set_id, 'prompt_template_id': scan_request.prompt_template_id, - } + } # Trigger Background Task background_tasks.add_task(scan_repo_task, task.id, AsyncSessionLocal, user_config) From 03bb85e099e25ddd26f8aa1ddf700e08a1a2903c Mon Sep 17 00:00:00 2001 From: H4lo <38786981+H4lo@users.noreply.github.com> Date: Fri, 13 Mar 2026 14:21:46 +0800 Subject: [PATCH 3/3] Update index.ts --- frontend/src/shared/types/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/shared/types/index.ts b/frontend/src/shared/types/index.ts index 85a0d71c..92db579d 100644 --- a/frontend/src/shared/types/index.ts +++ b/frontend/src/shared/types/index.ts @@ -168,6 +168,10 @@ export interface CreateAuditTaskForm { branch_name?: string; exclude_patterns: string[]; scan_config: { + include_tests?: boolean; + include_docs?: boolean; + max_file_size?: number; + analysis_depth?: 'basic' | 'standard' | 'deep'; file_paths?: string[]; rule_set_id?: string; prompt_template_id?: string; @@ -298,4 +302,4 @@ export interface SystemConfig { email_enabled: boolean; webhook_url?: string; }; -} \ No newline at end of file +}