symposium 0.10.5 → 0.10.7
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/Agent.js +2 -2
- package/Thread.js +4 -3
- package/package.json +1 -1
package/Agent.js
CHANGED
|
@@ -60,7 +60,7 @@ export default class Agent {
|
|
|
60
60
|
async getThread(id) {
|
|
61
61
|
let thread = this.threads.get(id);
|
|
62
62
|
if (!thread) {
|
|
63
|
-
thread = new Thread(
|
|
63
|
+
thread = new Thread(id, this);
|
|
64
64
|
|
|
65
65
|
if (!(await thread.loadState())) {
|
|
66
66
|
await this.resetState(thread);
|
|
@@ -77,7 +77,7 @@ export default class Agent {
|
|
|
77
77
|
if (this.threads.has(id))
|
|
78
78
|
return this.threads.get(id);
|
|
79
79
|
|
|
80
|
-
const thread = new Thread(
|
|
80
|
+
const thread = new Thread(id, this);
|
|
81
81
|
|
|
82
82
|
if (await thread.loadState())
|
|
83
83
|
return thread;
|
package/Thread.js
CHANGED
|
@@ -3,14 +3,15 @@ import Symposium from "./Symposium.js";
|
|
|
3
3
|
|
|
4
4
|
export default class Thread {
|
|
5
5
|
id;
|
|
6
|
+
unique;
|
|
6
7
|
agent;
|
|
7
8
|
reply;
|
|
8
9
|
messages = [];
|
|
9
10
|
state = {};
|
|
10
|
-
interfaces = {};
|
|
11
11
|
|
|
12
12
|
constructor(id, agent) {
|
|
13
13
|
this.id = id;
|
|
14
|
+
this.unique = agent.name + '-' + id;
|
|
14
15
|
this.agent = agent;
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -31,7 +32,7 @@ export default class Thread {
|
|
|
31
32
|
await this.flush();
|
|
32
33
|
this.state = {};
|
|
33
34
|
|
|
34
|
-
const conv = await Symposium.storage.get('thread-' + this.
|
|
35
|
+
const conv = await Symposium.storage.get('thread-' + this.unique);
|
|
35
36
|
if (conv) {
|
|
36
37
|
this.state = conv.state || {};
|
|
37
38
|
this.messages = conv.messages.map(m => new Message(m.role, m.content, m.name, m.tags));
|
|
@@ -48,7 +49,7 @@ export default class Thread {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
async storeState() {
|
|
51
|
-
await Symposium.storage.set('thread-' + this.
|
|
52
|
+
await Symposium.storage.set('thread-' + this.unique, {
|
|
52
53
|
state: this.state,
|
|
53
54
|
messages: this.messages,
|
|
54
55
|
});
|