diff --git a/nostr_dvm/tasks/imagegeneration_sdxl.py b/nostr_dvm/tasks/imagegeneration_sdxl.py index 17760df..7f6f131 100644 --- a/nostr_dvm/tasks/imagegeneration_sdxl.py +++ b/nostr_dvm/tasks/imagegeneration_sdxl.py @@ -9,7 +9,7 @@ from nostr_dvm.backends.nova_server.utils import check_server_status, send_reque from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface from nostr_dvm.utils.admin_utils import AdminConfig from nostr_dvm.utils.backend_utils import keep_alive -from nostr_dvm.utils.dvmconfig import DVMConfig +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.definitions import EventDefinitions from nostr_dvm.utils.nostr_utils import check_and_set_private_key @@ -170,15 +170,8 @@ class ImageGenerationSDXL(DVMTaskInterface): # playground or elsewhere def build_example(name, identifier, admin_config, server_address, default_model="stabilityai/stable-diffusion-xl" "-base-1.0", default_lora=""): - dvm_config = DVMConfig() - dvm_config.PRIVATE_KEY = check_and_set_private_key(identifier) - npub = Keys.from_sk_str(dvm_config.PRIVATE_KEY).public_key().to_bech32() - invoice_key, admin_key, wallet_id, user_id, lnaddress = check_and_set_ln_bits_keys(identifier, npub) - dvm_config.LNBITS_INVOICE_KEY = invoice_key - dvm_config.LNBITS_ADMIN_KEY = admin_key # The dvm might pay failed jobs back - dvm_config.LNBITS_URL = os.getenv("LNBITS_HOST") - admin_config.LUD16 = lnaddress - + dvm_config = build_default_config(identifier) + admin_config.LUD16 = dvm_config.LN_ADDRESS # A module might have options it can be initialized with, here we set a default model, and the server # address it should use. These parameters can be freely defined in the task component options = {'default_model': default_model, 'default_lora': default_lora, 'server': server_address} diff --git a/nostr_dvm/tasks/imagegeneration_sdxlimg2img.py b/nostr_dvm/tasks/imagegeneration_sdxlimg2img.py index 5cca033..c92161e 100644 --- a/nostr_dvm/tasks/imagegeneration_sdxlimg2img.py +++ b/nostr_dvm/tasks/imagegeneration_sdxlimg2img.py @@ -9,7 +9,7 @@ from nostr_dvm.backends.nova_server.utils import check_server_status, send_reque from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface from nostr_dvm.utils.admin_utils import AdminConfig from nostr_dvm.utils.backend_utils import keep_alive -from nostr_dvm.utils.dvmconfig import DVMConfig +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.definitions import EventDefinitions from nostr_dvm.utils.nostr_utils import check_and_set_private_key @@ -197,14 +197,8 @@ class ImageGenerationSDXLIMG2IMG(DVMTaskInterface): # or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the # playground or elsewhere def build_example(name, identifier, admin_config, server_address, default_lora="", strength=0.6): - dvm_config = DVMConfig() - dvm_config.PRIVATE_KEY = check_and_set_private_key(identifier) - npub = Keys.from_sk_str(dvm_config.PRIVATE_KEY).public_key().to_bech32() - invoice_key, admin_key, wallet_id, user_id, lnaddress = check_and_set_ln_bits_keys(identifier, npub) - dvm_config.LNBITS_INVOICE_KEY = invoice_key - dvm_config.LNBITS_ADMIN_KEY = admin_key # The dvm might pay failed jobs back - dvm_config.LNBITS_URL = os.getenv("LNBITS_HOST") - admin_config.LUD16 = lnaddress + dvm_config = build_default_config(identifier) + admin_config.LUD16 = dvm_config.LN_ADDRESS nip90params = { "negative_prompt": { diff --git a/nostr_dvm/tasks/imageinterrogator.py b/nostr_dvm/tasks/imageinterrogator.py index 8addb91..bdb0033 100644 --- a/nostr_dvm/tasks/imageinterrogator.py +++ b/nostr_dvm/tasks/imageinterrogator.py @@ -9,7 +9,7 @@ from nostr_dvm.backends.nova_server.utils import check_server_status, send_reque from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface from nostr_dvm.utils.admin_utils import AdminConfig from nostr_dvm.utils.backend_utils import keep_alive -from nostr_dvm.utils.dvmconfig import DVMConfig +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.definitions import EventDefinitions from nostr_dvm.utils.nostr_utils import check_and_set_private_key @@ -112,14 +112,8 @@ class ImageInterrogator(DVMTaskInterface): # or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the # playground or elsewhere def build_example(name, identifier, admin_config, server_address): - dvm_config = DVMConfig() - dvm_config.PRIVATE_KEY = check_and_set_private_key(identifier) - npub = Keys.from_sk_str(dvm_config.PRIVATE_KEY).public_key().to_bech32() - invoice_key, admin_key, wallet_id, user_id, lnaddress = check_and_set_ln_bits_keys(identifier, npub) - dvm_config.LNBITS_INVOICE_KEY = invoice_key - dvm_config.LNBITS_ADMIN_KEY = admin_key # The dvm might pay failed jobs back - dvm_config.LNBITS_URL = os.getenv("LNBITS_HOST") - admin_config.LUD16 = lnaddress + dvm_config = build_default_config(identifier) + admin_config.LUD16 = dvm_config.LN_ADDRESS nip90params = { "method": { diff --git a/nostr_dvm/tasks/imageupscale.py b/nostr_dvm/tasks/imageupscale.py index 633050a..10f6b3b 100644 --- a/nostr_dvm/tasks/imageupscale.py +++ b/nostr_dvm/tasks/imageupscale.py @@ -9,7 +9,7 @@ from nostr_dvm.backends.nova_server.utils import check_server_status, send_reque from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface from nostr_dvm.utils.admin_utils import AdminConfig from nostr_dvm.utils.backend_utils import keep_alive -from nostr_dvm.utils.dvmconfig import DVMConfig +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.definitions import EventDefinitions from nostr_dvm.utils.nostr_utils import check_and_set_private_key @@ -110,14 +110,8 @@ class ImageUpscale(DVMTaskInterface): # or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the # playground or elsewhere def build_example(name, identifier, admin_config, server_address): - dvm_config = DVMConfig() - dvm_config.PRIVATE_KEY = check_and_set_private_key(identifier) - npub = Keys.from_sk_str(dvm_config.PRIVATE_KEY).public_key().to_bech32() - invoice_key, admin_key, wallet_id, user_id, lnaddress = check_and_set_ln_bits_keys(identifier, npub) - dvm_config.LNBITS_INVOICE_KEY = invoice_key - dvm_config.LNBITS_ADMIN_KEY = admin_key # The dvm might pay failed jobs back - dvm_config.LNBITS_URL = os.getenv("LNBITS_HOST") - admin_config.LUD16 = lnaddress + dvm_config = build_default_config(identifier) + admin_config.LUD16 = dvm_config.LN_ADDRESS nip90params = { "upscale": { diff --git a/nostr_dvm/tasks/textextraction_whisperx.py b/nostr_dvm/tasks/textextraction_whisperx.py index aa57c06..1aaa20c 100644 --- a/nostr_dvm/tasks/textextraction_whisperx.py +++ b/nostr_dvm/tasks/textextraction_whisperx.py @@ -10,7 +10,7 @@ from nostr_dvm.backends.nova_server.utils import check_server_status, send_reque from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface from nostr_dvm.utils.admin_utils import AdminConfig from nostr_dvm.utils.backend_utils import keep_alive -from nostr_dvm.utils.dvmconfig import DVMConfig +from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config from nostr_dvm.utils.mediasource_utils import organize_input_media_data from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag from nostr_dvm.utils.definitions import EventDefinitions @@ -153,14 +153,8 @@ class SpeechToTextWhisperX(DVMTaskInterface): # or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the # playground or elsewhere def build_example(name, identifier, admin_config, server_address): - dvm_config = DVMConfig() - dvm_config.PRIVATE_KEY = check_and_set_private_key(identifier) - npub = Keys.from_sk_str(dvm_config.PRIVATE_KEY).public_key().to_bech32() - invoice_key, admin_key, wallet_id, user_id, lnaddress = check_and_set_ln_bits_keys(identifier, npub) - dvm_config.LNBITS_INVOICE_KEY = invoice_key - dvm_config.LNBITS_ADMIN_KEY = admin_key # The dvm might pay failed jobs back - dvm_config.LNBITS_URL = os.getenv("LNBITS_HOST") - admin_config.LUD16 = lnaddress + dvm_config = build_default_config(identifier) + admin_config.LUD16 = dvm_config.LN_ADDRESS # A module might have options it can be initialized with, here we set a default model, and the server # address it should use. These parameters can be freely defined in the task component