Gemini global budget: larm istället för block (blockera aldrig användarskanning)
This commit is contained in:
@@ -329,11 +329,7 @@ export class GeminiAamosClient implements AamosClient {
|
|||||||
const imageCount = Math.min(input.imageUrls.length, 6);
|
const imageCount = Math.min(input.imageUrls.length, 6);
|
||||||
const estimatedCostUsd = imageCount * COST_ESTIMATE_PER_IMAGE_USD;
|
const estimatedCostUsd = imageCount * COST_ESTIMATE_PER_IMAGE_USD;
|
||||||
if (await this.isOverBudget(estimatedCostUsd)) {
|
if (await this.isOverBudget(estimatedCostUsd)) {
|
||||||
return {
|
console.warn("[gemini] Global dagsbudget överskriden — LARM, blockerar INTE, skanning fortsätter.");
|
||||||
status: "failed",
|
|
||||||
output: null,
|
|
||||||
error: "Global Gemini-dagsbudget är förbrukad.",
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const imageParts = await Promise.all(
|
const imageParts = await Promise.all(
|
||||||
@@ -430,11 +426,7 @@ export class GeminiAamosClient implements AamosClient {
|
|||||||
const imageCount = Math.min(imageUrls.length, 6);
|
const imageCount = Math.min(imageUrls.length, 6);
|
||||||
const estimatedCostUsd = imageCount * costEstimatePerImage;
|
const estimatedCostUsd = imageCount * costEstimatePerImage;
|
||||||
if (await this.isOverBudget(estimatedCostUsd)) {
|
if (await this.isOverBudget(estimatedCostUsd)) {
|
||||||
return {
|
console.warn("[gemini] Global dagsbudget överskriden — LARM, blockerar INTE, skanning fortsätter.");
|
||||||
status: "failed",
|
|
||||||
output: null,
|
|
||||||
error: "Global Gemini-dagsbudget är förbrukad.",
|
|
||||||
} as AamosResult<T>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const imageParts = await this.fetchImageParts(imageUrls, this.cfg.timeoutMs);
|
const imageParts = await this.fetchImageParts(imageUrls, this.cfg.timeoutMs);
|
||||||
@@ -611,11 +603,7 @@ export class GeminiAamosClient implements AamosClient {
|
|||||||
const totalCandidates = input.targetMatrix.reduce((sum, t) => sum + t.count, 0);
|
const totalCandidates = input.targetMatrix.reduce((sum, t) => sum + t.count, 0);
|
||||||
const estimatedCostUsd = totalCandidates * 0.003;
|
const estimatedCostUsd = totalCandidates * 0.003;
|
||||||
if (await this.isOverBudget(estimatedCostUsd)) {
|
if (await this.isOverBudget(estimatedCostUsd)) {
|
||||||
return {
|
console.warn("[gemini] Global dagsbudget överskriden — LARM, blockerar INTE, skanning fortsätter.");
|
||||||
status: "failed",
|
|
||||||
output: null,
|
|
||||||
error: "Global Gemini-dagsbudget är förbrukad.",
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const prompt = this.buildRecipeGenerationPrompt(input, locale);
|
const prompt = this.buildRecipeGenerationPrompt(input, locale);
|
||||||
|
|||||||
Reference in New Issue
Block a user