Add voice audio, capture and transcript, browser monitor, and DM UI
This commit is contained in:
+20
-1
@@ -21,7 +21,9 @@ export const PACING = {
|
||||
idleMinMs: 5000,
|
||||
idleMaxMs: 20000,
|
||||
readMinMs: 100,
|
||||
readMaxMs: 300
|
||||
readMaxMs: 300,
|
||||
voiceMinMs: 250,
|
||||
voiceMaxMs: 750
|
||||
};
|
||||
|
||||
function randomBetween(min: number, max: number): number {
|
||||
@@ -95,6 +97,23 @@ export function paced<T>(task: () => Promise<T>): Promise<T> {
|
||||
return run;
|
||||
}
|
||||
|
||||
/** Serialize a voice action with a short gap. Voice state changes are not sends. */
|
||||
export function pacedVoice<T>(task: () => Promise<T>): Promise<T> {
|
||||
const delay = randomBetween(PACING.voiceMinMs, PACING.voiceMaxMs);
|
||||
const run = queue.then(async () => {
|
||||
await sleep(delay);
|
||||
if (process.env.DEBUG === "1") {
|
||||
console.error(`[voice] action (+${delay}ms)`);
|
||||
}
|
||||
return task();
|
||||
});
|
||||
queue = run.then(
|
||||
() => undefined,
|
||||
() => undefined
|
||||
);
|
||||
return run;
|
||||
}
|
||||
|
||||
export function getQueryCount(): number {
|
||||
return queryCount;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user