added artifact bundling for custom long artifacts like uploading folder

This commit is contained in:
Anirban Kar
2024-12-02 18:30:21 +05:30
parent eb7676577d
commit 34a8a39a3c
5 changed files with 18 additions and 4 deletions

View File

@@ -192,6 +192,7 @@ export class StreamingMessageParser {
const artifactTag = input.slice(i, openTagEnd + 1);
const artifactTitle = this.#extractAttribute(artifactTag, 'title') as string;
const type = this.#extractAttribute(artifactTag, 'type') as string;
const artifactId = this.#extractAttribute(artifactTag, 'id') as string;
if (!artifactTitle) {
@@ -207,6 +208,7 @@ export class StreamingMessageParser {
const currentArtifact = {
id: artifactId,
title: artifactTitle,
type,
} satisfies BoltArtifactData;
state.currentArtifact = currentArtifact;

View File

@@ -18,6 +18,7 @@ import { extractRelativePath } from '~/utils/diff';
export interface ArtifactState {
id: string;
title: string;
type?: string;
closed: boolean;
runner: ActionRunner;
}
@@ -229,7 +230,7 @@ export class WorkbenchStore {
// TODO: what do we wanna do and how do we wanna recover from this?
}
addArtifact({ messageId, title, id }: ArtifactCallbackData) {
addArtifact({ messageId, title, id,type }: ArtifactCallbackData) {
const artifact = this.#getArtifact(messageId);
if (artifact) {
@@ -244,6 +245,7 @@ export class WorkbenchStore {
id,
title,
closed: false,
type,
runner: new ActionRunner(webcontainer, () => this.boltTerminal),
});
}