Skip to content

Commit

Permalink
fix(thread): end previous thread before creating a new one on each run
Browse files Browse the repository at this point in the history
  • Loading branch information
paztek committed Feb 7, 2024
1 parent b874c45 commit 752a9c2
Show file tree
Hide file tree
Showing 17 changed files with 67 additions and 51 deletions.
3 changes: 3 additions & 0 deletions dist/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ class Thread extends EventEmitter {
}
}
async doRun(assistant) {
if (this._stream) {
this._stream.push(null);
}
this._stream = new stream.Readable({
read: () => { },
});
Expand Down
2 changes: 1 addition & 1 deletion dist/index.cjs.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dist/index.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.esm.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dist/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ class Thread extends EventEmitter {
}
}
async doRun(assistant) {
if (this._stream) {
this._stream.push(null);
}
this._stream = new Readable({
read: () => { },
});
Expand Down
2 changes: 1 addition & 1 deletion dist/index.mjs.map

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ LLobotoMy for Azure

#### Defined in

[src/message/message.ts:32](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/message/message.ts#L32)
[src/message/message.ts:32](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/message/message.ts#L32)

___

Expand All @@ -51,7 +51,7 @@ ___

#### Defined in

[src/message/message.ts:16](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/message/message.ts#L16)
[src/message/message.ts:16](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/message/message.ts#L16)

___

Expand All @@ -61,7 +61,7 @@ ___

#### Defined in

[src/message/message.ts:20](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/message/message.ts#L20)
[src/message/message.ts:20](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/message/message.ts#L20)

___

Expand All @@ -71,7 +71,7 @@ ___

#### Defined in

[src/message/message.ts:25](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/message/message.ts#L25)
[src/message/message.ts:25](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/message/message.ts#L25)

___

Expand All @@ -81,7 +81,7 @@ ___

#### Defined in

[src/message/message.ts:12](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/message/message.ts#L12)
[src/message/message.ts:12](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/message/message.ts#L12)

___

Expand All @@ -91,7 +91,7 @@ ___

#### Defined in

[src/message/message.ts:18](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/message/message.ts#L18)
[src/message/message.ts:18](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/message/message.ts#L18)

___

Expand All @@ -101,7 +101,7 @@ ___

#### Defined in

[src/message/message.ts:14](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/message/message.ts#L14)
[src/message/message.ts:14](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/message/message.ts#L14)

___

Expand All @@ -111,7 +111,7 @@ ___

#### Defined in

[src/message/message.ts:23](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/message/message.ts#L23)
[src/message/message.ts:23](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/message/message.ts#L23)

___

Expand All @@ -128,7 +128,7 @@ ___

#### Defined in

[src/message/message.ts:10](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/message/message.ts#L10)
[src/message/message.ts:10](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/message/message.ts#L10)

## Functions

Expand All @@ -148,7 +148,7 @@ m is ChatRequestMessage

#### Defined in

[src/thread/thread.ts:268](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L268)
[src/thread/thread.ts:272](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L272)

___

Expand All @@ -168,4 +168,4 @@ m is ChatResponseMessage

#### Defined in

[src/thread/thread.ts:262](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L262)
[src/thread/thread.ts:266](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L266)
14 changes: 7 additions & 7 deletions docs/classes/Assistant.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#### Defined in

[src/assistant/assistant.ts:26](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/assistant/assistant.ts#L26)
[src/assistant/assistant.ts:26](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/assistant/assistant.ts#L26)

## Properties

Expand All @@ -44,7 +44,7 @@

#### Defined in

[src/assistant/assistant.ts:19](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/assistant/assistant.ts#L19)
[src/assistant/assistant.ts:19](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/assistant/assistant.ts#L19)

___

Expand All @@ -54,7 +54,7 @@ ___

#### Defined in

[src/assistant/assistant.ts:23](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/assistant/assistant.ts#L23)
[src/assistant/assistant.ts:23](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/assistant/assistant.ts#L23)

___

Expand All @@ -64,7 +64,7 @@ ___

#### Defined in

[src/assistant/assistant.ts:21](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/assistant/assistant.ts#L21)
[src/assistant/assistant.ts:21](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/assistant/assistant.ts#L21)

___

Expand All @@ -74,7 +74,7 @@ ___

#### Defined in

[src/assistant/assistant.ts:22](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/assistant/assistant.ts#L22)
[src/assistant/assistant.ts:22](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/assistant/assistant.ts#L22)

___

Expand All @@ -84,7 +84,7 @@ ___

#### Defined in

[src/assistant/assistant.ts:24](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/assistant/assistant.ts#L24)
[src/assistant/assistant.ts:24](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/assistant/assistant.ts#L24)

## Methods

Expand All @@ -104,4 +104,4 @@ ___

#### Defined in

[src/assistant/assistant.ts:34](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/assistant/assistant.ts#L34)
[src/assistant/assistant.ts:34](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/assistant/assistant.ts#L34)
6 changes: 3 additions & 3 deletions docs/classes/RequiredAction.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ EventEmitter.constructor

#### Defined in

[src/thread/thread.ts:247](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L247)
[src/thread/thread.ts:251](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L251)

## Properties

Expand All @@ -77,7 +77,7 @@ EventEmitter.constructor

#### Defined in

[src/thread/thread.ts:247](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L247)
[src/thread/thread.ts:251](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L251)

___

Expand Down Expand Up @@ -934,7 +934,7 @@ ___

#### Defined in

[src/thread/thread.ts:251](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L251)
[src/thread/thread.ts:255](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L255)

___

Expand Down
30 changes: 15 additions & 15 deletions docs/classes/Thread.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ EventEmitter.constructor

#### Defined in

[src/thread/thread.ts:25](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L25)
[src/thread/thread.ts:25](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L25)

## Properties

Expand All @@ -93,7 +93,7 @@ EventEmitter.constructor

#### Defined in

[src/thread/thread.ts:21](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L21)
[src/thread/thread.ts:21](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L21)

___

Expand All @@ -103,7 +103,7 @@ ___

#### Defined in

[src/thread/thread.ts:20](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L20)
[src/thread/thread.ts:20](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L20)

___

Expand All @@ -113,7 +113,7 @@ ___

#### Defined in

[src/thread/thread.ts:22](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L22)
[src/thread/thread.ts:22](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L22)

___

Expand All @@ -123,7 +123,7 @@ ___

#### Defined in

[src/thread/thread.ts:26](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L26)
[src/thread/thread.ts:26](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L26)

___

Expand All @@ -133,7 +133,7 @@ ___

#### Defined in

[src/thread/thread.ts:23](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L23)
[src/thread/thread.ts:23](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L23)

___

Expand Down Expand Up @@ -266,7 +266,7 @@ node_modules/@types/node/events.d.ts:395

#### Defined in

[src/thread/thread.ts:37](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L37)
[src/thread/thread.ts:37](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L37)

___

Expand All @@ -280,7 +280,7 @@ ___

#### Defined in

[src/thread/thread.ts:33](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L33)
[src/thread/thread.ts:33](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L33)

## Methods

Expand Down Expand Up @@ -357,7 +357,7 @@ ___

#### Defined in

[src/thread/thread.ts:42](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L42)
[src/thread/thread.ts:42](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L42)

___

Expand All @@ -378,7 +378,7 @@ ___

#### Defined in

[src/thread/thread.ts:190](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L190)
[src/thread/thread.ts:194](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L194)

___

Expand All @@ -398,7 +398,7 @@ ___

#### Defined in

[src/thread/thread.ts:221](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L221)
[src/thread/thread.ts:225](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L225)

___

Expand All @@ -418,7 +418,7 @@ ___

#### Defined in

[src/thread/thread.ts:54](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L54)
[src/thread/thread.ts:54](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L54)

___

Expand Down Expand Up @@ -506,7 +506,7 @@ ___

#### Defined in

[src/thread/thread.ts:235](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L235)
[src/thread/thread.ts:239](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L239)

___

Expand Down Expand Up @@ -591,7 +591,7 @@ ___

#### Defined in

[src/thread/thread.ts:201](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L201)
[src/thread/thread.ts:205](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L205)

___

Expand Down Expand Up @@ -1106,7 +1106,7 @@ ___

#### Defined in

[src/thread/thread.ts:46](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/thread.ts#L46)
[src/thread/thread.ts:46](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/thread.ts#L46)

___

Expand Down
4 changes: 2 additions & 2 deletions docs/classes/ThreadMessageConverter.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#### Defined in

[src/thread/message.converter.ts:19](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/message.converter.ts#L19)
[src/thread/message.converter.ts:19](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/message.converter.ts#L19)

## Methods

Expand All @@ -53,4 +53,4 @@ so they can be sent again to the LLM.

#### Defined in

[src/thread/message.converter.ts:25](https://github.com/paztek/llobotomy-azure/blob/debbf07/src/thread/message.converter.ts#L25)
[src/thread/message.converter.ts:25](https://github.com/paztek/llobotomy-azure/blob/b874c45/src/thread/message.converter.ts#L25)
Loading

0 comments on commit 752a9c2

Please sign in to comment.