-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: AssistantRuntime.newThread (#335)
- Loading branch information
Showing
8 changed files
with
167 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@assistant-ui/react-ai-sdk": patch | ||
"@assistant-ui/react": patch | ||
--- | ||
|
||
feat: AssistantRuntime newThread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { ProxyConfigProvider } from "./utils/ProxyConfigProvider"; | ||
export { MessageRepository } from "./runtime/utils/MessageRepository"; | ||
export { BaseAssistantRuntime } from "./runtime/core/BaseAssistantRuntime"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import type { AppendMessage } from "../../types/AssistantTypes"; | ||
import { type ModelConfigProvider } from "../../types/ModelConfigTypes"; | ||
import type { Unsubscribe } from "../../types/Unsubscribe"; | ||
import type { AssistantRuntime } from "./AssistantRuntime"; | ||
import { ThreadRuntime } from "./ThreadRuntime"; | ||
|
||
export abstract class BaseAssistantRuntime<TThreadRuntime extends ThreadRuntime> | ||
implements AssistantRuntime | ||
{ | ||
constructor(protected thread: TThreadRuntime) {} | ||
|
||
public abstract registerModelConfigProvider( | ||
provider: ModelConfigProvider, | ||
): Unsubscribe; | ||
public abstract newThread(): void; | ||
public abstract switchToThread(threadId: string): void; | ||
|
||
public get messages() { | ||
return this.thread.messages; | ||
} | ||
|
||
public get isRunning() { | ||
return this.thread.isRunning; | ||
} | ||
|
||
public getBranches(messageId: string): readonly string[] { | ||
return this.thread.getBranches(messageId); | ||
} | ||
|
||
public switchToBranch(branchId: string): void { | ||
return this.thread.switchToBranch(branchId); | ||
} | ||
|
||
public append(message: AppendMessage): void { | ||
return this.thread.append(message); | ||
} | ||
|
||
public startRun(parentId: string | null): void { | ||
return this.thread.startRun(parentId); | ||
} | ||
|
||
public cancelRun(): void { | ||
return this.thread.cancelRun(); | ||
} | ||
|
||
public addToolResult(toolCallId: string, result: any) { | ||
return this.thread.addToolResult(toolCallId, result); | ||
} | ||
|
||
public subscribe(callback: () => void): Unsubscribe { | ||
return this.thread.subscribe(callback); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters