mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-05-06 22:40:18 +02:00
more inputs for tts
This commit is contained in:
parent
c0df123cf7
commit
4aed46de52
@ -11,6 +11,7 @@ from nostr_dvm.utils.definitions import EventDefinitions
|
||||
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||
from nostr_dvm.utils.output_utils import upload_media_to_hoster
|
||||
from nostr_dvm.utils.nostr_utils import get_event_by_id, get_referenced_event_by_id
|
||||
|
||||
"""
|
||||
This File contains a Module to generate Audio based on an input and a voice
|
||||
@ -57,8 +58,18 @@ class TextToSpeech(DVMTaskInterface):
|
||||
for tag in event.tags():
|
||||
if tag.as_vec()[0] == 'i':
|
||||
input_type = tag.as_vec()[2]
|
||||
if input_type == "text":
|
||||
if input_type == "event":
|
||||
evt = get_event_by_id(tag.as_vec()[1], client=client, config=dvm_config)
|
||||
prompt = evt.content()
|
||||
elif input_type == "text":
|
||||
prompt = tag.as_vec()[1]
|
||||
elif input_type == "job":
|
||||
evt = 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,
|
||||
EventDefinitions.KIND_NIP90_RESULT_TRANSLATE_TEXT],
|
||||
dvm_config=dvm_config)
|
||||
prompt = evt.content()
|
||||
if input_type == "url":
|
||||
input_file = tag.as_vec()[1]
|
||||
elif tag.as_vec()[0] == 'param':
|
||||
|
@ -238,7 +238,7 @@ def decrypt_private_zap_message(msg: str, privkey: SecretKey, pubkey: PublicKey)
|
||||
return str(ex)
|
||||
|
||||
|
||||
def zap(lud16: str, amount: int, content, zapped_event: Event, keys, dvm_config, zaptype="public"):
|
||||
def zaprequest(lud16: str, amount: int, content, zapped_event, zapped_user, keys, relay_list, zaptype="public"):
|
||||
if lud16.startswith("LNURL") or lud16.startswith("lnurl"):
|
||||
url = lnurl.decode(lud16)
|
||||
elif '@' in lud16: # LNaddress
|
||||
@ -251,11 +251,16 @@ def zap(lud16: str, amount: int, content, zapped_event: Event, keys, dvm_config,
|
||||
callback = ob["callback"]
|
||||
encoded_lnurl = lnurl.encode(url)
|
||||
amount_tag = Tag.parse(['amount', str(amount * 1000)])
|
||||
relays_tag = Tag.parse(['relays', str(dvm_config.RELAY_LIST)])
|
||||
p_tag = Tag.parse(['p', zapped_event.pubkey().to_hex()])
|
||||
e_tag = Tag.parse(['e', zapped_event.id().to_hex()])
|
||||
relays_tag = Tag.parse(['relays', str(relay_list)])
|
||||
lnurl_tag = Tag.parse(['lnurl', encoded_lnurl])
|
||||
tags = [amount_tag, relays_tag, p_tag, e_tag, lnurl_tag]
|
||||
if zapped_event is not None:
|
||||
p_tag = Tag.parse(['p', zapped_event.pubkey().to_hex()])
|
||||
e_tag = Tag.parse(['e', zapped_event.id().to_hex()])
|
||||
tags = [amount_tag, relays_tag, p_tag, e_tag, lnurl_tag]
|
||||
else:
|
||||
p_tag = Tag.parse(['p', zapped_user.to_hex()])
|
||||
tags = [amount_tag, relays_tag, p_tag, lnurl_tag]
|
||||
|
||||
|
||||
if zaptype == "private":
|
||||
key_str = keys.secret_key().to_hex() + zapped_event.id().to_hex() + str(zapped_event.created_at().as_secs())
|
||||
@ -281,7 +286,6 @@ def zap(lud16: str, amount: int, content, zapped_event: Event, keys, dvm_config,
|
||||
print(e)
|
||||
return None
|
||||
|
||||
|
||||
def get_price_per_sat(currency):
|
||||
import requests
|
||||
|
||||
@ -325,6 +329,8 @@ def make_ln_address_nostdress(identifier, npub, pin, nostdressdomain):
|
||||
return "", ""
|
||||
|
||||
|
||||
|
||||
|
||||
def check_and_set_ln_bits_keys(identifier, npub):
|
||||
if not os.getenv("LNBITS_INVOICE_KEY_" + identifier.upper()):
|
||||
invoicekey, adminkey, walletid, userid, success = create_lnbits_account(identifier)
|
||||
|
Loading…
x
Reference in New Issue
Block a user