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
| PipelineTTSEndEvent;
export interface PipelineRunOptions {
start_stage: "stt" | "intent" | "tts";
export type PipelineRunOptions = (
| {
start_stage: "intent" | "tts";
input: { text: string };
}
| {
start_stage: "stt";
input: { sample_rate: number };
}
) & {
end_stage: "stt" | "intent" | "tts";
language?: string;
pipeline?: string;
input?: { text: string };
conversation_id?: string | null;
}
};
export interface PipelineRun {
init_options: PipelineRunOptions;

View File

@ -255,6 +255,9 @@ export class AssistPipelineDebug extends LitElement {
{
start_stage: "stt",
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 userMessage =
this.pipelineRun.init_options.input?.text ||
this.pipelineRun?.stt?.stt_output?.text;
("text" in this.pipelineRun.init_options.input
? this.pipelineRun.init_options.input.text
: undefined) || this.pipelineRun?.stt?.stt_output?.text;
if (userMessage) {
messages.push({