@promptbook/components 0.104.0-7 → 0.104.0-9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.es.js +56 -3
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.closed.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +2 -2
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +10 -6
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +6 -3
- package/esm/typings/src/utils/color/utils/colorToDataUrl.d.ts +2 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +56 -3
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -35,7 +35,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
35
35
|
* @generated
|
|
36
36
|
* @see https://github.com/webgptorg/promptbook
|
|
37
37
|
*/
|
|
38
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-
|
|
38
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-9';
|
|
39
39
|
/**
|
|
40
40
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
41
41
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -8786,6 +8786,52 @@ function furthest(...colors) {
|
|
|
8786
8786
|
*/
|
|
8787
8787
|
const textColor = furthest(Color.get('white'), Color.from('black'));
|
|
8788
8788
|
|
|
8789
|
+
/**
|
|
8790
|
+
* Makes data url from color
|
|
8791
|
+
*
|
|
8792
|
+
* @public exported from `@promptbook/color`
|
|
8793
|
+
*/
|
|
8794
|
+
function colorToDataUrl(color) {
|
|
8795
|
+
if (typeof color === 'string') {
|
|
8796
|
+
color = Color.fromHex(color);
|
|
8797
|
+
}
|
|
8798
|
+
return rgbDataURL(color.red, color.green, color.blue);
|
|
8799
|
+
}
|
|
8800
|
+
/**
|
|
8801
|
+
* Pixel GIF code adapted from https://stackoverflow.com/a/33919020/266535
|
|
8802
|
+
*
|
|
8803
|
+
* @private util of `colorToDataUrl`
|
|
8804
|
+
*/
|
|
8805
|
+
const keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
8806
|
+
/**
|
|
8807
|
+
* Generates a base64-encoded triplet string
|
|
8808
|
+
*
|
|
8809
|
+
* @param e1 - The first element in the triplet.
|
|
8810
|
+
* @param e2 - The second element in the triplet.
|
|
8811
|
+
* @param e3 - The third element in the triplet.
|
|
8812
|
+
* @returns The base64-encoded triplet string.
|
|
8813
|
+
*
|
|
8814
|
+
* @private util of `colorToDataUrl`
|
|
8815
|
+
*/
|
|
8816
|
+
const triplet = (e1, e2, e3) => keyStr.charAt(e1 >> 2) +
|
|
8817
|
+
keyStr.charAt(((e1 & 3) << 4) | (e2 >> 4)) +
|
|
8818
|
+
keyStr.charAt(((e2 & 15) << 2) | (e3 >> 6)) +
|
|
8819
|
+
keyStr.charAt(e3 & 63);
|
|
8820
|
+
/**
|
|
8821
|
+
* Converts RGB values to a data URL string
|
|
8822
|
+
*
|
|
8823
|
+
* @param r - The red channel value.
|
|
8824
|
+
* @param g - The green channel value.
|
|
8825
|
+
* @param b - The blue channel value.
|
|
8826
|
+
* @returns The RGB data URL string.
|
|
8827
|
+
*
|
|
8828
|
+
* @private util of `colorToDataUrl`
|
|
8829
|
+
*/
|
|
8830
|
+
const rgbDataURL = (r, g, b) => `data:image/gif;base64,R0lGODlhAQABAPAA${triplet(0, r, g) + triplet(b, 255, 255)}/yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==`;
|
|
8831
|
+
/**
|
|
8832
|
+
* TODO: Make as functions NOT const
|
|
8833
|
+
*/
|
|
8834
|
+
|
|
8789
8835
|
/**
|
|
8790
8836
|
* Restricts an Updatable to a (2) BehaviorSubject variant
|
|
8791
8837
|
*
|
|
@@ -9513,7 +9559,7 @@ const AVATAR_SIZE = 40;
|
|
|
9513
9559
|
* @private internal subcomponent of `<Chat>` component
|
|
9514
9560
|
*/
|
|
9515
9561
|
const ChatMessageItem = memo(({ message, participant, participants, isLastMessage, onMessage, setExpandedMessageId, isExpanded, currentRating, handleRating, mode, isCopyButtonEnabled, isFeedbackEnabled, onCopy, onCreateAgent, }) => {
|
|
9516
|
-
const avatarSrc = (participant === null || participant === void 0 ? void 0 : participant.avatarSrc) ||
|
|
9562
|
+
const avatarSrc = (participant === null || participant === void 0 ? void 0 : participant.avatarSrc) || null;
|
|
9517
9563
|
const [isAvatarTooltipVisible, setIsAvatarTooltipVisible] = useState(false);
|
|
9518
9564
|
const [avatarTooltipPosition, setAvatarTooltipPosition] = useState(null);
|
|
9519
9565
|
const hoverTimeoutRef = useRef(null);
|
|
@@ -9607,9 +9653,11 @@ const ChatMessageItem = memo(({ message, participant, participants, isLastMessag
|
|
|
9607
9653
|
}, children: [avatarSrc && (jsxs("div", { ref: avatarRef, className: chatStyles.avatar, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onClick: showTooltip, children: [jsx("img", { width: AVATAR_SIZE, src: avatarSrc, alt: `Avatar of ${message.sender.toString().toLocaleLowerCase()}`, style: {
|
|
9608
9654
|
'--avatar-bg-color': color.toHex(),
|
|
9609
9655
|
objectFit: 'cover',
|
|
9656
|
+
objectPosition: '50% 20%',
|
|
9610
9657
|
width: AVATAR_SIZE,
|
|
9611
9658
|
height: AVATAR_SIZE,
|
|
9612
9659
|
aspectRatio: '1 / 1',
|
|
9660
|
+
backgroundImage: `url(${colorToDataUrl(color)})`,
|
|
9613
9661
|
} }), isAvatarTooltipVisible && (participant === null || participant === void 0 ? void 0 : participant.agentSource) && avatarTooltipPosition && (jsx(AvatarProfileTooltip, { ref: tooltipRef, agentSource: participant.agentSource, position: avatarTooltipPosition }))] })), jsxs("div", { className: chatStyles.messageText, style: {
|
|
9614
9662
|
'--message-bg-color': color.toHex(),
|
|
9615
9663
|
'--message-text-color': colorOfText.toHex(),
|
|
@@ -15281,7 +15329,12 @@ async function createAgentModelRequirementsWithCommitments(agentSource, modelNam
|
|
|
15281
15329
|
};
|
|
15282
15330
|
}
|
|
15283
15331
|
// Apply each commitment in order using reduce-like pattern
|
|
15284
|
-
for (
|
|
15332
|
+
for (let i = 0; i < filteredCommitments.length; i++) {
|
|
15333
|
+
const commitment = filteredCommitments[i];
|
|
15334
|
+
// CLOSED commitment should work only if its the last commitment in the book
|
|
15335
|
+
if (commitment.type === 'CLOSED' && i !== filteredCommitments.length - 1) {
|
|
15336
|
+
continue;
|
|
15337
|
+
}
|
|
15285
15338
|
const definition = getCommitmentDefinition(commitment.type);
|
|
15286
15339
|
if (definition) {
|
|
15287
15340
|
try {
|