fix:增加llm结果鲁棒性
This commit is contained in:
parent
65820966df
commit
72901463c6
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user