Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions backend/app/api/v1/endpoints/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -562,9 +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)

Expand Down
4 changes: 3 additions & 1 deletion frontend/src/shared/api/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/shared/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,15 @@ 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 {
Expand Down Expand Up @@ -302,4 +302,4 @@ export interface SystemConfig {
email_enabled: boolean;
webhook_url?: string;
};
}
}