@promptbook/components 0.104.0-6 → 0.104.0-8
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 -5
- package/esm/index.es.js.map +1 -1
- package/esm/typings/servers.d.ts +8 -0
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +2 -2
- package/esm/typings/src/types/ModelRequirements.d.ts +38 -14
- package/esm/typings/src/types/typeAliases.d.ts +7 -1
- 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 -5
- 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-8';
|
|
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
|
|
@@ -157,6 +157,8 @@ function normalizeTo_camelCase(text, _isFirstLetterCapital = false) {
|
|
|
157
157
|
* Core Promptbook server configuration.
|
|
158
158
|
*
|
|
159
159
|
* This server is also used for auto-federation in the Agents Server.
|
|
160
|
+
*
|
|
161
|
+
* @public exported from `@promptbook/core`
|
|
160
162
|
*/
|
|
161
163
|
const CORE_SERVER = {
|
|
162
164
|
title: 'Promptbook Core',
|
|
@@ -8784,6 +8786,52 @@ function furthest(...colors) {
|
|
|
8784
8786
|
*/
|
|
8785
8787
|
const textColor = furthest(Color.get('white'), Color.from('black'));
|
|
8786
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
|
+
|
|
8787
8835
|
/**
|
|
8788
8836
|
* Restricts an Updatable to a (2) BehaviorSubject variant
|
|
8789
8837
|
*
|
|
@@ -9511,7 +9559,7 @@ const AVATAR_SIZE = 40;
|
|
|
9511
9559
|
* @private internal subcomponent of `<Chat>` component
|
|
9512
9560
|
*/
|
|
9513
9561
|
const ChatMessageItem = memo(({ message, participant, participants, isLastMessage, onMessage, setExpandedMessageId, isExpanded, currentRating, handleRating, mode, isCopyButtonEnabled, isFeedbackEnabled, onCopy, onCreateAgent, }) => {
|
|
9514
|
-
const avatarSrc = (participant === null || participant === void 0 ? void 0 : participant.avatarSrc) ||
|
|
9562
|
+
const avatarSrc = (participant === null || participant === void 0 ? void 0 : participant.avatarSrc) || null;
|
|
9515
9563
|
const [isAvatarTooltipVisible, setIsAvatarTooltipVisible] = useState(false);
|
|
9516
9564
|
const [avatarTooltipPosition, setAvatarTooltipPosition] = useState(null);
|
|
9517
9565
|
const hoverTimeoutRef = useRef(null);
|
|
@@ -9605,9 +9653,11 @@ const ChatMessageItem = memo(({ message, participant, participants, isLastMessag
|
|
|
9605
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: {
|
|
9606
9654
|
'--avatar-bg-color': color.toHex(),
|
|
9607
9655
|
objectFit: 'cover',
|
|
9656
|
+
objectPosition: '50% 20%',
|
|
9608
9657
|
width: AVATAR_SIZE,
|
|
9609
9658
|
height: AVATAR_SIZE,
|
|
9610
9659
|
aspectRatio: '1 / 1',
|
|
9660
|
+
backgroundImage: `url(${colorToDataUrl(color)})`,
|
|
9611
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: {
|
|
9612
9662
|
'--message-bg-color': color.toHex(),
|
|
9613
9663
|
'--message-text-color': colorOfText.toHex(),
|
|
@@ -16707,13 +16757,14 @@ class OpenAiCompatibleExecutionTools {
|
|
|
16707
16757
|
const modelName = currentModelRequirements.modelName || this.getDefaultImageGenerationModel().modelName;
|
|
16708
16758
|
const modelSettings = {
|
|
16709
16759
|
model: modelName,
|
|
16710
|
-
|
|
16711
|
-
|
|
16712
|
-
|
|
16760
|
+
size: currentModelRequirements.size,
|
|
16761
|
+
quality: currentModelRequirements.quality,
|
|
16762
|
+
style: currentModelRequirements.style,
|
|
16713
16763
|
};
|
|
16714
16764
|
const rawPromptContent = templateParameters(content, { ...parameters, modelName });
|
|
16715
16765
|
const rawRequest = {
|
|
16716
16766
|
...modelSettings,
|
|
16767
|
+
size: modelSettings.size || '1024x1024',
|
|
16717
16768
|
prompt: rawPromptContent,
|
|
16718
16769
|
user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
16719
16770
|
response_format: 'url', // TODO: [🧠] Maybe allow b64_json
|