|
@@ -96,9 +96,8 @@ def analysis_results(local_path,path):
|
|
|
response = Application.call(
|
|
|
# 若没有配置环境变量,可用百炼API Key将下行替换为:api_key="sk-xxx"。但不建议在生产环境中直接将API Key硬编码到代码中,以减少API Key泄露风险。
|
|
|
api_key=ai_key,
|
|
|
- app_id='b6edb4f5ff1c49f9855af27b14a0e8b4', # 替换为实际的应用 ID
|
|
|
+ app_id='b6edb4f5ff1c49f9855af27b14a0e8b4',
|
|
|
prompt=prompt)
|
|
|
-
|
|
|
if response.status_code == HTTPStatus.OK:
|
|
|
try:
|
|
|
json_data = json.loads(response.output.text)
|
|
@@ -110,7 +109,7 @@ def analysis_results(local_path,path):
|
|
|
else:
|
|
|
print(f"请求失败: {response.message}")
|
|
|
json_data = {"summary":None}
|
|
|
- json_data["path"]=file_path
|
|
|
+ json_data["path"]=path
|
|
|
|
|
|
return json_data
|
|
|
|
|
@@ -173,7 +172,7 @@ async def analysis(local_path, task_id):
|
|
|
file_list = await get_code_files(local_path)
|
|
|
print(file_list)
|
|
|
results = []
|
|
|
- tasks = [process_batch2(local_path, file) for file in file_list] # 假设process_batch2已改为异步函数
|
|
|
+ tasks = [process_batch2(local_path, file) for file in file_list]
|
|
|
batch_results = await asyncio.gather(*tasks, return_exceptions=True)
|
|
|
|
|
|
for result in batch_results:
|