fix(llm): relax guidance and preserve judge output

This commit is contained in:
2026-07-24 14:06:51 +08:00
parent 44812f70e3
commit fd53bab639
7 changed files with 548 additions and 275 deletions
+2 -12
View File
@@ -16,7 +16,7 @@ if($sid<=0 || $name===null){
require("template/".$OJ_TEMPLATE."/error.php");
exit(0);
}
$sql="select problem_id,contest_id,user_id,result,pass_rate from solution where solution_id=?";
$sql="select problem_id,contest_id,user_id,result from solution where solution_id=?";
$data=pdo_query($sql,$sid);
//var_dump($sql);
if(count($data)>0){
@@ -25,7 +25,6 @@ if(count($data)>0){
$cid=$row[1];
$uid=$row[2];
$result_code=intval($row[3]);
$pass_rate=floatval($row[4]);
$is_admin=isset($_SESSION[$OJ_NAME.'_'.'administrator']);
if(!(isset($_SESSION[$OJ_NAME.'_'.'user_id']) && strval($uid) === strval($_SESSION[$OJ_NAME.'_'.'user_id'])
|| $is_admin
@@ -42,19 +41,11 @@ if(count($data)>0){
&& $spj_rows!==-1
&& intval($spj_rows[0][0])===2
&& !empty($OJ_HIDE_RIGHT_ANSWER);
$source_rows=pdo_query("select source from source_code_user where solution_id=?",$sid);
$student_source=(!empty($source_rows) && $source_rows!==-1) ? $source_rows[0][0] : "";
$guidance=llm_guidance_assess($student_source,$result_code,$pass_rate);
$runtime_info="";
$allowed_testcases=array();
if($result_code===5 || $result_code===6){
$runtime_rows=pdo_query("select error from runtimeinfo where solution_id=?",$sid);
$runtime_info=(!empty($runtime_rows) && $runtime_rows!==-1) ? $runtime_rows[0][0] : "";
$guidance=llm_guidance_refine_with_output_attempt(
$guidance,
$result_code,
llm_guidance_output_attempt($runtime_info)
);
$allowed_testcases=llm_guidance_diff_testcase_names($runtime_info);
if(isset($OJ_DL_1ST_WA_ONLY) && $OJ_DL_1ST_WA_ONLY){
$allowed_testcases=array_slice($allowed_testcases,0,1);
@@ -66,9 +57,8 @@ if(count($data)>0){
|| $hidden_spj
|| $unsafe_full_diff
|| ($result_code!==5 && $result_code!==6)
|| !$guidance['show_output_diff']
|| !$authorized_testcase){
$view_errors="当前提交或测试点未获授权,暂不提供隐藏测试数据下载。";
$view_errors="当前提交或测试点未获授权,暂不提供测试数据下载。";
require("template/".$OJ_TEMPLATE."/error.php");
exit(0);
}