@promptbook/core 0.105.0-0 → 0.105.0-1
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 +78 -21
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +4 -0
- package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +2 -1
- package/esm/typings/src/utils/random/$randomAgentRule.d.ts +14 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +78 -21
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -27,7 +27,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
27
27
|
* @generated
|
|
28
28
|
* @see https://github.com/webgptorg/promptbook
|
|
29
29
|
*/
|
|
30
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-
|
|
30
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-1';
|
|
31
31
|
/**
|
|
32
32
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
33
33
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -21542,29 +21542,82 @@ function $randomItem(...items) {
|
|
|
21542
21542
|
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
21543
21543
|
*/
|
|
21544
21544
|
|
|
21545
|
-
const PERSONALITIES =
|
|
21546
|
-
|
|
21547
|
-
|
|
21548
|
-
|
|
21549
|
-
|
|
21550
|
-
|
|
21551
|
-
|
|
21552
|
-
|
|
21553
|
-
|
|
21554
|
-
|
|
21555
|
-
|
|
21556
|
-
|
|
21545
|
+
const PERSONALITIES = {
|
|
21546
|
+
ENGLISH: [
|
|
21547
|
+
'Friendly and helpful AI agent.',
|
|
21548
|
+
'Professional and efficient virtual assistant.',
|
|
21549
|
+
'Creative and imaginative digital companion.',
|
|
21550
|
+
'Knowledgeable and informative AI guide.',
|
|
21551
|
+
'Empathetic and understanding support bot.',
|
|
21552
|
+
'Energetic and enthusiastic conversational partner.',
|
|
21553
|
+
'Calm and patient virtual helper.',
|
|
21554
|
+
'Curious and inquisitive AI explorer.',
|
|
21555
|
+
'Witty and humorous digital friend.',
|
|
21556
|
+
'Serious and focused AI consultant.',
|
|
21557
|
+
],
|
|
21558
|
+
CZECH: [
|
|
21559
|
+
// spell-checker:disable
|
|
21560
|
+
'Přátelský a nápomocný AI agent.',
|
|
21561
|
+
'Profesionální a efektivní virtuální asistent.',
|
|
21562
|
+
'Kreativní a nápaditý digitální společník.',
|
|
21563
|
+
'Zkušený a informativní AI průvodce.',
|
|
21564
|
+
'Empatický a chápavý robot podpory.',
|
|
21565
|
+
'Energický a nadšený partner pro konverzaci.',
|
|
21566
|
+
'Klidný a trpělivý virtuální pomocník.',
|
|
21567
|
+
'Zvědavý a hloubavý AI průzkumník.',
|
|
21568
|
+
'Vtipný a humorný digitální přítel.',
|
|
21569
|
+
'Vážný a soustředěný AI konzultant.',
|
|
21570
|
+
// spell-checker:enable
|
|
21571
|
+
],
|
|
21572
|
+
};
|
|
21557
21573
|
/**
|
|
21558
21574
|
* Generates a random agent persona description.
|
|
21559
21575
|
*
|
|
21560
21576
|
* This function selects a random personality profile from a predefined pool
|
|
21561
21577
|
* of common AI agent characteristics (e.g., friendly, professional, creative).
|
|
21562
21578
|
*
|
|
21579
|
+
* @param language - The language code (e.g. 'ENGLISH', 'CZECH')
|
|
21563
21580
|
* @returns A string describing the agent's persona
|
|
21564
21581
|
* @private internal helper function
|
|
21565
21582
|
*/
|
|
21566
|
-
function $randomAgentPersona() {
|
|
21567
|
-
|
|
21583
|
+
function $randomAgentPersona(language = 'ENGLISH') {
|
|
21584
|
+
const normalizedLanguage = language.toUpperCase().trim();
|
|
21585
|
+
const personalities = PERSONALITIES[normalizedLanguage] || PERSONALITIES['ENGLISH'];
|
|
21586
|
+
return $randomItem(...personalities);
|
|
21587
|
+
}
|
|
21588
|
+
/**
|
|
21589
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
21590
|
+
*/
|
|
21591
|
+
|
|
21592
|
+
const RULES = {
|
|
21593
|
+
ENGLISH: [
|
|
21594
|
+
'Always prioritize user privacy and data security.',
|
|
21595
|
+
'Respond in a friendly and approachable manner.',
|
|
21596
|
+
'Avoid using technical jargon unless necessary.',
|
|
21597
|
+
'Maintain a neutral and unbiased tone in all responses.',
|
|
21598
|
+
],
|
|
21599
|
+
CZECH: [
|
|
21600
|
+
// spell-checker:disable
|
|
21601
|
+
'Vždy upřednostňujte soukromí uživatelů a bezpečnost dat.',
|
|
21602
|
+
'Odpovídejte přátelským a přístupným způsobem.',
|
|
21603
|
+
'Vyhněte se používání technického žargonu, pokud to není nutné.',
|
|
21604
|
+
'Udržujte ve všech odpovědích neutrální a nezaujatý tón.',
|
|
21605
|
+
// spell-checker:enable
|
|
21606
|
+
],
|
|
21607
|
+
};
|
|
21608
|
+
/**
|
|
21609
|
+
* Generates a random agent rule description.
|
|
21610
|
+
*
|
|
21611
|
+
* This function selects a random rule
|
|
21612
|
+
*
|
|
21613
|
+
* @param language - The language code (e.g. 'ENGLISH', 'CZECH')
|
|
21614
|
+
* @returns A string describing the agent's rule
|
|
21615
|
+
* @private internal helper function
|
|
21616
|
+
*/
|
|
21617
|
+
function $randomAgentRule(language = 'ENGLISH') {
|
|
21618
|
+
const normalizedLanguage = language.toUpperCase().trim();
|
|
21619
|
+
const rules = RULES[normalizedLanguage] || RULES['ENGLISH'];
|
|
21620
|
+
return $randomItem(...rules);
|
|
21568
21621
|
}
|
|
21569
21622
|
/**
|
|
21570
21623
|
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
@@ -21850,10 +21903,9 @@ function getNamePool(language) {
|
|
|
21850
21903
|
* @public exported from `@promptbook/core`
|
|
21851
21904
|
*/
|
|
21852
21905
|
function $generateBookBoilerplate(options) {
|
|
21853
|
-
|
|
21854
|
-
let { agentName,
|
|
21855
|
-
|
|
21856
|
-
let { image, color, ...restMeta } = meta || {};
|
|
21906
|
+
const { parentAgentName = 'Adam', initialRules = [], meta, namePool = 'ENGLISH' } = options || {};
|
|
21907
|
+
let { agentName, personaDescription } = options || {};
|
|
21908
|
+
let { color } = meta || {};
|
|
21857
21909
|
if (!agentName) {
|
|
21858
21910
|
const namePoolInstance = getNamePool(namePool);
|
|
21859
21911
|
const randomFullnameWithColor = namePoolInstance.generateName();
|
|
@@ -21861,15 +21913,20 @@ function $generateBookBoilerplate(options) {
|
|
|
21861
21913
|
color = color || randomFullnameWithColor.color;
|
|
21862
21914
|
}
|
|
21863
21915
|
if (!personaDescription) {
|
|
21864
|
-
personaDescription = $randomAgentPersona();
|
|
21916
|
+
personaDescription = $randomAgentPersona(namePool);
|
|
21917
|
+
}
|
|
21918
|
+
if (initialRules.length === 0) {
|
|
21919
|
+
initialRules.push($randomAgentRule(namePool));
|
|
21865
21920
|
}
|
|
21866
21921
|
const agentSource = validateBook(spaceTrim$2((block) => `
|
|
21867
21922
|
${agentName}
|
|
21868
21923
|
|
|
21869
21924
|
META COLOR ${color || PROMPTBOOK_COLOR.toHex()}
|
|
21870
|
-
META FONT Playfair Display, sans-serif
|
|
21871
21925
|
PERSONA ${block(personaDescription)}
|
|
21926
|
+
${block(initialRules.map((rule) => `RULE ${rule}`).join('\n'))}
|
|
21872
21927
|
`));
|
|
21928
|
+
// Note: `META FONT Playfair Display, sans-serif` was removed for now
|
|
21929
|
+
// <- TODO: [🈲] Simple and object-constructive way how to create new books
|
|
21873
21930
|
return agentSource;
|
|
21874
21931
|
}
|
|
21875
21932
|
/**
|