From 7e5c5a6b67e37f2923f73471ed3b6ca47fe751b4 Mon Sep 17 00:00:00 2001 From: konpoku <543329382@qq.com> Date: Fri, 22 May 2026 15:38:03 +0800 Subject: [PATCH 1/2] fix bug --- src/routes/code.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/code.ts b/src/routes/code.ts index 35c5564d..87dec98f 100644 --- a/src/routes/code.ts +++ b/src/routes/code.ts @@ -334,7 +334,7 @@ router.post("/compile-finish", async (req, res) => { if (compile_status === "Completed") { const key = `${cosPath}/${code_id}`; - const localFilePath = `${base_directory}/${contest_name}/code/${team_id}/${code_id}/output/capi`; + const localFilePath = `${base_directory}/${contest_name}/code/${team_id}/${code_id}/output/${code_id}`; const found = await waitForFile(localFilePath); if (!found) { throw new Error(`File not found: ${localFilePath}`); From 06afcfccd27bb41cf4d110ba4b57312b3dc862b7 Mon Sep 17 00:00:00 2001 From: konpoku <543329382@qq.com> Date: Fri, 22 May 2026 22:57:32 +0800 Subject: [PATCH 2/2] fix --- src/hasura/llm.ts | 26 -------------------------- src/helpers/docker_queue.ts | 2 +- src/routes/competition.ts | 25 ------------------------- src/routes/team.ts | 13 ++++++++----- 4 files changed, 9 insertions(+), 57 deletions(-) diff --git a/src/hasura/llm.ts b/src/hasura/llm.ts index 93ffec42..e5c6e1a7 100644 --- a/src/hasura/llm.ts +++ b/src/hasura/llm.ts @@ -122,32 +122,6 @@ export const upsert_llm_usage_by_uuid = async ( return upsert_llm_usage_by_uuids([uuid], token_limit); }; -export const sync_rl_registered_users_to_llm_usage = async ( - token_limit: number = 0, -) => { - const query: any = await client.request( - gql` - query GetRLRegisteredUserUuids { - contest_team_member( - where: { contest_team: { contest: { name: { _ilike: "RL%" } } } } - ) { - user_uuid - } - } - `, - ); - - const uuids = (query.contest_team_member || []).map( - (member: any) => member.user_uuid, - ); - const affectedRows = await upsert_llm_usage_by_uuids(uuids, token_limit); - - return { - totalRegisteredUsers: Array.from(new Set(uuids)).length, - insertedUsers: affectedRows, - }; -}; - export const get_user_llm_usage = async (student_no: string) => { const query: any = await client.request( gql` diff --git a/src/helpers/docker_queue.ts b/src/helpers/docker_queue.ts index 163d2f96..3d0e0455 100644 --- a/src/helpers/docker_queue.ts +++ b/src/helpers/docker_queue.ts @@ -192,7 +192,7 @@ const docker_cron = async () => { console.log(ContConf.contest_image_map[contest_name]); const game_time = - (await ContHasFunc.get_game_time(queue_front.contest_id)) ?? 10; + (await ContHasFunc.get_game_time(queue_front.contest_id)) ?? 600; const server_memory_limit = (await ContHasFunc.get_server_memory_limit(queue_front.contest_id)) ?? 2; diff --git a/src/routes/competition.ts b/src/routes/competition.ts index 245fc643..f652658b 100644 --- a/src/routes/competition.ts +++ b/src/routes/competition.ts @@ -7,7 +7,6 @@ import * as utils from "../helpers/utils"; import * as COS from "../helpers/cos"; import * as ContConf from "../configs/contest"; import * as ContHasFunc from "../hasura/contest"; -import * as LlmHasFunc from "../hasura/llm"; const router = express.Router(); @@ -1887,28 +1886,4 @@ router.post("/rl-score/update", authenticate(), async (req, res) => { } }); -router.post( - "/sync_RL_llm_usage", - authenticate(["root", "counselor"]), - async (req, res) => { - try { - const token_limit = - typeof req.body.token_limit === "number" ? req.body.token_limit : 0; - const result = - await LlmHasFunc.sync_rl_registered_users_to_llm_usage(token_limit); - - return res.status(200).json({ - message: "200 OK: RL registered users synced to llm_usage", - ...result, - }); - } catch (err: any) { - console.error(err); - return res.status(500).json({ - error: "500 Internal Server Error", - message: err.message, - }); - } - }, -); - export default router; diff --git a/src/routes/team.ts b/src/routes/team.ts index ec5e42c7..0cf8aae4 100644 --- a/src/routes/team.ts +++ b/src/routes/team.ts @@ -5,14 +5,17 @@ import * as LlmHasFunc from "../hasura/llm"; const router = express.Router(); -const ensureRlUserLlmUsage = async (contest_id: string, user_uuid: string) => { +const ensureTHUAI9UserLlmUsage = async ( + contest_id: string, + user_uuid: string, +) => { try { const contestName = await ContHasFunc.get_contest_name(contest_id); - if (contestName?.trim().toUpperCase().startsWith("RL")) { + if (contestName?.trim().toUpperCase().startsWith("THUAI9")) { await LlmHasFunc.upsert_llm_usage_by_uuid(user_uuid); } } catch (err) { - console.error("Failed to add RL user to llm_usage:", err); + console.error("Failed to add THUAI9 user to llm_usage:", err); } }; @@ -132,7 +135,7 @@ router.post("/add_team", authenticate(["student"]), async (req, res) => { invited_code, contest_id, ); - await ensureRlUserLlmUsage(contest_id, team_leader_uuid); + await ensureTHUAI9UserLlmUsage(contest_id, team_leader_uuid); res .status(200) .json({ team_id: team_id, message: "Team Added Successfully" }); @@ -160,7 +163,7 @@ router.post("/add_team_member", authenticate(), async (req, res) => { } const contest_id = await ContHasFunc.get_contest_id_from_team_id(team_id); if (contest_id) { - await ensureRlUserLlmUsage(contest_id, user_uuid); + await ensureTHUAI9UserLlmUsage(contest_id, user_uuid); } return res.status(200).json({ message: "Team Member Added Successfully",