From 9041e4600575f4ae7a4ec8eafd0b2b4ed8073337 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 8 Apr 2026 14:47:23 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DCode=20Review=E5=8F=8D?= =?UTF-8?q?=E9=A6=88:=20=E6=94=B9=E8=BF=9Bbasename=E6=8F=90=E5=8F=96?= =?UTF-8?q?=E9=80=BB=E8=BE=91+=E6=B7=BB=E5=8A=A0=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/cba1c849-c8ef-44cf-a98f-81b9d40538b4 Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> --- scripts/cos-training-trigger.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/cos-training-trigger.js b/scripts/cos-training-trigger.js index d7d3e122..b583a8ff 100644 --- a/scripts/cos-training-trigger.js +++ b/scripts/cos-training-trigger.js @@ -92,8 +92,15 @@ function isCorpusDirectory(key) { * 从已处理列表中判断某文件是否已处理 */ function isProcessed(rawKey, processedFiles) { - // 从rawKey提取基础文件名 - const baseName = rawKey.replace(/\.[^/.]+$/, '').split('/').pop(); + // 从rawKey提取基础文件名(处理多重扩展名如.tar.gz) + let baseName = rawKey.split('/').pop(); + // 移除所有已知的语料文件扩展名 + for (const ext of ['.tar.gz', '.json.gz', '.tgz', '.zip', '.gz', '.jsonl', '.json', '.md', '.txt', '.csv']) { + if (baseName.toLowerCase().endsWith(ext)) { + baseName = baseName.slice(0, -ext.length); + break; + } + } return processedFiles.some(f => f.key.includes(baseName)); } @@ -172,8 +179,8 @@ async function cmdScan(bucket) { } } } - } catch { - console.log(` └── ${dir.key} 扫描失败`); + } catch (err) { + console.log(` └── ${dir.key} 扫描失败: ${err.message}`); } } } @@ -276,7 +283,9 @@ async function cmdTrain(bucket, personaId) { try { const existing = await cos.list(bucketName, `training-results/${persona}/`, 100); existingResults = existing.files.filter(f => f.key.endsWith('.json')); - } catch { /* ignore */ } + } catch (err) { + console.log(`⚠️ 无法读取已有训练结果: ${err.message}`); + } // 启动训练会话 console.log(`\n🧠 启动训练会话 · 人格体: ${persona}`);