total5 0.0.16-8 → 0.0.16-9
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/aimodel.js +21 -2
- package/builders.js +2 -2
- package/changelog.txt +1 -0
- package/package.json +1 -1
package/aimodel.js
CHANGED
|
@@ -30,13 +30,27 @@ AI.prototype.message = function(role, content, merge) {
|
|
|
30
30
|
if (merge) {
|
|
31
31
|
for (let m of t.payload.messages) {
|
|
32
32
|
if (m.role === role) {
|
|
33
|
-
|
|
33
|
+
|
|
34
|
+
if (typeof(content) === 'object') {
|
|
35
|
+
for (let key in content)
|
|
36
|
+
m[key] = content[key];
|
|
37
|
+
} else
|
|
38
|
+
m.content += merge + content;
|
|
39
|
+
|
|
34
40
|
return this;
|
|
35
41
|
}
|
|
36
42
|
}
|
|
37
43
|
}
|
|
38
44
|
|
|
39
|
-
|
|
45
|
+
const msg = { role: role };
|
|
46
|
+
|
|
47
|
+
if (typeof(content) === 'object') {
|
|
48
|
+
for (let key in content)
|
|
49
|
+
msg[key] = content[key];
|
|
50
|
+
} else
|
|
51
|
+
msg.content = content;
|
|
52
|
+
|
|
53
|
+
t.payload.messages.push(msg);
|
|
40
54
|
return t;
|
|
41
55
|
};
|
|
42
56
|
|
|
@@ -55,6 +69,11 @@ AI.prototype.user = function(content, merge) {
|
|
|
55
69
|
return this.message('user', content, merge);
|
|
56
70
|
};
|
|
57
71
|
|
|
72
|
+
AI.prototype.prompt = function(content) {
|
|
73
|
+
this.payload.prompt = content;
|
|
74
|
+
return this;
|
|
75
|
+
};
|
|
76
|
+
|
|
58
77
|
AI.prototype.assistant = function(content, merge) {
|
|
59
78
|
return this.message('assistant', content, merge);
|
|
60
79
|
};
|
package/builders.js
CHANGED
|
@@ -247,7 +247,7 @@ Options.prototype.successful = function(callback) {
|
|
|
247
247
|
};
|
|
248
248
|
};
|
|
249
249
|
|
|
250
|
-
Options.prototype.callback = Options.prototype.pipe = function(value) {
|
|
250
|
+
Options.prototype.callback = Options.prototype.output = Options.prototype.pipe = function(value) {
|
|
251
251
|
|
|
252
252
|
var self = this;
|
|
253
253
|
|
|
@@ -1555,7 +1555,7 @@ ActionCaller.prototype.finish = function(value) {
|
|
|
1555
1555
|
if (self.error.length)
|
|
1556
1556
|
$.invalid(self.error);
|
|
1557
1557
|
else
|
|
1558
|
-
$.callback.call(
|
|
1558
|
+
$.callback.call($, value === undefined ? self.$.response : value);
|
|
1559
1559
|
} else
|
|
1560
1560
|
self.options.callback.call(self.$, self.error.length ? self.error : null, value === undefined ? self.$.response : value);
|
|
1561
1561
|
|
package/changelog.txt
CHANGED