@assistant-ui/react
Version:
Typescript/React library for AI Chat
58 lines • 1.44 kB
JavaScript
class AttachmentRuntimeImpl {
constructor(_core) {
this._core = _core;
}
get path() {
return this._core.path;
}
__internal_bindMethods() {
this.getState = this.getState.bind(this);
this.remove = this.remove.bind(this);
this.subscribe = this.subscribe.bind(this);
}
getState() {
return this._core.getState();
}
subscribe(callback) {
return this._core.subscribe(callback);
}
}
class ComposerAttachmentRuntime extends AttachmentRuntimeImpl {
constructor(core, _composerApi) {
super(core);
this._composerApi = _composerApi;
}
remove() {
const core = this._composerApi.getState();
if (!core) throw new Error("Composer is not available");
return core.removeAttachment(this.getState().id);
}
}
class ThreadComposerAttachmentRuntimeImpl extends ComposerAttachmentRuntime {
get source() {
return "thread-composer";
}
}
class EditComposerAttachmentRuntimeImpl extends ComposerAttachmentRuntime {
get source() {
return "edit-composer";
}
}
class MessageAttachmentRuntimeImpl extends AttachmentRuntimeImpl {
get source() {
return "message";
}
constructor(core) {
super(core);
}
remove() {
throw new Error("Message attachments cannot be removed");
}
}
export {
AttachmentRuntimeImpl,
EditComposerAttachmentRuntimeImpl,
MessageAttachmentRuntimeImpl,
ThreadComposerAttachmentRuntimeImpl
};
//# sourceMappingURL=AttachmentRuntime.js.map