refactor(open-sse): remove unused imports from translator/index.ts

remove unused imports coerceToolSchemas and sanitizeToolDescriptions from translator/index.ts to satisfy lint and prevent unused import issues
This commit is contained in:
diegosouzapw
2026-03-28 17:26:55 -03:00
parent a7cdcd8b3a
commit 65edddd62e
3 changed files with 32 additions and 2 deletions

View File

@@ -1,6 +1,5 @@
import { FORMATS } from "./formats.ts";
import { ensureToolCallIds, fixMissingToolResponses } from "./helpers/toolCallHelper.ts";
import { coerceToolSchemas, sanitizeToolDescriptions } from "./helpers/schemaCoercion.ts";
import { prepareClaudeRequest } from "./helpers/claudeHelper.ts";
import { filterToOpenAIFormat } from "./helpers/openaiHelper.ts";
import {

View File

@@ -45,7 +45,6 @@ export async function getSettings() {
cloudEnabled: false,
stickyRoundRobinLimit: 3,
requireLogin: true,
maxCallLogs: 10000,
};
for (const row of rows) {
const record = toRecord(row);

View File

@@ -6,6 +6,7 @@ import path from "node:path";
const TEST_DATA_DIR = fs.mkdtempSync(path.join(os.tmpdir(), "omniroute-calllogs-cap-"));
process.env.DATA_DIR = TEST_DATA_DIR;
const ORIGINAL_CALL_LOGS_MAX = process.env.CALL_LOGS_MAX;
const core = await import("../../src/lib/db/core.ts");
const localDb = await import("../../src/lib/localDb.ts");
@@ -25,6 +26,11 @@ test.beforeEach(async () => {
test.after(() => {
core.resetDbInstance();
fs.rmSync(TEST_DATA_DIR, { recursive: true, force: true });
if (ORIGINAL_CALL_LOGS_MAX === undefined) {
delete process.env.CALL_LOGS_MAX;
} else {
process.env.CALL_LOGS_MAX = ORIGINAL_CALL_LOGS_MAX;
}
});
test("call logs respect the configurable maxCallLogs setting", async () => {
@@ -52,3 +58,29 @@ test("call logs respect the configurable maxCallLogs setting", async () => {
["model-5", "model-4", "model-3"]
);
});
test("call logs keep honoring CALL_LOGS_MAX when maxCallLogs was never saved", async () => {
process.env.CALL_LOGS_MAX = "2";
callLogs.invalidateCallLogsMaxCache();
for (let i = 1; i <= 4; i++) {
await callLogs.saveCallLog({
method: "POST",
path: "/v1/chat/completions",
status: 200,
model: `env-model-${i}`,
provider: "openai",
duration: i,
requestBody: { index: i },
responseBody: { ok: true, index: i },
});
}
const logs = await callLogs.getCallLogs({ limit: 10 });
assert.equal(logs.length, 2);
assert.deepEqual(
logs.map((entry) => entry.model),
["env-model-4", "env-model-3"]
);
});