symposium 0.3.1 → 0.3.3

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 (3) hide show
  1. package/Agent.js +2 -6
  2. package/Thread.js +4 -5
  3. package/package.json +1 -1
package/Agent.js CHANGED
@@ -23,10 +23,6 @@ export default class Agent {
23
23
  this.threads = new Map();
24
24
  }
25
25
 
26
- async logout(thread) {
27
- thread.auth = new Map();
28
- }
29
-
30
26
  async reset(thread) {
31
27
  await thread.flush();
32
28
  await this.resetState(thread);
@@ -62,7 +58,7 @@ export default class Agent {
62
58
  async getThread(id, reply = null) {
63
59
  let thread = this.threads.get(id);
64
60
  if (!thread) {
65
- thread = new Thread(this.name + '-' + id);
61
+ thread = new Thread(this.name + '-' + id, this);
66
62
 
67
63
  if (!(await thread.loadState())) {
68
64
  await this.resetState(thread);
@@ -82,7 +78,7 @@ export default class Agent {
82
78
  if (this.threads.has(id))
83
79
  return this.threads.get(id);
84
80
 
85
- const thread = new Thread(this.name + '-' + id);
81
+ const thread = new Thread(this.name + '-' + id, this);
86
82
 
87
83
  if (await thread.loadState())
88
84
  return thread;
package/Thread.js CHANGED
@@ -3,17 +3,18 @@ import Redis from "@travio/redis";
3
3
 
4
4
  export default class Thread {
5
5
  id;
6
+ agent;
6
7
  reply;
7
8
  messages = [];
8
9
  state = {};
9
- auth = new Map();
10
10
 
11
- constructor(id) {
11
+ constructor(id, agent) {
12
12
  this.id = id;
13
+ this.agent = agent;
13
14
  }
14
15
 
15
16
  clone(keepMessages = true) {
16
- let newThread = new Thread(this.id);
17
+ let newThread = new Thread(this.id, this.agent);
17
18
  newThread.reply = this.reply;
18
19
  newThread.state = this.state;
19
20
  if (keepMessages)
@@ -31,7 +32,6 @@ export default class Thread {
31
32
 
32
33
  const conv = await Redis.get('thread-' + this.id);
33
34
  if (conv) {
34
- this.auth = new Map(conv.auth || []);
35
35
  this.state = conv.state || {};
36
36
  this.messages = conv.messages.map(m => (new Message(m.role, m.text, m.name, m.function_call, m.tags || [])));
37
37
  return true;
@@ -48,7 +48,6 @@ export default class Thread {
48
48
 
49
49
  async storeState() {
50
50
  await Redis.set('thread-' + this.id, {
51
- auth: [...this.auth.entries()],
52
51
  state: this.state,
53
52
  messages: this.messages,
54
53
  }, 0);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "symposium",
4
- "version": "0.3.1",
4
+ "version": "0.3.3",
5
5
  "description": "Agents",
6
6
  "main": "index.js",
7
7
  "author": "Domenico Giambra",