Skip to content

Commit 44828e6

Browse files
authored
[AI-FSSDK] [FSSDK-12750] Use attribute id instead of key for CMAB prediction requests (#1160)
1 parent 49b58cc commit 44828e6

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

lib/core/decision_service/cmab/cmab_service.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ describe('DefaultCmabService', () => {
9696
expect(ruleIdArg).toEqual(ruleId);
9797
expect(userIdArg).toEqual(userContext.getUserId());
9898
expect(attributesArg).toEqual({
99-
country: 'US',
100-
age: '25',
99+
'66': 'US',
100+
'77': '25',
101101
});
102102
});
103103

@@ -124,13 +124,13 @@ describe('DefaultCmabService', () => {
124124

125125
expect(mockCmabClient.fetchDecision).toHaveBeenCalledTimes(2);
126126
expect(mockCmabClient.fetchDecision.mock.calls[0][2]).toEqual({
127-
country: 'US',
128-
age: '25',
129-
language: 'en',
127+
'66': 'US',
128+
'77': '25',
129+
'88': 'en',
130130
});
131131
expect(mockCmabClient.fetchDecision.mock.calls[1][2]).toEqual({
132-
country: 'US',
133-
gender: 'male'
132+
'66': 'US',
133+
'99': 'male'
134134
});
135135
});
136136

lib/core/decision_service/cmab/cmab_service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ export class DefaultCmabService implements CmabService {
182182

183183
cmabAttributeIds.forEach((aid) => {
184184
const attribute = projectConfig.attributeIdMap[aid];
185-
185+
186186
if (userAttributes.hasOwnProperty(attribute.key)) {
187-
filteredAttributes[attribute.key] = userAttributes[attribute.key];
187+
filteredAttributes[aid] = userAttributes[attribute.key];
188188
}
189189
});
190190

0 commit comments

Comments
 (0)