Fix Kiro token refresh logic

This commit is contained in:
decolua
2026-01-16 12:39:03 +07:00
parent eff52f75ae
commit 6b22b1f490
2 changed files with 14 additions and 24 deletions
+7
View File
@@ -228,6 +228,13 @@ export async function appendRequestLog({ model, provider, connectionId, tokens,
const line = `${timestamp} | ${m} | ${p} | ${account} | ${sent} | ${received} | ${status}\n`;
fs.appendFileSync(LOG_FILE, line);
// Trim to keep only last 200 lines
const content = fs.readFileSync(LOG_FILE, "utf-8");
const lines = content.trim().split("\n");
if (lines.length > 200) {
fs.writeFileSync(LOG_FILE, lines.slice(-200).join("\n") + "\n");
}
} catch (error) {
console.error("Failed to append to log.txt:", error.message);
}