@wabot-dev/framework 0.4.4 → 0.5.0
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.
|
@@ -24,7 +24,7 @@ let ChatBot = class ChatBot {
|
|
|
24
24
|
await this.processLoop(callback);
|
|
25
25
|
}
|
|
26
26
|
async processLoop(callback) {
|
|
27
|
-
const prevItems = await this.memory.findLastItems(
|
|
27
|
+
const prevItems = await this.memory.findLastItems(16);
|
|
28
28
|
if (prevItems.length === 0) {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
@@ -16,6 +16,9 @@ let MindsetOperator = class MindsetOperator {
|
|
|
16
16
|
this.container = container;
|
|
17
17
|
this.metadata = metadataStore.getMindsetInfo(this.mindset.constructor);
|
|
18
18
|
}
|
|
19
|
+
context() {
|
|
20
|
+
return this.mindset.context();
|
|
21
|
+
}
|
|
19
22
|
identity() {
|
|
20
23
|
return this.mindset.identity();
|
|
21
24
|
}
|
|
@@ -32,7 +35,8 @@ let MindsetOperator = class MindsetOperator {
|
|
|
32
35
|
return this.mindset.llms();
|
|
33
36
|
}
|
|
34
37
|
async systemPrompt() {
|
|
35
|
-
let [identity, skills, limits, workflow] = await Promise.all([
|
|
38
|
+
let [context, identity, skills, limits, workflow] = await Promise.all([
|
|
39
|
+
this.context(),
|
|
36
40
|
this.identity(),
|
|
37
41
|
this.skills(),
|
|
38
42
|
this.limits(),
|
|
@@ -40,33 +44,35 @@ let MindsetOperator = class MindsetOperator {
|
|
|
40
44
|
]);
|
|
41
45
|
const language = identity.language.replaceAll('#', ' ');
|
|
42
46
|
const name = identity.name.replaceAll('#', ' ');
|
|
43
|
-
const age = identity.age ? identity.age.toString().replaceAll('#', ' ') : null;
|
|
44
47
|
const personality = identity.personality ? identity.personality.replaceAll('#', ' ') : null;
|
|
48
|
+
context = context.replaceAll('#', ' ');
|
|
45
49
|
skills = skills.replaceAll('#', ' ');
|
|
46
50
|
limits = limits.replaceAll('#', ' ');
|
|
47
51
|
workflow = workflow.replaceAll('#', ' ');
|
|
48
52
|
const systemPrompt = `
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
${age ? 'you are ' + age + ' years old.' : ''}
|
|
54
|
-
|
|
55
|
-
${personality ? '## Personality (in your main language) \n' + personality : ''}
|
|
56
|
-
|
|
57
|
-
## Skills (in your main language)
|
|
58
|
-
${skills}
|
|
53
|
+
# System Instructions
|
|
54
|
+
you should act as a assistant.
|
|
55
|
+
your main language is ${language}.
|
|
56
|
+
your name is ${name}.
|
|
59
57
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
${personality ? '## Personality (in your main language) \n' + personality : ''}
|
|
59
|
+
|
|
60
|
+
## Context (in your main language)
|
|
61
|
+
${context}
|
|
62
|
+
|
|
63
|
+
## Skills (in your main language)
|
|
64
|
+
${skills}
|
|
65
|
+
|
|
66
|
+
## Workflow (in your main language)
|
|
67
|
+
${workflow}
|
|
68
|
+
|
|
69
|
+
## System limitations (in your main language)
|
|
70
|
+
${limits}
|
|
71
|
+
|
|
72
|
+
## Chat memory
|
|
73
|
+
Next you will receive a chat history,
|
|
74
|
+
you should use this information to answer the user.
|
|
75
|
+
`;
|
|
70
76
|
return systemPrompt;
|
|
71
77
|
}
|
|
72
78
|
tools() {
|
package/dist/src/index.d.ts
CHANGED
|
@@ -617,7 +617,6 @@ declare class Chat extends Entity<IChatData> {
|
|
|
617
617
|
interface IMindsetIdentity {
|
|
618
618
|
name: string;
|
|
619
619
|
language: string;
|
|
620
|
-
age?: number;
|
|
621
620
|
personality?: string;
|
|
622
621
|
emotions?: string;
|
|
623
622
|
}
|
|
@@ -626,6 +625,7 @@ interface IMindsetLlm {
|
|
|
626
625
|
model: string;
|
|
627
626
|
}
|
|
628
627
|
interface IMindset {
|
|
628
|
+
context(): Promise<string>;
|
|
629
629
|
identity(): Promise<IMindsetIdentity>;
|
|
630
630
|
skills(): Promise<string>;
|
|
631
631
|
limits(): Promise<string>;
|
|
@@ -633,6 +633,7 @@ interface IMindset {
|
|
|
633
633
|
llms(): Promise<IMindsetLlm[]>;
|
|
634
634
|
}
|
|
635
635
|
declare class Mindset implements IMindset {
|
|
636
|
+
context(): Promise<string>;
|
|
636
637
|
identity(): Promise<IMindsetIdentity>;
|
|
637
638
|
skills(): Promise<string>;
|
|
638
639
|
limits(): Promise<string>;
|
|
@@ -731,6 +732,7 @@ declare class MindsetOperator implements IMindset {
|
|
|
731
732
|
private container;
|
|
732
733
|
private metadata;
|
|
733
734
|
constructor(mindset: Mindset, container: Container, metadataStore: MindsetMetadataStore);
|
|
735
|
+
context(): Promise<string>;
|
|
734
736
|
identity(): Promise<IMindsetIdentity>;
|
|
735
737
|
skills(): Promise<string>;
|
|
736
738
|
limits(): Promise<string>;
|