Skip to content

Commit e7a8e72

Browse files
committed
fix: durability long-form-synthesis
1 parent 1b6598d commit e7a8e72

File tree

26 files changed

+711
-348
lines changed

26 files changed

+711
-348
lines changed

test/tts/components-rust/test-tts/src/lib.rs

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -564,35 +564,56 @@ impl Guest for Component {
564564

565565
match synthesize_long_form(&long_content, &voice, Some(&chapter_breaks)) {
566566
Ok(operation) => {
567-
// Monitor the operation progress
568-
let mut attempts = 0;
569-
let max_attempts = 30;
570-
571-
while attempts < max_attempts {
572-
if attempts == 3 {
573-
// Simulate crash
574-
let agent_name = std::env::var("GOLEM_WORKER_NAME").unwrap();
575-
mimic_crash(&agent_name);
576-
}
577-
578-
let status = operation.get_status();
579-
let progress: f32 = operation.get_progress();
567+
loop {
568+
let status = match operation.get_status() {
569+
Ok(s) => s,
570+
Err(err) => {
571+
test_result.push_str(&format!("ERROR getting status: {:?}\n", err));
572+
break;
573+
}
574+
};
575+
let progress = match operation.get_progress() {
576+
Ok(p) => p,
577+
Err(err) => {
578+
test_result.push_str(&format!("ERROR getting progress: {:?}\n", err));
579+
break;
580+
}
581+
};
580582
trace!(
581583
"Operation status: {:?}, progress: {:.2}%",
582584
status,
583585
progress * 100.0
584586
);
585587

588+
// Simulate crash
589+
let agent_name = std::env::var("GOLEM_WORKER_NAME").unwrap();
590+
mimic_crash(&agent_name, 1);
591+
586592
match status {
587593
OperationStatus::Completed => {
588594
trace!("Long-form synthesis completed successfully");
589595
test_result.push_str(&format!("{test_name} ✅\n"));
590596

597+
// Test get_task_id after durability recovery
598+
trace!("Getting task ID after durability recovery...");
599+
match operation.get_task_id() {
600+
Ok(task_id) => {
601+
trace!("Received task ID: {}", task_id);
602+
test_result.push_str("1. Test get task ID after recovery ✅\n");
603+
test_result.push_str(&format!("Task ID: {}\n", task_id));
604+
}
605+
Err(err) => {
606+
trace!("Failed to get task ID");
607+
test_result.push_str("1. Test get task ID after recovery ❌\n");
608+
test_result.push_str(&format!("ERROR getting task ID: {:?}\n", err));
609+
}
610+
}
611+
591612
trace!("Getting long-form synthesis result...");
592613
match operation.get_result() {
593614
Ok(result) => {
594615
trace!("Recieved Long-form synthesis result");
595-
test_result.push_str("1. Test get operation result ✅\n");
616+
test_result.push_str("2. Test get operation result ✅\n");
596617
test_result.push_str(&format!(
597618
"Output location: {}\n",
598619
result.output_location
@@ -616,7 +637,7 @@ impl Guest for Component {
616637
}
617638
Err(err) => {
618639
trace!("Failed to get long-form synthesis result");
619-
test_result.push_str("1. Test get operation result ❌\n");
640+
test_result.push_str("2. Test get operation result ❌\n");
620641
test_result
621642
.push_str(&format!("ERROR getting result: {:?}\n", err));
622643
}
@@ -703,13 +724,6 @@ impl Guest for Component {
703724
thread::sleep(Duration::from_millis(500));
704725
}
705726
}
706-
707-
attempts += 1;
708-
}
709-
710-
if attempts >= max_attempts {
711-
test_result.push_str("2. Test long-form synthesis completion ❌\n");
712-
test_result.push_str("ERROR: Operation timed out\n");
713727
}
714728
}
715729
Err(err) => {
@@ -784,7 +798,7 @@ impl Guest for Component {
784798

785799
// Simulate crash
786800
let agent_name = std::env::var("GOLEM_WORKER_NAME").unwrap();
787-
mimic_crash(&agent_name);
801+
mimic_crash(&agent_name, 2);
788802

789803
match lexicon.export_content() {
790804
Ok(content) => {
@@ -892,11 +906,11 @@ fn push_result(
892906
test_result.push_str(&format!("💾 Audio saved at {audio_file_location}"));
893907
}
894908

895-
fn mimic_crash(agent_name: &str) {
909+
fn mimic_crash(agent_name: &str, count: u64) {
896910
atomically(|| {
897911
let client = TestHelperApi::new(&agent_name);
898912
let answer = client.blocking_inc_and_get();
899-
if answer == 1 {
913+
if answer == count {
900914
panic!("Simulating crash during durability test")
901915
}
902916
});

test/tts/wit/deps/golem-tts/golem-tts.wit

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,9 @@ interface advanced {
368368
) -> result<long-form-operation, tts-error>;
369369

370370
resource long-form-operation {
371-
get-status: func() -> operation-status;
372-
get-progress: func() -> f32;
371+
get-task-id: func() -> result<string, tts-error>;
372+
get-status: func() -> result<operation-status, tts-error>;
373+
get-progress: func() -> result<f32, tts-error>;
373374
cancel: func() -> result<_, tts-error>;
374375
get-result: func() -> result<long-form-result, tts-error>;
375376
}

tts/deepgram/src/bindings.rs

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Generated by `wit-bindgen` 0.41.0. DO NOT EDIT!
22
// Options used:
33
// * runtime_path: "wit_bindgen_rt"
4-
// * with "golem:tts/[email protected]" = "golem_tts::golem::tts::synthesis"
5-
// * with "golem:tts/[email protected]" = "golem_tts::golem::tts::advanced"
64
// * with "golem:tts/[email protected]" = "golem_tts::golem::tts::types"
75
// * with "golem:tts/[email protected]" = "golem_tts::golem::tts::voices"
6+
// * with "golem:tts/[email protected]" = "golem_tts::golem::tts::advanced"
7+
// * with "golem:tts/[email protected]" = "golem_tts::golem::tts::synthesis"
88
// * generate_unused_types
99
use golem_tts::golem::tts::types as __with_name0;
1010
use golem_tts::golem::tts::voices as __with_name1;
@@ -16,8 +16,8 @@ use golem_tts::golem::tts::advanced as __with_name3;
1616
)]
1717
#[doc(hidden)]
1818
#[allow(clippy::octal_escapes)]
19-
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 4791] = *b"\
20-
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xb5$\x01A\x02\x01A\x13\
19+
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 4861] = *b"\
20+
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xfb$\x01A\x02\x01A\x13\
2121
\x01B&\x01m\x04\x0acharacters\x08requests\x07seconds\x07credits\x04\0\x0aquota-u\
2222
nit\x03\0\0\x01r\x04\x04usedy\x05limity\x0areset-timew\x04unit\x01\x04\0\x0aquot\
2323
a-info\x03\0\x02\x01q\x15\x0drequest-error\x01s\0\x0cinvalid-text\x01s\0\x0dtext\
@@ -78,7 +78,7 @@ e\x01\"\x01p\x01\x01p\x09\x01j\x01$\x01\x0b\x01@\x03\x06inputs#\x05voice\x0f\x07
7878
options\x20\0%\x04\0\x10synthesize-batch\x01&\x01p\x0d\x01j\x01'\x01\x0b\x01@\x02\
7979
\x05input\x01\x05voice\x0f\0(\x04\0\x10get-timing-marks\x01)\x01j\x01\x1f\x01\x0b\
8080
\x01@\x02\x05input\x01\x05voice\x0f\0*\x04\0\x0evalidate-input\x01+\x04\0\x19gol\
81-
em:tts/[email protected]\x05\x0c\x02\x03\0\0\x12synthesis-metadata\x01BR\x02\x03\x02\
81+
em:tts/[email protected]\x05\x0c\x02\x03\0\0\x12synthesis-metadata\x01BV\x02\x03\x02\
8282
\x01\x01\x04\0\x09tts-error\x03\0\0\x02\x03\x02\x01\x07\x04\0\x0caudio-config\x03\
8383
\0\x02\x02\x03\x02\x01\x02\x04\0\x0dlanguage-code\x03\0\x04\x02\x03\x02\x01\x0d\x04\
8484
\0\x12synthesis-metadata\x03\0\x06\x02\x03\x02\x01\x04\x04\0\x0cvoice-gender\x03\
@@ -99,22 +99,23 @@ t-entry-count\x01#\x01j\0\x01\x01\x01@\x03\x04self\x20\x04words\x0dpronunciation
9999
s\0$\x04\0'[method]pronunciation-lexicon.add-entry\x01%\x01@\x02\x04self\x20\x04\
100100
words\0$\x04\0*[method]pronunciation-lexicon.remove-entry\x01&\x01j\x01s\x01\x01\
101101
\x01@\x01\x04self\x20\0'\x04\0,[method]pronunciation-lexicon.export-content\x01(\
102-
\x01h\x19\x01@\x01\x04self)\0\x1b\x04\0&[method]long-form-operation.get-status\x01\
103-
*\x01@\x01\x04self)\0v\x04\0([method]long-form-operation.get-progress\x01+\x01@\x01\
104-
\x04self)\0$\x04\0\"[method]long-form-operation.cancel\x01,\x01j\x01\x1f\x01\x01\
105-
\x01@\x01\x04self)\0-\x04\0&[method]long-form-operation.get-result\x01.\x01p\x10\
106-
\x01j\x01\x0b\x01\x01\x01@\x03\x04names\x0daudio-samples/\x0bdescription\x0d\00\x04\
107-
\0\x12create-voice-clone\x011\x01@\x02\x04names\x0fcharacteristics\x15\00\x04\0\x0c\
108-
design-voice\x012\x01k\x7f\x01j\x01\x0c\x01\x01\x01@\x03\x0binput-audio\x0c\x0ct\
109-
arget-voice\x0b\x0fpreserve-timing3\04\x04\0\x0dconvert-voice\x015\x01kv\x01@\x03\
110-
\x0bdescriptions\x10duration-seconds6\x0fstyle-influence6\04\x04\0\x15generate-s\
111-
ound-effect\x017\x01p\x18\x01k8\x01i\x16\x01j\x01:\x01\x01\x01@\x03\x04names\x08\
112-
language\x05\x07entries9\0;\x04\0\x0ecreate-lexicon\x01<\x01py\x01k=\x01i\x19\x01\
113-
j\x01?\x01\x01\x01@\x03\x07contents\x05voice\x0b\x0echapter-breaks>\0\xc0\0\x04\0\
114-
\x14synthesize-long-form\x01A\x04\0\x18golem:tts/[email protected]\x05\x0e\x04\0$go\
115-
lem:tts-deepgram/[email protected]\x04\0\x0b\x11\x01\0\x0btts-library\x03\0\0\0G\
116-
\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.227.1\x10wit-bindgen\
117-
-rust\x060.41.0";
102+
\x01h\x19\x01@\x01\x04self)\0'\x04\0'[method]long-form-operation.get-task-id\x01\
103+
*\x01j\x01\x1b\x01\x01\x01@\x01\x04self)\0+\x04\0&[method]long-form-operation.ge\
104+
t-status\x01,\x01j\x01v\x01\x01\x01@\x01\x04self)\0-\x04\0([method]long-form-ope\
105+
ration.get-progress\x01.\x01@\x01\x04self)\0$\x04\0\"[method]long-form-operation\
106+
.cancel\x01/\x01j\x01\x1f\x01\x01\x01@\x01\x04self)\00\x04\0&[method]long-form-o\
107+
peration.get-result\x011\x01p\x10\x01j\x01\x0b\x01\x01\x01@\x03\x04names\x0daudi\
108+
o-samples2\x0bdescription\x0d\03\x04\0\x12create-voice-clone\x014\x01@\x02\x04na\
109+
mes\x0fcharacteristics\x15\03\x04\0\x0cdesign-voice\x015\x01k\x7f\x01j\x01\x0c\x01\
110+
\x01\x01@\x03\x0binput-audio\x0c\x0ctarget-voice\x0b\x0fpreserve-timing6\07\x04\0\
111+
\x0dconvert-voice\x018\x01kv\x01@\x03\x0bdescriptions\x10duration-seconds9\x0fst\
112+
yle-influence9\07\x04\0\x15generate-sound-effect\x01:\x01p\x18\x01k;\x01i\x16\x01\
113+
j\x01=\x01\x01\x01@\x03\x04names\x08language\x05\x07entries<\0>\x04\0\x0ecreate-\
114+
lexicon\x01?\x01py\x01k\xc0\0\x01i\x19\x01j\x01\xc2\0\x01\x01\x01@\x03\x07conten\
115+
ts\x05voice\x0b\x0echapter-breaks\xc1\0\0\xc3\0\x04\0\x14synthesize-long-form\x01\
116+
D\x04\0\x18golem:tts/[email protected]\x05\x0e\x04\0$golem:tts-deepgram/tts-library\
117+
@1.0.0\x04\0\x0b\x11\x01\0\x0btts-library\x03\0\0\0G\x09producers\x01\x0cprocess\
118+
ed-by\x02\x0dwit-component\x070.227.1\x10wit-bindgen-rust\x060.41.0";
118119
#[inline(never)]
119120
#[doc(hidden)]
120121
pub fn __link_custom_section_describing_imports() {

tts/deepgram/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ impl ExtendedAdvancedTrait for DeepgramComponent {
170170
content: String,
171171
voice: Voice,
172172
chapter_breaks: Option<Vec<u32>>,
173+
_task_id: Option<String>,
173174
) -> Result<Self::LongFormOperation, golem_tts::golem::tts::types::TtsError> {
174175
let client = Deepgram::new()?;
175176
let voice_canonical_name = voice.name.clone(); // Use canonical name
@@ -179,6 +180,7 @@ impl ExtendedAdvancedTrait for DeepgramComponent {
179180
chapter_breaks,
180181
)
181182
}
183+
182184
}
183185

184186
type DurableDeepgramComponent = DurableTTS<DeepgramComponent>;

tts/deepgram/src/resources.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,16 @@ impl GuestPronunciationLexicon for DeepgramPronunciationLexicon {
6565
pub struct DeepgramLongFormOperation;
6666

6767
impl GuestLongFormOperation for DeepgramLongFormOperation {
68-
fn get_status(&self) -> OperationStatus {
69-
OperationStatus::Failed
68+
fn get_task_id(&self) -> Result<String, TtsError> {
69+
Ok("".to_string())
7070
}
7171

72-
fn get_progress(&self) -> f32 {
73-
100.0
72+
fn get_status(&self) -> Result<OperationStatus, TtsError> {
73+
Ok(OperationStatus::Failed)
74+
}
75+
76+
fn get_progress(&self) -> Result<f32, TtsError> {
77+
Ok(100.0)
7478
}
7579

7680
fn cancel(&self) -> Result<(), TtsError> {

tts/deepgram/wit/deps/golem-tts/golem-tts.wit

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,9 @@ interface advanced {
368368
) -> result<long-form-operation, tts-error>;
369369

370370
resource long-form-operation {
371-
get-status: func() -> operation-status;
372-
get-progress: func() -> f32;
371+
get-task-id: func() -> result<string, tts-error>;
372+
get-status: func() -> result<operation-status, tts-error>;
373+
get-progress: func() -> result<f32, tts-error>;
373374
cancel: func() -> result<_, tts-error>;
374375
get-result: func() -> result<long-form-result, tts-error>;
375376
}

tts/elevenlabs/src/bindings.rs

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// Options used:
33
// * runtime_path: "wit_bindgen_rt"
44
// * with "golem:tts/[email protected]" = "golem_tts::golem::tts::types"
5-
// * with "golem:tts/[email protected]" = "golem_tts::golem::tts::voices"
65
// * with "golem:tts/[email protected]" = "golem_tts::golem::tts::advanced"
76
// * with "golem:tts/[email protected]" = "golem_tts::golem::tts::synthesis"
7+
// * with "golem:tts/[email protected]" = "golem_tts::golem::tts::voices"
88
// * generate_unused_types
99
use golem_tts::golem::tts::types as __with_name0;
1010
use golem_tts::golem::tts::voices as __with_name1;
@@ -16,8 +16,8 @@ use golem_tts::golem::tts::advanced as __with_name3;
1616
)]
1717
#[doc(hidden)]
1818
#[allow(clippy::octal_escapes)]
19-
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 4793] = *b"\
20-
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xb7$\x01A\x02\x01A\x13\
19+
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 4863] = *b"\
20+
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xfd$\x01A\x02\x01A\x13\
2121
\x01B&\x01m\x04\x0acharacters\x08requests\x07seconds\x07credits\x04\0\x0aquota-u\
2222
nit\x03\0\0\x01r\x04\x04usedy\x05limity\x0areset-timew\x04unit\x01\x04\0\x0aquot\
2323
a-info\x03\0\x02\x01q\x15\x0drequest-error\x01s\0\x0cinvalid-text\x01s\0\x0dtext\
@@ -78,7 +78,7 @@ e\x01\"\x01p\x01\x01p\x09\x01j\x01$\x01\x0b\x01@\x03\x06inputs#\x05voice\x0f\x07
7878
options\x20\0%\x04\0\x10synthesize-batch\x01&\x01p\x0d\x01j\x01'\x01\x0b\x01@\x02\
7979
\x05input\x01\x05voice\x0f\0(\x04\0\x10get-timing-marks\x01)\x01j\x01\x1f\x01\x0b\
8080
\x01@\x02\x05input\x01\x05voice\x0f\0*\x04\0\x0evalidate-input\x01+\x04\0\x19gol\
81-
em:tts/[email protected]\x05\x0c\x02\x03\0\0\x12synthesis-metadata\x01BR\x02\x03\x02\
81+
em:tts/[email protected]\x05\x0c\x02\x03\0\0\x12synthesis-metadata\x01BV\x02\x03\x02\
8282
\x01\x01\x04\0\x09tts-error\x03\0\0\x02\x03\x02\x01\x07\x04\0\x0caudio-config\x03\
8383
\0\x02\x02\x03\x02\x01\x02\x04\0\x0dlanguage-code\x03\0\x04\x02\x03\x02\x01\x0d\x04\
8484
\0\x12synthesis-metadata\x03\0\x06\x02\x03\x02\x01\x04\x04\0\x0cvoice-gender\x03\
@@ -99,22 +99,23 @@ t-entry-count\x01#\x01j\0\x01\x01\x01@\x03\x04self\x20\x04words\x0dpronunciation
9999
s\0$\x04\0'[method]pronunciation-lexicon.add-entry\x01%\x01@\x02\x04self\x20\x04\
100100
words\0$\x04\0*[method]pronunciation-lexicon.remove-entry\x01&\x01j\x01s\x01\x01\
101101
\x01@\x01\x04self\x20\0'\x04\0,[method]pronunciation-lexicon.export-content\x01(\
102-
\x01h\x19\x01@\x01\x04self)\0\x1b\x04\0&[method]long-form-operation.get-status\x01\
103-
*\x01@\x01\x04self)\0v\x04\0([method]long-form-operation.get-progress\x01+\x01@\x01\
104-
\x04self)\0$\x04\0\"[method]long-form-operation.cancel\x01,\x01j\x01\x1f\x01\x01\
105-
\x01@\x01\x04self)\0-\x04\0&[method]long-form-operation.get-result\x01.\x01p\x10\
106-
\x01j\x01\x0b\x01\x01\x01@\x03\x04names\x0daudio-samples/\x0bdescription\x0d\00\x04\
107-
\0\x12create-voice-clone\x011\x01@\x02\x04names\x0fcharacteristics\x15\00\x04\0\x0c\
108-
design-voice\x012\x01k\x7f\x01j\x01\x0c\x01\x01\x01@\x03\x0binput-audio\x0c\x0ct\
109-
arget-voice\x0b\x0fpreserve-timing3\04\x04\0\x0dconvert-voice\x015\x01kv\x01@\x03\
110-
\x0bdescriptions\x10duration-seconds6\x0fstyle-influence6\04\x04\0\x15generate-s\
111-
ound-effect\x017\x01p\x18\x01k8\x01i\x16\x01j\x01:\x01\x01\x01@\x03\x04names\x08\
112-
language\x05\x07entries9\0;\x04\0\x0ecreate-lexicon\x01<\x01py\x01k=\x01i\x19\x01\
113-
j\x01?\x01\x01\x01@\x03\x07contents\x05voice\x0b\x0echapter-breaks>\0\xc0\0\x04\0\
114-
\x14synthesize-long-form\x01A\x04\0\x18golem:tts/[email protected]\x05\x0e\x04\0&go\
115-
lem:tts-elevenlabs/[email protected]\x04\0\x0b\x11\x01\0\x0btts-library\x03\0\0\0\
116-
G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.227.1\x10wit-bindge\
117-
n-rust\x060.41.0";
102+
\x01h\x19\x01@\x01\x04self)\0'\x04\0'[method]long-form-operation.get-task-id\x01\
103+
*\x01j\x01\x1b\x01\x01\x01@\x01\x04self)\0+\x04\0&[method]long-form-operation.ge\
104+
t-status\x01,\x01j\x01v\x01\x01\x01@\x01\x04self)\0-\x04\0([method]long-form-ope\
105+
ration.get-progress\x01.\x01@\x01\x04self)\0$\x04\0\"[method]long-form-operation\
106+
.cancel\x01/\x01j\x01\x1f\x01\x01\x01@\x01\x04self)\00\x04\0&[method]long-form-o\
107+
peration.get-result\x011\x01p\x10\x01j\x01\x0b\x01\x01\x01@\x03\x04names\x0daudi\
108+
o-samples2\x0bdescription\x0d\03\x04\0\x12create-voice-clone\x014\x01@\x02\x04na\
109+
mes\x0fcharacteristics\x15\03\x04\0\x0cdesign-voice\x015\x01k\x7f\x01j\x01\x0c\x01\
110+
\x01\x01@\x03\x0binput-audio\x0c\x0ctarget-voice\x0b\x0fpreserve-timing6\07\x04\0\
111+
\x0dconvert-voice\x018\x01kv\x01@\x03\x0bdescriptions\x10duration-seconds9\x0fst\
112+
yle-influence9\07\x04\0\x15generate-sound-effect\x01:\x01p\x18\x01k;\x01i\x16\x01\
113+
j\x01=\x01\x01\x01@\x03\x04names\x08language\x05\x07entries<\0>\x04\0\x0ecreate-\
114+
lexicon\x01?\x01py\x01k\xc0\0\x01i\x19\x01j\x01\xc2\0\x01\x01\x01@\x03\x07conten\
115+
ts\x05voice\x0b\x0echapter-breaks\xc1\0\0\xc3\0\x04\0\x14synthesize-long-form\x01\
116+
D\x04\0\x18golem:tts/[email protected]\x05\x0e\x04\0&golem:tts-elevenlabs/tts-libra\
117+
[email protected]\x04\0\x0b\x11\x01\0\x0btts-library\x03\0\0\0G\x09producers\x01\x0cproce\
118+
ssed-by\x02\x0dwit-component\x070.227.1\x10wit-bindgen-rust\x060.41.0";
118119
#[inline(never)]
119120
#[doc(hidden)]
120121
pub fn __link_custom_section_describing_imports() {

tts/elevenlabs/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ impl ExtendedAdvancedTrait for ElevenLabsTtsComponent {
162162
content: String,
163163
voice: Voice,
164164
chapter_breaks: Option<Vec<u32>>,
165+
_task_id: Option<String>,
165166
) -> Result<Self::LongFormOperation, TtsError> {
166167
let client = Elevenlabs::new()?;
167168
let voice_id = voice.id.clone();

tts/elevenlabs/src/resources.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,16 @@ impl GuestPronunciationLexicon for ElPronunciationLexicon {
181181
pub struct ElLongFormSynthesis;
182182

183183
impl GuestLongFormOperation for ElLongFormSynthesis {
184-
fn get_status(&self) -> OperationStatus {
185-
OperationStatus::Cancelled
184+
fn get_task_id(&self) -> Result<String, TtsError> {
185+
Ok("".to_string())
186186
}
187187

188-
fn get_progress(&self) -> f32 {
189-
100.0
188+
fn get_status(&self) -> Result<OperationStatus, TtsError> {
189+
Ok(OperationStatus::Cancelled)
190+
}
191+
192+
fn get_progress(&self) -> Result<f32, TtsError> {
193+
Ok(100.0)
190194
}
191195

192196
fn cancel(&self) -> Result<(), TtsError> {

tts/elevenlabs/wit/deps/golem-tts/golem-tts.wit

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,9 @@ interface advanced {
368368
) -> result<long-form-operation, tts-error>;
369369

370370
resource long-form-operation {
371-
get-status: func() -> operation-status;
372-
get-progress: func() -> f32;
371+
get-task-id: func() -> result<string, tts-error>;
372+
get-status: func() -> result<operation-status, tts-error>;
373+
get-progress: func() -> result<f32, tts-error>;
373374
cancel: func() -> result<_, tts-error>;
374375
get-result: func() -> result<long-form-result, tts-error>;
375376
}

0 commit comments

Comments
 (0)