diff --git a/nostr_dvm/tasks/texttospeech.py b/nostr_dvm/tasks/texttospeech.py index de8e901..24dcacc 100644 --- a/nostr_dvm/tasks/texttospeech.py +++ b/nostr_dvm/tasks/texttospeech.py @@ -76,11 +76,19 @@ class TextToSpeech(DVMTaskInterface): if tag.as_vec()[0] == 'i': input_type = tag.as_vec()[2] if input_type == "event": + evt = await get_event_by_id(tag.as_vec()[1], client=client, config=dvm_config) - prompt = evt.content() + + if evt is not None: + prompt = evt.content() + else: + raise FileNotFoundError("Couldn't find event") + + elif input_type == "text": prompt = tag.as_vec()[1] elif input_type == "job": + evt = await get_referenced_event_by_id(event_id=tag.as_vec()[1], client=client, kinds=[EventDefinitions.KIND_NIP90_RESULT_EXTRACT_TEXT, EventDefinitions.KIND_NIP90_RESULT_SUMMARIZE_TEXT, diff --git a/nostr_dvm/utils/nip65_utils.py b/nostr_dvm/utils/nip65_utils.py index ffa737f..85639cc 100644 --- a/nostr_dvm/utils/nip65_utils.py +++ b/nostr_dvm/utils/nip65_utils.py @@ -17,9 +17,10 @@ async def nip65_announce_relays(dvm_config, client): event = EventBuilder(EventDefinitions.KIND_RELAY_ANNOUNCEMENT, content, tags).to_event(keys) eventid = await send_event(event, client=client, dvm_config=dvm_config, blastr=True) - if(eventid is not None): - print(bcolors.BLUE + "[" + dvm_config.NIP89.NAME + "] Announced NIP 65 for " + dvm_config.NIP89.NAME +" (EventID: " + str(eventid.to_hex()) +")" + bcolors.ENDC) + if (eventid is not None): + print( + bcolors.BLUE + "[" + dvm_config.NIP89.NAME + "] Announced NIP 65 for " + dvm_config.NIP89.NAME + " (EventID: " + str( + eventid.id.to_hex()) + ")" + bcolors.ENDC) else: print( - bcolors.RED + "[" + dvm_config.NIP89.NAME + "] Could not announce NIP 65 for " + dvm_config.NIP89.NAME + bcolors.ENDC) - + bcolors.RED + "[" + dvm_config.NIP89.NAME + "] Could not announce NIP 65 for " + dvm_config.NIP89.NAME + bcolors.ENDC) diff --git a/nostr_dvm/utils/nostr_utils.py b/nostr_dvm/utils/nostr_utils.py index 5a2e676..857707e 100644 --- a/nostr_dvm/utils/nostr_utils.py +++ b/nostr_dvm/utils/nostr_utils.py @@ -39,6 +39,7 @@ async def get_event_by_id(event_id: str, client: Client, config=None) -> Event | return events[0] else: + print("Event not found") return None async def get_events_async(client, filter, timeout): diff --git a/tests/tts.py b/tests/tts.py index 6a35266..ae55261 100644 --- a/tests/tts.py +++ b/tests/tts.py @@ -22,7 +22,12 @@ if __name__ == '__main__': dvm_config = build_default_config(identifier) dvm_config.USE_OWN_VENV = True dvm_config.FIX_COST = 0 - dvm_config.PER_UNIT_COST = 0.1 + dvm_config.PER_UNIT_COST = 0 + relays = dvm_config.RELAY_LIST + relays.append("wss://relay.damus.io") + relays.append("wss://relay.primal.net") + dvm_config.RELAY_LIST = relays + admin_config_tts.LUD16 = dvm_config.LN_ADDRESS # use an alternative local wav file you want to use for cloning options = {'input_file': ""}