@promptbook/components 0.104.0-4 โ 0.104.0-6
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 +6 -44
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +6 -6
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +3 -3
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +18 -15
- package/esm/typings/src/types/typeAliases.d.ts +4 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +6 -44
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-2.0/utils/generateGravatarUrl.d.ts +0 -10
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-6';
|
|
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,44 +153,6 @@ 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
|
*
|
|
@@ -7383,10 +7345,6 @@ function parseAgentSource(agentSource) {
|
|
|
7383
7345
|
const metaType = normalizeTo_camelCase(metaTypeRaw);
|
|
7384
7346
|
meta[metaType] = spaceTrim$2(commitment.content.substring(metaTypeRaw.length));
|
|
7385
7347
|
}
|
|
7386
|
-
// Generate gravatar fallback if no meta image specified
|
|
7387
|
-
if (!meta.image) {
|
|
7388
|
-
meta.image = generatePlaceholderAgentProfileImageUrl(parseResult.agentName || '!!');
|
|
7389
|
-
}
|
|
7390
7348
|
// Generate fullname fallback if no meta fullname specified
|
|
7391
7349
|
if (!meta.fullname) {
|
|
7392
7350
|
meta.fullname = parseResult.agentName || createDefaultAgentName(agentSource);
|
|
@@ -9646,7 +9604,10 @@ const ChatMessageItem = memo(({ message, participant, participants, isLastMessag
|
|
|
9646
9604
|
console.groupEnd();
|
|
9647
9605
|
}, 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
9606
|
'--avatar-bg-color': color.toHex(),
|
|
9607
|
+
objectFit: 'cover',
|
|
9649
9608
|
width: AVATAR_SIZE,
|
|
9609
|
+
height: AVATAR_SIZE,
|
|
9610
|
+
aspectRatio: '1 / 1',
|
|
9650
9611
|
} }), 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
9612
|
'--message-bg-color': color.toHex(),
|
|
9652
9613
|
'--message-text-color': colorOfText.toHex(),
|
|
@@ -18134,7 +18095,8 @@ function PromptbookAgentSeamlessIntegration(props) {
|
|
|
18134
18095
|
// TODO: [๐ง ] Handle error state (show error message in the chat window)
|
|
18135
18096
|
const image = ((_a = agent === null || agent === void 0 ? void 0 : agent.meta) === null || _a === void 0 ? void 0 : _a.image) ||
|
|
18136
18097
|
(meta === null || meta === void 0 ? void 0 : meta.image) ||
|
|
18137
|
-
|
|
18098
|
+
// Note: [๐คน] Using default avatar from the agent server
|
|
18099
|
+
`${agentUrl}/images/default-avatar.png`;
|
|
18138
18100
|
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
18101
|
let connectionStatus = 'pending';
|
|
18140
18102
|
if (agent) {
|