@promptbook/components 0.104.0-5 โ†’ 0.104.0-7

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 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-5';
38
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0-7';
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
@@ -153,48 +153,12 @@ function normalizeTo_camelCase(text, _isFirstLetterCapital = false) {
153
153
  * TODO: [๐ŸŒบ] Use some intermediate util splitWords
154
154
  */
155
155
 
156
- /**
157
- * Generates a gravatar URL based on agent name for fallback avatar
158
- *
159
- * @param agentName The agent name to generate avatar for
160
- * @returns Gravatar URL
161
- *
162
- * @private - [๐Ÿคน] The fact that profile image is Gravatar is just implementation detail which should be hidden for consumer
163
- */
164
- function generateGravatarUrl(agentName) {
165
- // Use a default name if none provided
166
- const safeName = agentName || 'Anonymous Agent';
167
- // Create a simple hash from the name for consistent avatar
168
- let hash = 0;
169
- for (let i = 0; i < safeName.length; i++) {
170
- const char = safeName.charCodeAt(i);
171
- hash = (hash << 5) - hash + char;
172
- hash = hash & hash; // Convert to 32bit integer
173
- }
174
- const avatarId = Math.abs(hash).toString();
175
- return `https://www.gravatar.com/avatar/${avatarId}?default=robohash&size=200&rating=x`;
176
- }
177
-
178
- /**
179
- * Generates an image for the agent to use as profile image
180
- *
181
- * @param agentName The agent name to generate avatar for
182
- * @returns The placeholder profile image URL for the agent
183
- *
184
- * @public exported from `@promptbook/core`
185
- */
186
- function generatePlaceholderAgentProfileImageUrl(agentName) {
187
- // Note: [๐Ÿคน] The fact that profile image is Gravatar is just implementation detail which should be hidden for consumer
188
- return generateGravatarUrl(agentName);
189
- }
190
- /**
191
- * TODO: [๐Ÿคน] Figure out best placeholder image generator https://i.pravatar.cc/1000?u=568
192
- */
193
-
194
156
  /**
195
157
  * Core Promptbook server configuration.
196
158
  *
197
159
  * This server is also used for auto-federation in the Agents Server.
160
+ *
161
+ * @public exported from `@promptbook/core`
198
162
  */
199
163
  const CORE_SERVER = {
200
164
  title: 'Promptbook Core',
@@ -7383,10 +7347,6 @@ function parseAgentSource(agentSource) {
7383
7347
  const metaType = normalizeTo_camelCase(metaTypeRaw);
7384
7348
  meta[metaType] = spaceTrim$2(commitment.content.substring(metaTypeRaw.length));
7385
7349
  }
7386
- // Generate gravatar fallback if no meta image specified
7387
- if (!meta.image) {
7388
- meta.image = generatePlaceholderAgentProfileImageUrl(parseResult.agentName || '!!');
7389
- }
7390
7350
  // Generate fullname fallback if no meta fullname specified
7391
7351
  if (!meta.fullname) {
7392
7352
  meta.fullname = parseResult.agentName || createDefaultAgentName(agentSource);
@@ -9646,7 +9606,10 @@ const ChatMessageItem = memo(({ message, participant, participants, isLastMessag
9646
9606
  console.groupEnd();
9647
9607
  }, 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: {
9648
9608
  '--avatar-bg-color': color.toHex(),
9609
+ objectFit: 'cover',
9649
9610
  width: AVATAR_SIZE,
9611
+ height: AVATAR_SIZE,
9612
+ aspectRatio: '1 / 1',
9650
9613
  } }), 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: {
9651
9614
  '--message-bg-color': color.toHex(),
9652
9615
  '--message-text-color': colorOfText.toHex(),
@@ -16746,13 +16709,14 @@ class OpenAiCompatibleExecutionTools {
16746
16709
  const modelName = currentModelRequirements.modelName || this.getDefaultImageGenerationModel().modelName;
16747
16710
  const modelSettings = {
16748
16711
  model: modelName,
16749
- // size: currentModelRequirements.size,
16750
- // quality: currentModelRequirements.quality,
16751
- // style: currentModelRequirements.style,
16712
+ size: currentModelRequirements.size,
16713
+ quality: currentModelRequirements.quality,
16714
+ style: currentModelRequirements.style,
16752
16715
  };
16753
16716
  const rawPromptContent = templateParameters(content, { ...parameters, modelName });
16754
16717
  const rawRequest = {
16755
16718
  ...modelSettings,
16719
+ size: modelSettings.size || '1024x1024',
16756
16720
  prompt: rawPromptContent,
16757
16721
  user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
16758
16722
  response_format: 'url', // TODO: [๐Ÿง ] Maybe allow b64_json
@@ -18134,7 +18098,8 @@ function PromptbookAgentSeamlessIntegration(props) {
18134
18098
  // TODO: [๐Ÿง ] Handle error state (show error message in the chat window)
18135
18099
  const image = ((_a = agent === null || agent === void 0 ? void 0 : agent.meta) === null || _a === void 0 ? void 0 : _a.image) ||
18136
18100
  (meta === null || meta === void 0 ? void 0 : meta.image) ||
18137
- 'https://www.gravatar.com/avatar/00000000000000000000000000000000?d=mp&f=y';
18101
+ // Note: [๐Ÿคน] Using default avatar from the agent server
18102
+ `${agentUrl}/images/default-avatar.png`;
18138
18103
  const color = ((_b = agent === null || agent === void 0 ? void 0 : agent.meta) === null || _b === void 0 ? void 0 : _b.color) || (meta === null || meta === void 0 ? void 0 : meta.color);
18139
18104
  let connectionStatus = 'pending';
18140
18105
  if (agent) {