Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Voice assistant #15841

Merged
merged 7 commits into from
Mar 17, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add more info to start event
  • Loading branch information
balloob committed Mar 16, 2023
commit 08071c8ea4123f5c8f3f8de0d7513103a235c6bb
14 changes: 6 additions & 8 deletions src/data/voice_assistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ interface PipelineEventBase {
interface PipelineRunStartEvent extends PipelineEventBase {
type: "run-start";
data: {
pipeline: string;
language: string;
session_id?: string;
};
}
Expand Down Expand Up @@ -82,10 +84,10 @@ interface PipelineRunOptions {
}

export interface PipelineRun {
options: PipelineRunOptions;
init_options: PipelineRunOptions;
events: PipelineRunEvent[];
stage: "initialized" | "stt" | "intent" | "tts" | "finish" | "error";
session: PipelineRunStartEvent["data"];
run: PipelineRunStartEvent["data"];
error?: PipelineErrorEvent["data"];
stt?: PipelineSTTStartEvent["data"] & Partial<PipelineSTTFinishEvent["data"]>;
intent?: PipelineIntentStartEvent["data"] &
Expand All @@ -98,19 +100,15 @@ export const runPipelineFromText = (
callback: (event: PipelineRun) => void,
options: PipelineRunOptions = {}
) => {
if (!options.pipeline) {
options.pipeline = "default";
}

let run: PipelineRun | undefined;

const unsubProm = hass.connection.subscribeMessage<PipelineRunEvent>(
(updateEvent) => {
if (updateEvent.type === "run-start") {
run = {
options,
init_options: options,
stage: "initialized",
session: updateEvent.data,
run: updateEvent.data,
error: undefined,
stt: undefined,
intent: undefined,
Expand Down