fix: TypeScript build errors — RedisService.keys(), eventBus void, Qdrant API
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:
WangDL 2026-05-24 10:22:56 +08:00
parent 5fd737967f
commit af800b2eb5
3 changed files with 19 additions and 13 deletions

View File

@ -90,6 +90,10 @@ export class RedisService implements OnModuleInit, OnModuleDestroy {
return result === 'OK' ? token : null;
}
async keys(pattern: string): Promise<string[]> {
return this.client.keys(pattern);
}
async unlock(key: string, token: string): Promise<boolean> {
const script = `
if redis.call('get', KEYS[1]) == ARGV[1] then

View File

@ -90,7 +90,7 @@ export class AiGatewayService {
}).catch(() => {});
// Publish cost event for Quota/Cost module
this.eventBus?.publish(new AIUsageRecorded({
try { this.eventBus?.publish(new AIUsageRecorded({
userId: request.userId,
feature: request.feature,
provider: target.provider,
@ -99,7 +99,7 @@ export class AiGatewayService {
outputTokens: output.usage.outputTokens,
estimatedCost,
timestamp: new Date().toISOString(),
})).catch(() => {});
})); } catch {}
clearTimeout(timeoutId);
return {
@ -135,14 +135,16 @@ export class AiGatewayService {
},
}).catch(() => {});
this.eventBus?.publish(new ModelFallbackTriggered({
tier: request.tier,
fromProvider: tierConfig.preferred.provider,
fromModel: tierConfig.preferred.model,
toProvider: fb.provider,
toModel: fb.model,
errorMessage: lastError.message?.slice(0, 200),
})).catch(() => {});
try {
this.eventBus?.publish(new ModelFallbackTriggered({
tier: request.tier,
fromProvider: tierConfig.preferred.provider,
fromModel: tierConfig.preferred.model,
toProvider: fb.provider,
toModel: fb.model,
errorMessage: lastError.message?.slice(0, 200),
}));
} catch {}
}
}
}

View File

@ -70,9 +70,9 @@ export class VectorService implements OnModuleInit {
vectors: { size: VECTOR_SIZE, distance: 'Cosine' },
hnsw_config: { m: 16, ef_construct: 100 },
});
await this.client.createPayloadIndex(COLLECTION_NAME, 'userId', { type: 'keyword' });
await this.client.createPayloadIndex(COLLECTION_NAME, 'knowledgeBaseId', { type: 'keyword' });
await this.client.createPayloadIndex(COLLECTION_NAME, 'deleted', { type: 'bool' });
await this.client.createPayloadIndex(COLLECTION_NAME, { field_name: 'userId', field_schema: 'keyword' });
await this.client.createPayloadIndex(COLLECTION_NAME, { field_name: 'knowledgeBaseId', field_schema: 'keyword' });
await this.client.createPayloadIndex(COLLECTION_NAME, { field_name: 'deleted', field_schema: 'bool' });
this.logger.log(`Created Qdrant collection: ${COLLECTION_NAME}`);
} catch (err: any) {
this.logger.error(`Failed to create Qdrant collection: ${err.message}`);