Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion crates/wavekat-flow/schema/flow.v1.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@
"Prompt": {
"description": "What a component speaks: TTS text (a bare string) or a reference to a pre-rendered audio asset shipped alongside the flow.",
"oneOf": [
{ "type": "string" },
{ "title": "Text", "type": "string" },
{
"title": "Audio",
"type": "object",
"required": ["audio"],
"properties": {
Expand Down
7 changes: 3 additions & 4 deletions crates/wavekat-flow/src/model_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,11 @@ impl Node {

impl Prompt {
/// The spoken text, or `None` for an audio-asset prompt. Handy for
/// traces and length validation. typify names the untagged variants
/// `Variant0` (text) and `Variant1` (`{ audio }`).
/// traces and length validation.
pub fn as_text(&self) -> Option<&str> {
match self {
Prompt::Variant0(t) => Some(t.as_str()),
Prompt::Variant1 { .. } => None,
Prompt::Text(t) => Some(t.as_str()),
Prompt::Audio { .. } => None,
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/flow-schema/src/generated/flow.v1.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@
"Prompt": {
"description": "What a component speaks: TTS text (a bare string) or a reference to a pre-rendered audio asset shipped alongside the flow.",
"oneOf": [
{ "type": "string" },
{ "title": "Text", "type": "string" },
{
"title": "Audio",
"type": "object",
"required": ["audio"],
"properties": {
Expand Down
18 changes: 9 additions & 9 deletions packages/flow-schema/src/generated/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,8 @@ export type Node = GreetingNode | HoursNode | MenuNode | RingNode | MessageNode
/**
* What a component speaks: TTS text (a bare string) or a reference to a pre-rendered audio asset shipped alongside the flow.
*/
export type Prompt =
| string
| {
/**
* Audio asset ref. A generated-clip ref is a voice_prompts id matching ^vprompt_[a-z0-9]+$.
*/
audio: string;
[k: string]: unknown;
};
export type Prompt = Text | Audio;
export type Text = string;
/**
* The cue a message node plays between its prompt and the start of recording.
*/
Expand Down Expand Up @@ -69,6 +62,13 @@ export interface GreetingNode {
exits?: Exits;
[k: string]: unknown;
}
export interface Audio {
/**
* Audio asset ref. A generated-clip ref is a voice_prompts id matching ^vprompt_[a-z0-9]+$.
*/
audio: string;
[k: string]: unknown;
}
/**
* Wired exits: exit name → target node id. Which names are valid is a property of the node's kind and is checked by the validator, not by this schema.
*/
Expand Down
2 changes: 2 additions & 0 deletions packages/flow-schema/src/generated/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ const schema = {
"description": "What a component speaks: TTS text (a bare string) or a reference to a pre-rendered audio asset shipped alongside the flow.",
"oneOf": [
{
"title": "Text",
"type": "string"
},
{
"title": "Audio",
"type": "object",
"required": [
"audio"
Expand Down
3 changes: 2 additions & 1 deletion schema/flow.v1.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@
"Prompt": {
"description": "What a component speaks: TTS text (a bare string) or a reference to a pre-rendered audio asset shipped alongside the flow.",
"oneOf": [
{ "type": "string" },
{ "title": "Text", "type": "string" },
{
"title": "Audio",
"type": "object",
"required": ["audio"],
"properties": {
Expand Down
Loading