check length of input text for per unit calculation

This commit is contained in:
Believethehype 2023-12-29 17:58:07 +01:00
parent f4c1e834c6
commit 89939fc15a
3 changed files with 13 additions and 12 deletions

View File

@ -334,7 +334,8 @@ class DVM:
user = get_or_add_user(self.dvm_config.DB, original_event.pubkey().to_hex(),
client=self.client, config=self.dvm_config)
print(user.lud16 + " " + str(amount))
bolt11 = zaprequest(user.lud16, amount, "Couldn't finish job, returning sats", original_event,
bolt11 = zaprequest(user.lud16, amount, "Couldn't finish job, returning sats",
original_event,
self.keys, self.dvm_config, zaptype="private")
if bolt11 is None:
print("Receiver has no Lightning address, can't zap back.")

View File

@ -24,7 +24,8 @@ Outputs: Generated Audiofile
class TextToSpeech(DVMTaskInterface):
KIND: int = EventDefinitions.KIND_NIP90_TEXT_TO_SPEECH
TASK: str = "text-to-speech"
FIX_COST: float = 200
FIX_COST: float = 20
PER_UNIT_COST = 0.1
dependencies = [("nostr-dvm", "nostr-dvm"),
("TTS", "TTS==0.22.0")]

View File

@ -20,8 +20,7 @@ def input_data_file_duration(event, dvm_config, client, start=0, end=0):
input_type = tag.as_vec()[2]
if input_type == "text":
# For now, ignore length of any text, just return 1.
return 1
return len(input_value)
if input_type == "event": # NIP94 event
evt = get_event_by_id(input_value, client=client, config=dvm_config)
@ -29,7 +28,7 @@ def input_data_file_duration(event, dvm_config, client, start=0, end=0):
input_value, input_type = check_nip94_event_for_media(evt, input_value, input_type)
if input_type == "text":
# For now, ingore length of any text, just return 1.
return 1
return len(input_value)
if input_type == "url":
source_type = check_source_type(input_value)