@vfarcic/dot-ai
Version:
AI-powered development productivity platform that enhances software development workflows through intelligent automation and AI-driven assistance
65 lines (64 loc) • 2.26 kB
JavaScript
;
/**
* Policy Vector Service
*
* Handles policy intent-specific Vector DB operations
* Extends BaseVectorService for policy intents
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.PolicyVectorService = void 0;
const base_vector_service_1 = require("./base-vector-service");
class PolicyVectorService extends base_vector_service_1.BaseVectorService {
constructor(embeddingService) {
super('policies', embeddingService);
}
// Implement abstract methods from BaseVectorService
createSearchText(policyIntent) {
const triggerText = policyIntent.triggers.join(' ');
return `${policyIntent.description} ${triggerText} ${policyIntent.rationale}`.toLowerCase();
}
extractId(policyIntent) {
return policyIntent.id;
}
createPayload(policyIntent) {
return {
description: policyIntent.description,
triggers: policyIntent.triggers.map(t => t.toLowerCase()),
rationale: policyIntent.rationale,
createdAt: policyIntent.createdAt,
createdBy: policyIntent.createdBy,
deployedPolicies: policyIntent.deployedPolicies || []
};
}
payloadToData(payload) {
return {
id: '', // Will be set from document ID in base class
description: payload.description,
triggers: payload.triggers,
rationale: payload.rationale,
createdAt: payload.createdAt,
createdBy: payload.createdBy,
deployedPolicies: payload.deployedPolicies || []
};
}
// Public API methods - delegate to base class with appropriate names
async storePolicyIntent(policyIntent) {
await this.storeData(policyIntent);
}
async searchPolicyIntents(query, options = {}) {
return await this.searchData(query, options);
}
async getPolicyIntent(id) {
return await this.getData(id);
}
async getAllPolicyIntents() {
return await this.getAllData();
}
async deletePolicyIntent(id) {
await this.deleteData(id);
}
async getPolicyIntentsCount() {
return await this.getDataCount();
}
}
exports.PolicyVectorService = PolicyVectorService;