Merge branch 'main' into perplexity-models

This commit is contained in:
Anirban Kar
2024-12-15 15:15:01 +05:30
committed by GitHub
10 changed files with 425 additions and 6 deletions

View File

@@ -16,6 +16,7 @@ import * as nodePath from 'node:path';
import { extractRelativePath } from '~/utils/diff';
import { description } from '~/lib/persistence';
import Cookies from 'js-cookie';
import { createSampler } from '~/utils/sampler';
export interface ArtifactState {
id: string;
@@ -280,7 +281,7 @@ export class WorkbenchStore {
runAction(data: ActionCallbackData, isStreaming: boolean = false) {
if (isStreaming) {
this._runAction(data, isStreaming);
this.actionStreamSampler(data, isStreaming);
} else {
this.addToExecutionQueue(() => this._runAction(data, isStreaming));
}
@@ -296,7 +297,7 @@ export class WorkbenchStore {
const action = artifact.runner.actions.get()[data.actionId];
if (action.executed) {
if (!action || action.executed) {
return;
}
@@ -329,6 +330,10 @@ export class WorkbenchStore {
}
}
actionStreamSampler = createSampler(async (data: ActionCallbackData, isStreaming: boolean = false) => {
return await this._runAction(data, isStreaming);
}, 100); // TODO: remove this magic number to have it configurable
#getArtifact(id: string) {
const artifacts = this.artifacts.get();
return artifacts[id];