mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 15:02:32 +00:00
remove useless test from #691
This commit is contained in:
parent
8936c5d136
commit
3272040873
2 changed files with 1 additions and 57 deletions
|
|
@ -9,7 +9,7 @@
|
|||
### Added
|
||||
|
||||
- Extension example: `summarize.ts` for summarizing conversations using custom UI and an external model
|
||||
- Vercel AI Gateway provider support: set `AI_GATEWAY_API_KEY` and use `--provider vercel-ai-gateway` ([#689](https://github.com/badlogic/pi-mono/pull/689) by [@timolins](https://github.com/timolins))
|
||||
- Experimental Vercel AI Gateway provider support: set `AI_GATEWAY_API_KEY` and use `--provider vercel-ai-gateway`. Token usage is currently reported incorrectly by Anthropic Messages compatible endpoint. ([#689](https://github.com/badlogic/pi-mono/pull/689) by [@timolins](https://github.com/timolins))
|
||||
|
||||
### Fixed
|
||||
|
||||
|
|
|
|||
|
|
@ -1,56 +0,0 @@
|
|||
import { mkdirSync, rmSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { getModel } from "@mariozechner/pi-ai";
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
import { AuthStorage } from "../src/core/auth-storage.js";
|
||||
import { ModelRegistry } from "../src/core/model-registry.js";
|
||||
import { createAgentSession } from "../src/core/sdk.js";
|
||||
import { SessionManager } from "../src/core/session-manager.js";
|
||||
import { SettingsManager } from "../src/core/settings-manager.js";
|
||||
|
||||
describe("createAgentSession getApiKey", () => {
|
||||
let tempDir: string;
|
||||
let agentDir: string;
|
||||
let projectDir: string;
|
||||
|
||||
beforeEach(() => {
|
||||
tempDir = join(tmpdir(), `pi-test-sdk-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
||||
agentDir = join(tempDir, "agent");
|
||||
projectDir = join(tempDir, "project");
|
||||
mkdirSync(agentDir, { recursive: true });
|
||||
mkdirSync(join(projectDir, ".pi"), { recursive: true });
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
rmSync(tempDir, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
it("uses the provider argument after model switches", async () => {
|
||||
const authStorage = new AuthStorage(join(agentDir, "auth.json"));
|
||||
authStorage.set("anthropic", { type: "api_key", key: "anthropic-key" });
|
||||
authStorage.set("openai-codex", { type: "api_key", key: "codex-key" });
|
||||
|
||||
const modelRegistry = new ModelRegistry(authStorage, join(agentDir, "models.json"));
|
||||
const settingsManager = SettingsManager.create(projectDir, agentDir);
|
||||
const sessionManager = SessionManager.inMemory(projectDir);
|
||||
|
||||
const anthropicModel = getModel("anthropic", "claude-opus-4-5");
|
||||
const codexModel = getModel("openai-codex", "gpt-5.2-codex");
|
||||
|
||||
const { session } = await createAgentSession({
|
||||
cwd: projectDir,
|
||||
agentDir,
|
||||
authStorage,
|
||||
modelRegistry,
|
||||
settingsManager,
|
||||
sessionManager,
|
||||
model: anthropicModel,
|
||||
});
|
||||
|
||||
await session.setModel(codexModel);
|
||||
|
||||
const key = await session.agent.getApiKey?.("anthropic");
|
||||
expect(key).toBe("anthropic-key");
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue