fix: update version tags to v28 and temporarily disable cache for predictions
This commit is contained in:
@@ -96,11 +96,11 @@ export class PredictionsController {
|
||||
async getPrediction(
|
||||
@Param("matchId") matchId: string,
|
||||
): Promise<MatchPredictionDto> {
|
||||
// Check cache first
|
||||
const cached = await this.predictionsService.getCachedPrediction(matchId);
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
// Check cache first - DISABLED per user request to always fetch from scratch
|
||||
// const cached = await this.predictionsService.getCachedPrediction(matchId);
|
||||
// if (cached) {
|
||||
// return cached;
|
||||
// }
|
||||
|
||||
// Get from AI Engine
|
||||
const prediction = await this.predictionsService.getPredictionById(matchId);
|
||||
@@ -109,9 +109,6 @@ export class PredictionsController {
|
||||
throw new NotFoundException(`Match not found: ${matchId}`);
|
||||
}
|
||||
|
||||
// Cache the result
|
||||
await this.predictionsService.cachePrediction(matchId, prediction);
|
||||
|
||||
return prediction;
|
||||
}
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ export class PredictionsService implements OnModuleInit, OnModuleDestroy {
|
||||
mode:
|
||||
typeof (response.data as Record<string, unknown>)?.mode === "string"
|
||||
? String((response.data as Record<string, unknown>).mode)
|
||||
: this.configService.get("AI_ENGINE_MODE", "v25"),
|
||||
: this.configService.get("AI_ENGINE_MODE", "v28-pro-max"),
|
||||
};
|
||||
} catch (error: unknown) {
|
||||
const requestError =
|
||||
@@ -207,7 +207,7 @@ export class PredictionsService implements OnModuleInit, OnModuleDestroy {
|
||||
typeof requestError.detail === "string"
|
||||
? requestError.detail
|
||||
: requestError.message,
|
||||
mode: this.configService.get("AI_ENGINE_MODE", "v25"),
|
||||
mode: this.configService.get("AI_ENGINE_MODE", "v28-pro-max"),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -216,31 +216,12 @@ export class PredictionsService implements OnModuleInit, OnModuleDestroy {
|
||||
await this.ensurePredictionDataReady(matchId);
|
||||
const matchContext = await this.getMatchContext(matchId);
|
||||
|
||||
// Queue mode (Redis enabled)
|
||||
if (this.predictionsQueue && this.queueEvents) {
|
||||
try {
|
||||
const job = await this.predictionsQueue.addPredictMatchJob({ matchId });
|
||||
const data = await job.waitUntilFinished(this.queueEvents, 30000);
|
||||
if (!data || data.error) {
|
||||
return null;
|
||||
}
|
||||
await this.recordPredictionRun(matchId, data as MatchPredictionDto);
|
||||
return this.enrichPredictionResponse(
|
||||
data as MatchPredictionDto,
|
||||
matchContext,
|
||||
);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
this.logger.error(`Prediction queue failed for ${matchId}: ${message}`);
|
||||
this.throwAiError(message);
|
||||
}
|
||||
}
|
||||
|
||||
// Queue mode (Redis enabled) - REMOVED per user request to always fetch from scratch
|
||||
// Direct HTTP mode (no Redis)
|
||||
try {
|
||||
const response = await this.aiEngineClient.post<MatchPredictionDto>(
|
||||
`/v20plus/analyze/${matchId}`,
|
||||
{},
|
||||
{ simulate: true, is_simulation: true, pre_match_only: true },
|
||||
);
|
||||
await this.recordPredictionRun(matchId, response.data);
|
||||
return this.enrichPredictionResponse(
|
||||
@@ -321,7 +302,7 @@ export class PredictionsService implements OnModuleInit, OnModuleDestroy {
|
||||
|
||||
return {
|
||||
count: upcoming.length,
|
||||
modelVersion: "v25-v30-ensemble",
|
||||
modelVersion: "v28-pro-max",
|
||||
matches: upcoming.map((p) => {
|
||||
const out = p.predictionJson as Record<string, unknown>;
|
||||
const matchInfo = (out?.match_info || {}) as Record<string, unknown>;
|
||||
@@ -560,6 +541,7 @@ export class PredictionsService implements OnModuleInit, OnModuleDestroy {
|
||||
bet_advice: betAdvice as MatchPredictionDto["bet_advice"],
|
||||
market_board: enrichedMarketBoard,
|
||||
reasoning_factors: reasoningFactors,
|
||||
model_version: "v28-pro-max",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1143,7 +1125,7 @@ export class PredictionsService implements OnModuleInit, OnModuleDestroy {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!modelVersion.startsWith("v25")) {
|
||||
if (!modelVersion.startsWith("v28-pro-max")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,11 @@ export class PredictionsProcessor extends WorkerHost {
|
||||
try {
|
||||
const response = await axios.post(
|
||||
`${this.aiEngineUrl}/v20plus/analyze/${matchId}`,
|
||||
{},
|
||||
{
|
||||
simulate: data.simulate,
|
||||
is_simulation: data.is_simulation,
|
||||
pre_match_only: data.pre_match_only,
|
||||
},
|
||||
{ timeout: 30000 },
|
||||
);
|
||||
return response.data;
|
||||
|
||||
@@ -13,6 +13,9 @@ export enum PredictionJobType {
|
||||
export interface PredictMatchJobData {
|
||||
matchId: string;
|
||||
forceUpdate?: boolean;
|
||||
simulate?: boolean;
|
||||
is_simulation?: boolean;
|
||||
pre_match_only?: boolean;
|
||||
}
|
||||
|
||||
export interface SmartCouponJobData {
|
||||
|
||||
Reference in New Issue
Block a user