Files
klz-cables.com/.pnpm-store/v10/files/c9/2a25779ff976c59c67d38b7a366c0f0a7cdacbe1ef04d9376137688027d4a957c0735983e2010a01b9f900a2010b3d7a21be643f4acc3ed3048dccd4c4e464
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

52 lines
1.5 KiB
Plaintext

Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const constants = require('./constants.js');
/**
* Check if a method path should be instrumented
*/
function shouldInstrument(methodPath) {
// Check for exact matches first (like 'models.generateContent')
if (constants.GOOGLE_GENAI_INSTRUMENTED_METHODS.includes(methodPath )) {
return true;
}
// Check for method name matches (like 'sendMessage' from chat instances)
const methodName = methodPath.split('.').pop();
return constants.GOOGLE_GENAI_INSTRUMENTED_METHODS.includes(methodName );
}
/**
* Check if a method is a streaming method
*/
function isStreamingMethod(methodPath) {
return methodPath.includes('Stream');
}
// Copied from https://googleapis.github.io/js-genai/release_docs/index.html
/**
*
*/
function contentUnionToMessages(content, role = 'user') {
if (typeof content === 'string') {
return [{ role, content }];
}
if (Array.isArray(content)) {
return content.flatMap(content => contentUnionToMessages(content, role));
}
if (typeof content !== 'object' || !content) return [];
if ('role' in content && typeof content.role === 'string') {
return [content ];
}
if ('parts' in content) {
return [{ ...content, role } ];
}
return [{ role, content }];
}
exports.contentUnionToMessages = contentUnionToMessages;
exports.isStreamingMethod = isStreamingMethod;
exports.shouldInstrument = shouldInstrument;
//# sourceMappingURL=utils.js.map