fix(fireworks): route Fireworks models through resolveModel everywhere
pi-ai's getModel/getModels does not know about the Fireworks providers (fireworks, fireworks-firepass); both live under our local model-resolver because Fireworks speaks the Anthropic-compat endpoint with Bearer auth at https://api.fireworks.ai/inference, not pi-ai's built-in catalog. Three call sites were still hitting pi-ai directly and failing silently for Fireworks: 1. connector-model-policy.ts — listProviderModels() caught the pi-ai throw and returned []. The "Fire Pass (CEO runtime)" card in the Team Models onboarding step therefore showed "暂无模型 / 已启用 0/0", blocking users on Fire Pass from continuing onboarding. 2. worker/worker-runner.ts — getModel() threw mid-run when the selected connector was Fireworks, so the worker could never actually execute an agent turn against Fire Pass or the curated Fireworks model set. Now uses resolveModel() + the Fireworks-specific Bearer header from resolveExtraStreamHeaders() so streamSimple hits the correct endpoint with the correct auth. 3. agent-runtime/cost-writer.ts — cost observation silently wrote amount_usd=null for Fireworks runs because getModel() threw inside the try/catch. Now resolves via resolveModel() so the Fireworks curated contextWindow/maxTokens are visible to calculateCost(). Verification: pnpm typecheck 0 / pnpm lint 0-0 / pnpm build:verify 0-0 / pnpm test:unit 508/508.
This commit is contained in:
1 parent
84a3520ea8
commit
e7e43bd0a6
3 files changed
+24
-12
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { calculateCost, getModel, type Usage } from "@mariozechner/pi-ai";
|
||||
import { calculateCost, type Usage } from "@mariozechner/pi-ai";
|
||||
import type { AppDatabase } from "@main/database";
|
||||
import { getConnectorDefinition } from "@main/connectors";
|
||||
import { resolveModel } from "@main/model-resolver";
|
||||
|
||||
export interface CostWriterDeps {
|
||||
db: AppDatabase;
|
||||
@@ -29,7 +30,7 @@ export class CostWriter {
|
||||
try {
|
||||
const definition = getConnectorDefinition(input.connectorId);
|
||||
if (definition.provider) {
|
||||
const model = getModel(definition.provider as never, input.modelId as never);
|
||||
const model = resolveModel(definition.provider, input.modelId);
|
||||
if (model) {
|
||||
const cost = calculateCost(model, input.usage);
|
||||
amountUsd = Number.isFinite(cost.total) ? cost.total : null;
|
||||
|
||||
Reference in new issue
Block a user