mirror of
https://github.com/fosrl/pangolin.git
synced 2026-09-13 22:41:44 +02:00
Allow budgets to be set on the resources
This commit is contained in:
@@ -57,6 +57,7 @@ import next from "next";
|
||||
import { LimitId } from "../billing";
|
||||
import { usageService } from "../billing/usageService";
|
||||
import { syncInferenceAiConfig } from "./aiProviders";
|
||||
import { syncAiBudgets } from "./aiBudgets";
|
||||
|
||||
export type PublicResourcesResults = {
|
||||
proxyResource: Resource;
|
||||
@@ -696,6 +697,14 @@ export async function updatePublicResources(
|
||||
})
|
||||
)
|
||||
});
|
||||
|
||||
await syncAiBudgets({
|
||||
orgId,
|
||||
trx,
|
||||
scope: "public",
|
||||
resourceId: existingResource.resourceId,
|
||||
budgets: resourceData["ai-budget"] || []
|
||||
});
|
||||
}
|
||||
|
||||
const existingResourceTargets = await trx
|
||||
@@ -1258,6 +1267,14 @@ export async function updatePublicResources(
|
||||
}))
|
||||
});
|
||||
|
||||
await syncAiBudgets({
|
||||
orgId,
|
||||
trx,
|
||||
scope: "public",
|
||||
resourceId: newResource.resourceId,
|
||||
budgets: resourceData["ai-budget"] || []
|
||||
});
|
||||
|
||||
await trx.insert(roleResources).values({
|
||||
roleId: adminRole.roleId,
|
||||
resourceId: newResource.resourceId
|
||||
|
||||
Reference in New Issue
Block a user