@indra.ai/deva.services 0.0.124 → 0.0.125
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/feature/methods.js +20 -15
- package/package.json +1 -1
package/feature/methods.js
CHANGED
|
@@ -135,7 +135,14 @@ export default {
|
|
|
135
135
|
if (!this.vars.ask) return resolve('Ask not configured.');
|
|
136
136
|
|
|
137
137
|
data.corpus = corpus.a.text;
|
|
138
|
-
|
|
138
|
+
|
|
139
|
+
this.state('set', `history:${packet.id.uid}`);
|
|
140
|
+
this.vars.ask.history.push({
|
|
141
|
+
role: 'user',
|
|
142
|
+
content: packet.q.text,
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
this.state('get', `ask:chat:${packet.id.uid}`);
|
|
139
146
|
this.question(`${this.askChr}chat relay ${decodeURIComponent(packet.q.text)}`, {
|
|
140
147
|
client: buildProfile(client, 'client'),
|
|
141
148
|
agent: buildProfile(agent, 'agent'),
|
|
@@ -144,39 +151,37 @@ export default {
|
|
|
144
151
|
history: this.vars.ask.history.slice(-10),
|
|
145
152
|
memory: agent.key,
|
|
146
153
|
}).then(answer => {
|
|
147
|
-
console.log('CHAT RELAY ANSWER', Object.keys(answer));
|
|
148
154
|
|
|
149
155
|
data.chat = answer.a.data.chat;
|
|
150
156
|
const text = [
|
|
151
|
-
`::begin:${agent.key}:${answer.id}`,
|
|
157
|
+
`::begin:${agent.key}:${answer.id.uid}`,
|
|
152
158
|
answer.a.text,
|
|
153
|
-
`date: ${this.lib.formatDate(
|
|
154
|
-
`::end:${agent.key}:${
|
|
159
|
+
`date: ${this.lib.formatDate(answer.a.created, 'long', true)}`,
|
|
160
|
+
`::end:${agent.key}:${answer.id.uid}`,
|
|
155
161
|
];
|
|
156
|
-
this.state('set', `history:${packet.id}`);
|
|
157
|
-
this.vars.ask.history.push({
|
|
158
|
-
role: 'user',
|
|
159
|
-
content: this.lib.trimWords(answer.q.text, 150),
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
+
this.state('set', `history:a:${packet.id}`);
|
|
162
163
|
this.vars.ask.history.push({
|
|
163
164
|
role: answer.a.data.chat.role,
|
|
164
|
-
content:
|
|
165
|
+
content: answer.a.data.chat.text,
|
|
165
166
|
});
|
|
166
167
|
|
|
167
168
|
this.state('parse', `ask:${packet.id.uid}`);
|
|
168
169
|
return this.question(`${this.askChr}feecting parse ${text.join('\n')}`);
|
|
169
170
|
}).then(feecting => {
|
|
170
171
|
data.feecting = feecting.a.data;
|
|
171
|
-
this.
|
|
172
|
+
this.action('resolve', `ask:${packet.id.uid}`);
|
|
173
|
+
this.state('valid', `ask:${packet.id.uid}`);
|
|
174
|
+
this.intent('good', `ask:${packet.id.uid}`);
|
|
172
175
|
return resolve({
|
|
173
176
|
text: feecting.a.text,
|
|
174
177
|
html: feecting.a.html,
|
|
175
178
|
data,
|
|
176
179
|
});
|
|
177
180
|
}).catch(err => {
|
|
178
|
-
this.
|
|
179
|
-
|
|
181
|
+
this.action('reject', 'chat');
|
|
182
|
+
this.state('invalid', 'chat');
|
|
183
|
+
this.intent('bad', 'chat');
|
|
184
|
+
return this.err(packet, err, reject);
|
|
180
185
|
});
|
|
181
186
|
});
|
|
182
187
|
},
|