Add sample rate to assist pipeline debug (#16135)

This commit is contained in:
Paul Bottein 2023-04-11 14:32:18 +02:00 committed by GitHub
parent a1180b7118
commit b076301513
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 6 deletions

View File

@ -84,14 +84,21 @@ type PipelineRunEvent =
| PipelineTTSStartEvent | PipelineTTSStartEvent
| PipelineTTSEndEvent; | PipelineTTSEndEvent;
export interface PipelineRunOptions { export type PipelineRunOptions = (
start_stage: "stt" | "intent" | "tts"; | {
start_stage: "intent" | "tts";
input: { text: string };
}
| {
start_stage: "stt";
input: { sample_rate: number };
}
) & {
end_stage: "stt" | "intent" | "tts"; end_stage: "stt" | "intent" | "tts";
language?: string; language?: string;
pipeline?: string; pipeline?: string;
input?: { text: string };
conversation_id?: string | null; conversation_id?: string | null;
} };
export interface PipelineRun { export interface PipelineRun {
init_options: PipelineRunOptions; init_options: PipelineRunOptions;

View File

@ -255,6 +255,9 @@ export class AssistPipelineDebug extends LitElement {
{ {
start_stage: "stt", start_stage: "stt",
end_stage: "tts", end_stage: "tts",
input: {
sample_rate: context.sampleRate,
},
} }
); );
} }

View File

@ -135,8 +135,9 @@ export class AssistPipelineDebug extends LitElement {
const messages: Array<{ from: string; text: string }> = []; const messages: Array<{ from: string; text: string }> = [];
const userMessage = const userMessage =
this.pipelineRun.init_options.input?.text || ("text" in this.pipelineRun.init_options.input
this.pipelineRun?.stt?.stt_output?.text; ? this.pipelineRun.init_options.input.text
: undefined) || this.pipelineRun?.stt?.stt_output?.text;
if (userMessage) { if (userMessage) {
messages.push({ messages.push({