mirror of
https://github.com/aljazceru/nostrdvm.git
synced 2026-01-04 23:04:24 +01:00
fix external dvm access for bot after sdk update
This commit is contained in:
23
tests/bot.py
23
tests/bot.py
@@ -1,3 +1,4 @@
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
import threading
|
||||
@@ -10,9 +11,12 @@ from nostr_dvm.bot import Bot
|
||||
from nostr_dvm.tasks import textextraction_pdf
|
||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||
from nostr_dvm.utils.backend_utils import keep_alive
|
||||
from nostr_dvm.utils.definitions import EventDefinitions
|
||||
from nostr_dvm.utils.dvmconfig import DVMConfig
|
||||
from nostr_dvm.utils.external_dvm_utils import build_external_dvm
|
||||
from nostr_dvm.utils.nip89_utils import NIP89Config
|
||||
from nostr_dvm.utils.nostr_utils import check_and_set_private_key
|
||||
from nostr_dvm.utils.output_utils import PostProcessFunctionType
|
||||
from nostr_dvm.utils.zap_utils import check_and_set_ln_bits_keys
|
||||
|
||||
|
||||
@@ -26,6 +30,7 @@ def playground():
|
||||
bot_config.LNBITS_ADMIN_KEY = admin_key # The dvm might pay failed jobs back
|
||||
bot_config.LNBITS_URL = os.getenv("LNBITS_HOST")
|
||||
|
||||
|
||||
admin_config = AdminConfig()
|
||||
|
||||
pdfextractor = textextraction_pdf.build_example("PDF Extractor", "pdf_extractor", admin_config)
|
||||
@@ -33,13 +38,27 @@ def playground():
|
||||
pdfextractor.run()
|
||||
bot_config.SUPPORTED_DVMS.append(pdfextractor) # We add translator to the bot
|
||||
|
||||
x = threading.Thread(target=Bot, args=([bot_config]))
|
||||
ymhm_external = build_external_dvm(pubkey="58c52fdca7593dffea63ba6f758779d8251c6732f54e9dc0e56d7a1afe1bb1b6",
|
||||
task="wot-discovery",
|
||||
kind=EventDefinitions.KIND_NIP90_PEOPLE_DISCOVERY,
|
||||
fix_cost=0, per_unit_cost=0, config=bot_config,
|
||||
external_post_process=PostProcessFunctionType.NONE)
|
||||
|
||||
bot_config.SUPPORTED_DVMS.append(ymhm_external)
|
||||
|
||||
admin_config = AdminConfig()
|
||||
admin_config.REBROADCAST_NIP65_RELAY_LIST = True
|
||||
x = threading.Thread(target=Bot, args=([bot_config, admin_config]))
|
||||
x.start()
|
||||
|
||||
# Keep the main function alive for libraries that require it, like openai
|
||||
# keep_alive()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
env_path = Path('.env')
|
||||
if not env_path.is_file():
|
||||
@@ -51,4 +70,4 @@ if __name__ == '__main__':
|
||||
dotenv.load_dotenv(env_path, verbose=True, override=True)
|
||||
else:
|
||||
raise FileNotFoundError(f'.env file not found at {env_path} ')
|
||||
playground()
|
||||
playground()
|
||||
Reference in New Issue
Block a user