forked from Yara724/api
feat: replace OpenAI pricing with AI assessment estimates
Extend durable image assessments with explicit Persian vehicle names, deployment severity settings and advisory market prices normalized to rials. Preserve case access and retry boundaries, and remove the retired OpenAI pricing module and routes.
This commit is contained in:
@@ -128,21 +128,12 @@ export class EnvironmentVariables {
|
||||
AI_DAMAGE_TIMEOUT_MS?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsBooleanString()
|
||||
OPENAI_PRICE_ESTIMATION_ENABLED?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
OPENAI_PRICE_ESTIMATION_API_KEY?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
OPENAI_PRICE_ESTIMATION_MODEL?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
@Min(1000)
|
||||
@Max(600000)
|
||||
OPENAI_PRICE_ESTIMATION_TIMEOUT_MS?: number;
|
||||
@IsEnum(
|
||||
{ Minor: "minor", Moderate: "moderate", Severe: "severe", All: "null" },
|
||||
{
|
||||
message:
|
||||
"AI_DAMAGE_PRICE_MIN_SEVERITY must be minor, moderate, severe or null",
|
||||
},
|
||||
)
|
||||
AI_DAMAGE_PRICE_MIN_SEVERITY?: string;
|
||||
}
|
||||
|
||||
@@ -27,15 +27,6 @@ export function validate(config: Record<string, unknown>) {
|
||||
skipMissingProperties: false,
|
||||
});
|
||||
|
||||
if (
|
||||
validatedConfig.OPENAI_PRICE_ESTIMATION_ENABLED === "true" &&
|
||||
!validatedConfig.OPENAI_PRICE_ESTIMATION_API_KEY?.trim()
|
||||
) {
|
||||
throw new Error(
|
||||
"OPENAI_PRICE_ESTIMATION_API_KEY is required when OPENAI_PRICE_ESTIMATION_ENABLED=true",
|
||||
);
|
||||
}
|
||||
|
||||
if (errors.length > 0) {
|
||||
const messages = errors
|
||||
.flatMap((error) => Object.values(error.constraints ?? {}))
|
||||
|
||||
Reference in New Issue
Block a user