fix:增加llm结果鲁棒性

This commit is contained in:
tritium0041 2024-06-04 17:13:30 +08:00
parent 65820966df
commit 72901463c6

View File

@ -60,7 +60,10 @@ def detectGPT(content: str):
classified_results = {"high": [], "medium": [], "low": [], "none": []} classified_results = {"high": [], "medium": [], "low": [], "none": []}
for res in res_json: for res in res_json:
try:
classified_results[res["Risk"]].append( classified_results[res["Risk"]].append(
(res["Line"], text.split("\n")[res["Line"] - 1].strip()) (res["Line"], text.split("\n")[res["Line"] - 1].strip())
) )
except IndexError:
pass
return classified_results return classified_results