Merge pull request #25 from vgcman16/codex/parameterize-delay-in-actionstreamsampler

Parameterize action stream sample delay
This commit is contained in:
vgcman16 2025-06-05 21:03:20 -05:00 committed by GitHub
commit 7f3465f7e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View File

@ -17,6 +17,7 @@ import { extractRelativePath } from '~/utils/diff';
import { description } from '~/lib/persistence';
import Cookies from 'js-cookie';
import { createSampler } from '~/utils/sampler';
import { ACTION_STREAM_SAMPLE_INTERVAL } from '~/utils/constants';
import type { ActionAlert, DeployAlert, SupabaseAlert } from '~/types/actions';
const { saveAs } = fileSaver;
@ -604,9 +605,12 @@ 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
actionStreamSampler = createSampler(
async (data: ActionCallbackData, isStreaming: boolean = false) => {
return await this._runAction(data, isStreaming);
},
ACTION_STREAM_SAMPLE_INTERVAL,
);
#getArtifact(id: string) {
const artifacts = this.artifacts.get();

View File

@ -8,6 +8,8 @@ export const MODEL_REGEX = /^\[Model: (.*?)\]\n\n/;
export const PROVIDER_REGEX = /\[Provider: (.*?)\]\n\n/;
export const DEFAULT_MODEL = 'claude-3-5-sonnet-latest';
export const PROMPT_COOKIE_KEY = 'cachedPrompt';
// Interval used by actionStreamSampler in ms
export const ACTION_STREAM_SAMPLE_INTERVAL = 100;
const llmManager = LLMManager.getInstance(import.meta.env);