Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nycrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
"src/agents/org-detector/instructions.js",
"src/controllers/demo.js"
]
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@
],
"ext": ".js, .cjs, .ejs, .css"
}
}
}
11 changes: 6 additions & 5 deletions src/controllers/llmo/llmo.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const LLMO_SHEETDATA_SOURCE_URL = 'https://main--project-elmo-ui-data--adobe.aem

function LlmoController(ctx) {
const accessControlUtil = AccessControlUtil.fromContext(ctx);

// Helper function to get site and validate LLMO config
const getSiteAndValidateLlmo = async (context) => {
const { siteId } = context.params;
Expand Down Expand Up @@ -140,7 +141,7 @@ function LlmoController(ctx) {
headers: {
Authorization: `token ${env.LLMO_HLX_API_KEY || 'hlx_api_key_missing'}`,
'User-Agent': SPACECAT_USER_AGENT,
'Accept-Encoding': 'gzip',
'Accept-Encoding': 'br',
},
});

Expand All @@ -152,7 +153,7 @@ function LlmoController(ctx) {
// Get the response data
const data = await response.json();

// Return the data and let the framework handle the compression
// Return the data, pass through any compression headers from upstream
return ok(data, {
...(response.headers ? Object.fromEntries(response.headers.entries()) : {}),
});
Expand Down Expand Up @@ -236,7 +237,7 @@ function LlmoController(ctx) {
headers: {
Authorization: `token ${env.LLMO_HLX_API_KEY || 'hlx_api_key_missing'}`,
'User-Agent': SPACECAT_USER_AGENT,
'Accept-Encoding': 'gzip',
'Accept-Encoding': 'br',
},
});

Expand Down Expand Up @@ -318,7 +319,7 @@ function LlmoController(ctx) {
const totalDuration = methodEndTime - methodStartTime;
log.info(`LLMO query completed - total duration: ${totalDuration}ms (fetch: ${fetchDuration}ms, inclusion: ${inclusionDuration}ms, filtering: ${filterDuration}ms, exclusion: ${exclusionDuration}ms, grouping: ${groupingDuration}ms, mapping: ${mappingDuration}ms)`);

// Return the data and let the framework handle the compression
// Return the data, pass through any compression headers from upstream
return ok(data, {
...(response.headers ? Object.fromEntries(response.headers.entries()) : {}),
});
Expand Down Expand Up @@ -361,7 +362,7 @@ function LlmoController(ctx) {
headers: {
Authorization: `token ${env.LLMO_HLX_API_KEY || 'hlx_api_key_missing'}`,
'User-Agent': SPACECAT_USER_AGENT,
'Accept-Encoding': 'gzip',
'Accept-Encoding': 'br',
},
});

Expand Down
4 changes: 2 additions & 2 deletions test/controllers/llmo/llmo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ describe('LlmoController', () => {
headers: {
Authorization: `token ${TEST_API_KEY}`,
'User-Agent': TEST_USER_AGENT,
'Accept-Encoding': 'gzip',
'Accept-Encoding': 'br',
},
});
});
Expand Down Expand Up @@ -366,7 +366,7 @@ describe('LlmoController', () => {
headers: {
Authorization: 'token hlx_api_key_missing',
'User-Agent': TEST_USER_AGENT,
'Accept-Encoding': 'gzip',
'Accept-Encoding': 'br',
},
});
});
Expand Down