@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/typings/servers.d.ts
CHANGED
|
@@ -22,6 +22,14 @@ type ServerConfiguration = {
|
|
|
22
22
|
*/
|
|
23
23
|
urls: Array<string_promptbook_server_url>;
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Core Promptbook server configuration.
|
|
27
|
+
*
|
|
28
|
+
* This server is also used for auto-federation in the Agents Server.
|
|
29
|
+
*
|
|
30
|
+
* @public exported from `@promptbook/core`
|
|
31
|
+
*/
|
|
32
|
+
export declare const CORE_SERVER: ServerConfiguration;
|
|
25
33
|
/**
|
|
26
34
|
* Available remote servers for the Promptbook
|
|
27
35
|
*
|
|
@@ -191,6 +191,7 @@ import { SectionTypes } from '../types/SectionType';
|
|
|
191
191
|
import { TaskTypes } from '../types/TaskType';
|
|
192
192
|
import { aboutPromptbookInformation } from '../utils/misc/aboutPromptbookInformation';
|
|
193
193
|
import { $generateBookBoilerplate } from '../utils/random/$generateBookBoilerplate';
|
|
194
|
+
import { CORE_SERVER } from '../../servers';
|
|
194
195
|
import { REMOTE_SERVER_URLS } from '../../servers';
|
|
195
196
|
import { AUTO_FEDERATED_AGENT_SERVER_URLS } from '../../servers';
|
|
196
197
|
export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
|
|
@@ -386,5 +387,6 @@ export { SectionTypes };
|
|
|
386
387
|
export { TaskTypes };
|
|
387
388
|
export { aboutPromptbookInformation };
|
|
388
389
|
export { $generateBookBoilerplate };
|
|
390
|
+
export { CORE_SERVER };
|
|
389
391
|
export { REMOTE_SERVER_URLS };
|
|
390
392
|
export { AUTO_FEDERATED_AGENT_SERVER_URLS };
|
|
@@ -206,6 +206,7 @@ import type { string_char_emoji } from '../types/typeAliasEmoji';
|
|
|
206
206
|
import type { string_business_category_name } from '../types/typeAliases';
|
|
207
207
|
import type { string_model_name } from '../types/typeAliases';
|
|
208
208
|
import type { string_prompt } from '../types/typeAliases';
|
|
209
|
+
import type { string_prompt_image } from '../types/typeAliases';
|
|
209
210
|
import type { string_template } from '../types/typeAliases';
|
|
210
211
|
import type { string_text_prompt } from '../types/typeAliases';
|
|
211
212
|
import type { string_chat_prompt } from '../types/typeAliases';
|
|
@@ -573,6 +574,7 @@ export type { string_char_emoji };
|
|
|
573
574
|
export type { string_business_category_name };
|
|
574
575
|
export type { string_model_name };
|
|
575
576
|
export type { string_prompt };
|
|
577
|
+
export type { string_prompt_image };
|
|
576
578
|
export type { string_template };
|
|
577
579
|
export type { string_text_prompt };
|
|
578
580
|
export type { string_chat_prompt };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { string_agent_name, string_agent_permanent_id, string_url_image } from '../../types/typeAliases';
|
|
1
|
+
import type { string_agent_name, string_agent_permanent_id, string_url, string_url_image } from '../../types/typeAliases';
|
|
2
2
|
/**
|
|
3
3
|
* Generates an image for the agent to use as profile image
|
|
4
4
|
*
|
|
@@ -7,7 +7,7 @@ import type { string_agent_name, string_agent_permanent_id, string_url_image } f
|
|
|
7
7
|
*
|
|
8
8
|
* @public exported from `@promptbook/core`
|
|
9
9
|
*/
|
|
10
|
-
export declare function generatePlaceholderAgentProfileImageUrl(agentIdOrName: string_agent_permanent_id | string_agent_name): string_url_image;
|
|
10
|
+
export declare function generatePlaceholderAgentProfileImageUrl(agentIdOrName: string_agent_permanent_id | string_agent_name, agentsServerUrl?: URL | string_url): string_url_image;
|
|
11
11
|
/**
|
|
12
12
|
* TODO: [๐คน] Figure out best placeholder image generator https://i.pravatar.cc/1000?u=568
|
|
13
13
|
*/
|
|
@@ -17,7 +17,17 @@ export type CompletionModelRequirements = CommonModelRequirements & {
|
|
|
17
17
|
/**
|
|
18
18
|
* Completion model variant
|
|
19
19
|
*/
|
|
20
|
-
modelVariant: 'COMPLETION';
|
|
20
|
+
readonly modelVariant: 'COMPLETION';
|
|
21
|
+
/**
|
|
22
|
+
* The temperature of the model
|
|
23
|
+
*
|
|
24
|
+
* Note: [๐ฑ] Promptbook is using just `temperature` (not `top_k` and `top_p`)
|
|
25
|
+
*/
|
|
26
|
+
readonly temperature?: number_model_temperature;
|
|
27
|
+
/**
|
|
28
|
+
* Maximum number of tokens that can be generated by the model
|
|
29
|
+
*/
|
|
30
|
+
readonly maxTokens?: number;
|
|
21
31
|
};
|
|
22
32
|
/**
|
|
23
33
|
* Model requirements for the chat variant
|
|
@@ -28,11 +38,21 @@ export type ChatModelRequirements = CommonModelRequirements & {
|
|
|
28
38
|
/**
|
|
29
39
|
* Chat model variant
|
|
30
40
|
*/
|
|
31
|
-
modelVariant: 'CHAT';
|
|
41
|
+
readonly modelVariant: 'CHAT';
|
|
32
42
|
/**
|
|
33
43
|
* System message to be used in the model
|
|
34
44
|
*/
|
|
35
45
|
readonly systemMessage?: string_system_message;
|
|
46
|
+
/**
|
|
47
|
+
* The temperature of the model
|
|
48
|
+
*
|
|
49
|
+
* Note: [๐ฑ] Promptbook is using just `temperature` (not `top_k` and `top_p`)
|
|
50
|
+
*/
|
|
51
|
+
readonly temperature?: number_model_temperature;
|
|
52
|
+
/**
|
|
53
|
+
* Maximum number of tokens that can be generated by the model
|
|
54
|
+
*/
|
|
55
|
+
readonly maxTokens?: number;
|
|
36
56
|
};
|
|
37
57
|
/**
|
|
38
58
|
* Model requirements for the image generation variant
|
|
@@ -43,7 +63,21 @@ export type ImageGenerationModelRequirements = CommonModelRequirements & {
|
|
|
43
63
|
/**
|
|
44
64
|
* Image generation model variant
|
|
45
65
|
*/
|
|
46
|
-
modelVariant: 'IMAGE_GENERATION';
|
|
66
|
+
readonly modelVariant: 'IMAGE_GENERATION';
|
|
67
|
+
/**
|
|
68
|
+
* Size of the generated image
|
|
69
|
+
*
|
|
70
|
+
* e.g. '1536x1536'
|
|
71
|
+
*/
|
|
72
|
+
readonly size?: '1024x1024' | '1792x1024' | '1024x1792' | `${number}x${number}`;
|
|
73
|
+
/**
|
|
74
|
+
* Quality of the generated image
|
|
75
|
+
*/
|
|
76
|
+
readonly quality?: 'standard' | 'hd';
|
|
77
|
+
/**
|
|
78
|
+
* Style of the generated image
|
|
79
|
+
*/
|
|
80
|
+
readonly style?: 'vivid' | 'natural';
|
|
47
81
|
};
|
|
48
82
|
/**
|
|
49
83
|
* Model requirements for the embedding variant
|
|
@@ -54,7 +88,7 @@ export type EmbeddingModelRequirements = CommonModelRequirements & {
|
|
|
54
88
|
/**
|
|
55
89
|
* Embedding model variant
|
|
56
90
|
*/
|
|
57
|
-
modelVariant: 'EMBEDDING';
|
|
91
|
+
readonly modelVariant: 'EMBEDDING';
|
|
58
92
|
};
|
|
59
93
|
/**
|
|
60
94
|
* Common properties for all model requirements variants
|
|
@@ -84,20 +118,10 @@ export type CommonModelRequirements = {
|
|
|
84
118
|
* @example 'gpt-4', 'gpt-4-32k-0314', 'gpt-3.5-turbo-instruct',...
|
|
85
119
|
*/
|
|
86
120
|
readonly modelName?: string_model_name;
|
|
87
|
-
/**
|
|
88
|
-
* The temperature of the model
|
|
89
|
-
*
|
|
90
|
-
* Note: [๐ฑ] Promptbook is using just `temperature` (not `top_k` and `top_p`)
|
|
91
|
-
*/
|
|
92
|
-
readonly temperature?: number_model_temperature;
|
|
93
121
|
/**
|
|
94
122
|
* Seed for the model
|
|
95
123
|
*/
|
|
96
124
|
readonly seed?: number_seed;
|
|
97
|
-
/**
|
|
98
|
-
* Maximum number of tokens that can be generated by the model
|
|
99
|
-
*/
|
|
100
|
-
readonly maxTokens?: number;
|
|
101
125
|
};
|
|
102
126
|
/**
|
|
103
127
|
* TODO: [๐ง ][๐] `seed` should maybe be somewhere else (not in `ModelRequirements`) (similar that `user` identification is not here)
|
|
@@ -14,9 +14,15 @@ export type string_model_name = 'gpt-4' | 'gpt-4-0314' | 'gpt-4-0613' | 'gpt-4-3
|
|
|
14
14
|
/**
|
|
15
15
|
* Semantic helper
|
|
16
16
|
*
|
|
17
|
-
* For example `"
|
|
17
|
+
* For example `"How many eyes does a cat have?"`
|
|
18
18
|
*/
|
|
19
19
|
export type string_prompt = string;
|
|
20
|
+
/**
|
|
21
|
+
* Semantic helper
|
|
22
|
+
*
|
|
23
|
+
* For example `"A cat wearing a hat"`
|
|
24
|
+
*/
|
|
25
|
+
export type string_prompt_image = string;
|
|
20
26
|
/**
|
|
21
27
|
* Semantic helper
|
|
22
28
|
*
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { string_color, string_data_url, string_url_image } from '../../../types/typeAliases';
|
|
1
2
|
import { Color } from '../Color';
|
|
2
3
|
/**
|
|
3
4
|
* Makes data url from color
|
|
4
5
|
*
|
|
5
6
|
* @public exported from `@promptbook/color`
|
|
6
7
|
*/
|
|
7
|
-
export declare function colorToDataUrl(color: Color):
|
|
8
|
+
export declare function colorToDataUrl(color: Color | string_color): string_data_url & string_url_image;
|
|
8
9
|
/**
|
|
9
10
|
* TODO: Make as functions NOT const
|
|
10
11
|
*/
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.104.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.104.0-7`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* @generated
|
|
31
31
|
* @see https://github.com/webgptorg/promptbook
|
|
32
32
|
*/
|
|
33
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-
|
|
33
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-8';
|
|
34
34
|
/**
|
|
35
35
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
36
36
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
@@ -152,6 +152,8 @@
|
|
|
152
152
|
* Core Promptbook server configuration.
|
|
153
153
|
*
|
|
154
154
|
* This server is also used for auto-federation in the Agents Server.
|
|
155
|
+
*
|
|
156
|
+
* @public exported from `@promptbook/core`
|
|
155
157
|
*/
|
|
156
158
|
const CORE_SERVER = {
|
|
157
159
|
title: 'Promptbook Core',
|
|
@@ -8779,6 +8781,52 @@
|
|
|
8779
8781
|
*/
|
|
8780
8782
|
const textColor = furthest(Color.get('white'), Color.from('black'));
|
|
8781
8783
|
|
|
8784
|
+
/**
|
|
8785
|
+
* Makes data url from color
|
|
8786
|
+
*
|
|
8787
|
+
* @public exported from `@promptbook/color`
|
|
8788
|
+
*/
|
|
8789
|
+
function colorToDataUrl(color) {
|
|
8790
|
+
if (typeof color === 'string') {
|
|
8791
|
+
color = Color.fromHex(color);
|
|
8792
|
+
}
|
|
8793
|
+
return rgbDataURL(color.red, color.green, color.blue);
|
|
8794
|
+
}
|
|
8795
|
+
/**
|
|
8796
|
+
* Pixel GIF code adapted from https://stackoverflow.com/a/33919020/266535
|
|
8797
|
+
*
|
|
8798
|
+
* @private util of `colorToDataUrl`
|
|
8799
|
+
*/
|
|
8800
|
+
const keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
8801
|
+
/**
|
|
8802
|
+
* Generates a base64-encoded triplet string
|
|
8803
|
+
*
|
|
8804
|
+
* @param e1 - The first element in the triplet.
|
|
8805
|
+
* @param e2 - The second element in the triplet.
|
|
8806
|
+
* @param e3 - The third element in the triplet.
|
|
8807
|
+
* @returns The base64-encoded triplet string.
|
|
8808
|
+
*
|
|
8809
|
+
* @private util of `colorToDataUrl`
|
|
8810
|
+
*/
|
|
8811
|
+
const triplet = (e1, e2, e3) => keyStr.charAt(e1 >> 2) +
|
|
8812
|
+
keyStr.charAt(((e1 & 3) << 4) | (e2 >> 4)) +
|
|
8813
|
+
keyStr.charAt(((e2 & 15) << 2) | (e3 >> 6)) +
|
|
8814
|
+
keyStr.charAt(e3 & 63);
|
|
8815
|
+
/**
|
|
8816
|
+
* Converts RGB values to a data URL string
|
|
8817
|
+
*
|
|
8818
|
+
* @param r - The red channel value.
|
|
8819
|
+
* @param g - The green channel value.
|
|
8820
|
+
* @param b - The blue channel value.
|
|
8821
|
+
* @returns The RGB data URL string.
|
|
8822
|
+
*
|
|
8823
|
+
* @private util of `colorToDataUrl`
|
|
8824
|
+
*/
|
|
8825
|
+
const rgbDataURL = (r, g, b) => `data:image/gif;base64,R0lGODlhAQABAPAA${triplet(0, r, g) + triplet(b, 255, 255)}/yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==`;
|
|
8826
|
+
/**
|
|
8827
|
+
* TODO: Make as functions NOT const
|
|
8828
|
+
*/
|
|
8829
|
+
|
|
8782
8830
|
/**
|
|
8783
8831
|
* Restricts an Updatable to a (2) BehaviorSubject variant
|
|
8784
8832
|
*
|
|
@@ -9506,7 +9554,7 @@
|
|
|
9506
9554
|
* @private internal subcomponent of `<Chat>` component
|
|
9507
9555
|
*/
|
|
9508
9556
|
const ChatMessageItem = react.memo(({ message, participant, participants, isLastMessage, onMessage, setExpandedMessageId, isExpanded, currentRating, handleRating, mode, isCopyButtonEnabled, isFeedbackEnabled, onCopy, onCreateAgent, }) => {
|
|
9509
|
-
const avatarSrc = (participant === null || participant === void 0 ? void 0 : participant.avatarSrc) ||
|
|
9557
|
+
const avatarSrc = (participant === null || participant === void 0 ? void 0 : participant.avatarSrc) || null;
|
|
9510
9558
|
const [isAvatarTooltipVisible, setIsAvatarTooltipVisible] = react.useState(false);
|
|
9511
9559
|
const [avatarTooltipPosition, setAvatarTooltipPosition] = react.useState(null);
|
|
9512
9560
|
const hoverTimeoutRef = react.useRef(null);
|
|
@@ -9600,9 +9648,11 @@
|
|
|
9600
9648
|
}, children: [avatarSrc && (jsxRuntime.jsxs("div", { ref: avatarRef, className: chatStyles.avatar, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onClick: showTooltip, children: [jsxRuntime.jsx("img", { width: AVATAR_SIZE, src: avatarSrc, alt: `Avatar of ${message.sender.toString().toLocaleLowerCase()}`, style: {
|
|
9601
9649
|
'--avatar-bg-color': color.toHex(),
|
|
9602
9650
|
objectFit: 'cover',
|
|
9651
|
+
objectPosition: '50% 20%',
|
|
9603
9652
|
width: AVATAR_SIZE,
|
|
9604
9653
|
height: AVATAR_SIZE,
|
|
9605
9654
|
aspectRatio: '1 / 1',
|
|
9655
|
+
backgroundImage: `url(${colorToDataUrl(color)})`,
|
|
9606
9656
|
} }), isAvatarTooltipVisible && (participant === null || participant === void 0 ? void 0 : participant.agentSource) && avatarTooltipPosition && (jsxRuntime.jsx(AvatarProfileTooltip, { ref: tooltipRef, agentSource: participant.agentSource, position: avatarTooltipPosition }))] })), jsxRuntime.jsxs("div", { className: chatStyles.messageText, style: {
|
|
9607
9657
|
'--message-bg-color': color.toHex(),
|
|
9608
9658
|
'--message-text-color': colorOfText.toHex(),
|
|
@@ -16702,13 +16752,14 @@
|
|
|
16702
16752
|
const modelName = currentModelRequirements.modelName || this.getDefaultImageGenerationModel().modelName;
|
|
16703
16753
|
const modelSettings = {
|
|
16704
16754
|
model: modelName,
|
|
16705
|
-
|
|
16706
|
-
|
|
16707
|
-
|
|
16755
|
+
size: currentModelRequirements.size,
|
|
16756
|
+
quality: currentModelRequirements.quality,
|
|
16757
|
+
style: currentModelRequirements.style,
|
|
16708
16758
|
};
|
|
16709
16759
|
const rawPromptContent = templateParameters(content, { ...parameters, modelName });
|
|
16710
16760
|
const rawRequest = {
|
|
16711
16761
|
...modelSettings,
|
|
16762
|
+
size: modelSettings.size || '1024x1024',
|
|
16712
16763
|
prompt: rawPromptContent,
|
|
16713
16764
|
user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
16714
16765
|
response_format: 'url', // TODO: [๐ง ] Maybe allow b64_json
|