@indra.ai/deva.services 0.0.123 → 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.
Files changed (2) hide show
  1. package/feature/methods.js +20 -15
  2. package/package.json +2 -2
@@ -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
- this.state('get', 'ask:chat');
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(Date.now(), 'long', true)}`,
154
- `::end:${agent.key}:${this.lib.hash(answer)}`,
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: this.lib.trimWords(answer.a.data.chat.text, 150),
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.state('resolve', `ask:${packet.id.uid}`);
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.state('reject', 'chat');
179
- return this.error(packet, err, reject);
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
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "59232188337076320338",
3
3
  "name": "@indra.ai/deva.services",
4
- "version": "0.0.123",
4
+ "version": "0.0.125",
5
5
  "license": "VLA:59232188337076320338 LICENSE.md",
6
6
  "VLA": {
7
7
  "uid": "59232188337076320338",
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "homepage": "https://indra.ai",
61
61
  "dependencies": {
62
- "@indra.ai/deva": "^1.11.0"
62
+ "@indra.ai/deva": "^1.12.0"
63
63
  },
64
64
  "data": {
65
65
  "agent": {