fix: TypeScript build errors — RedisService.keys(), eventBus void, Qdrant API
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 22s
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 22s
- Add keys() method to RedisService for WorkerHeartbeat - Wrap eventBus.publish() calls in try/catch (returns void) - Fix Qdrant createPayloadIndex API signature (2 args, not 3) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
5fd737967f
commit
af800b2eb5
@ -90,6 +90,10 @@ export class RedisService implements OnModuleInit, OnModuleDestroy {
|
|||||||
return result === 'OK' ? token : null;
|
return result === 'OK' ? token : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async keys(pattern: string): Promise<string[]> {
|
||||||
|
return this.client.keys(pattern);
|
||||||
|
}
|
||||||
|
|
||||||
async unlock(key: string, token: string): Promise<boolean> {
|
async unlock(key: string, token: string): Promise<boolean> {
|
||||||
const script = `
|
const script = `
|
||||||
if redis.call('get', KEYS[1]) == ARGV[1] then
|
if redis.call('get', KEYS[1]) == ARGV[1] then
|
||||||
|
|||||||
@ -90,7 +90,7 @@ export class AiGatewayService {
|
|||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
|
|
||||||
// Publish cost event for Quota/Cost module
|
// Publish cost event for Quota/Cost module
|
||||||
this.eventBus?.publish(new AIUsageRecorded({
|
try { this.eventBus?.publish(new AIUsageRecorded({
|
||||||
userId: request.userId,
|
userId: request.userId,
|
||||||
feature: request.feature,
|
feature: request.feature,
|
||||||
provider: target.provider,
|
provider: target.provider,
|
||||||
@ -99,7 +99,7 @@ export class AiGatewayService {
|
|||||||
outputTokens: output.usage.outputTokens,
|
outputTokens: output.usage.outputTokens,
|
||||||
estimatedCost,
|
estimatedCost,
|
||||||
timestamp: new Date().toISOString(),
|
timestamp: new Date().toISOString(),
|
||||||
})).catch(() => {});
|
})); } catch {}
|
||||||
|
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
return {
|
return {
|
||||||
@ -135,14 +135,16 @@ export class AiGatewayService {
|
|||||||
},
|
},
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
|
|
||||||
this.eventBus?.publish(new ModelFallbackTriggered({
|
try {
|
||||||
tier: request.tier,
|
this.eventBus?.publish(new ModelFallbackTriggered({
|
||||||
fromProvider: tierConfig.preferred.provider,
|
tier: request.tier,
|
||||||
fromModel: tierConfig.preferred.model,
|
fromProvider: tierConfig.preferred.provider,
|
||||||
toProvider: fb.provider,
|
fromModel: tierConfig.preferred.model,
|
||||||
toModel: fb.model,
|
toProvider: fb.provider,
|
||||||
errorMessage: lastError.message?.slice(0, 200),
|
toModel: fb.model,
|
||||||
})).catch(() => {});
|
errorMessage: lastError.message?.slice(0, 200),
|
||||||
|
}));
|
||||||
|
} catch {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,9 +70,9 @@ export class VectorService implements OnModuleInit {
|
|||||||
vectors: { size: VECTOR_SIZE, distance: 'Cosine' },
|
vectors: { size: VECTOR_SIZE, distance: 'Cosine' },
|
||||||
hnsw_config: { m: 16, ef_construct: 100 },
|
hnsw_config: { m: 16, ef_construct: 100 },
|
||||||
});
|
});
|
||||||
await this.client.createPayloadIndex(COLLECTION_NAME, 'userId', { type: 'keyword' });
|
await this.client.createPayloadIndex(COLLECTION_NAME, { field_name: 'userId', field_schema: 'keyword' });
|
||||||
await this.client.createPayloadIndex(COLLECTION_NAME, 'knowledgeBaseId', { type: 'keyword' });
|
await this.client.createPayloadIndex(COLLECTION_NAME, { field_name: 'knowledgeBaseId', field_schema: 'keyword' });
|
||||||
await this.client.createPayloadIndex(COLLECTION_NAME, 'deleted', { type: 'bool' });
|
await this.client.createPayloadIndex(COLLECTION_NAME, { field_name: 'deleted', field_schema: 'bool' });
|
||||||
this.logger.log(`Created Qdrant collection: ${COLLECTION_NAME}`);
|
this.logger.log(`Created Qdrant collection: ${COLLECTION_NAME}`);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this.logger.error(`Failed to create Qdrant collection: ${err.message}`);
|
this.logger.error(`Failed to create Qdrant collection: ${err.message}`);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user