mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-04-10 21:00:02 +02:00
update test functions with discovery
This commit is contained in:
parent
b195595b03
commit
59b0e143e6
@ -6,7 +6,7 @@ import dotenv
|
||||
from nostr_sdk import Keys
|
||||
|
||||
from nostr_dvm.subscription import Subscription
|
||||
from nostr_dvm.tasks import content_discovery_currently_popular
|
||||
from nostr_dvm.tasks import content_discovery_currently_popular, content_discovery_currently_popular_topic
|
||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||
from nostr_dvm.utils.backend_utils import keep_alive
|
||||
from nostr_dvm.utils.dvmconfig import DVMConfig
|
||||
@ -27,7 +27,10 @@ def playground():
|
||||
#admin_config.PRIVKEY = ""
|
||||
#admin_config.EVENTID = ""
|
||||
|
||||
discovery_test_sub = content_discovery_currently_popular.build_example_subscription("Currently Popular Notes DVM (with Subscriptions)", "discovery_content_test", admin_config)
|
||||
#discovery_test_sub = content_discovery_currently_popular.build_example_subscription("Currently Popular Notes DVM (with Subscriptions)", "discovery_content_test", admin_config)
|
||||
#discovery_test_sub.run()
|
||||
|
||||
discovery_test_sub = content_discovery_currently_popular_topic.build_example("Garden & Growth", "discovery_content_garden", admin_config)
|
||||
discovery_test_sub.run()
|
||||
|
||||
#discovery_test = content_discovery_currently_popular.build_example("Currently Popular Notes DVM",
|
||||
@ -43,8 +46,8 @@ def playground():
|
||||
subscription_config.LNBITS_URL = os.getenv("LNBITS_HOST")
|
||||
sub_admin_config = AdminConfig()
|
||||
#sub_admin_config.USERNPUBS = ["7782f93c5762538e1f7ccc5af83cd8018a528b9cd965048386ca1b75335f24c6"] #Add npubs of services that can contact the subscription handler
|
||||
x = threading.Thread(target=Subscription, args=(Subscription(subscription_config, sub_admin_config),))
|
||||
x.start()
|
||||
#x = threading.Thread(target=Subscription, args=(Subscription(subscription_config, sub_admin_config),))
|
||||
#x.start()
|
||||
|
||||
#keep_alive()
|
||||
|
||||
|
@ -176,6 +176,35 @@ def nostr_client_test_tts(prompt):
|
||||
return event.as_json()
|
||||
|
||||
|
||||
def nostr_client_test_disovery(user, ptag):
|
||||
keys = Keys.parse(check_and_set_private_key("test_client"))
|
||||
|
||||
relay_list = ["wss://relay.damus.io", "wss://blastr.f7z.xyz",
|
||||
]
|
||||
|
||||
relaysTag = Tag.parse(relay_list)
|
||||
alttag = Tag.parse(["alt", "This is a NIP90 DVM AI task to find content"])
|
||||
paramTag = Tag.parse(["param", "user", user])
|
||||
pTag = Tag.parse(["p", ptag])
|
||||
|
||||
tags = [relaysTag, alttag, paramTag, pTag]
|
||||
|
||||
|
||||
event = EventBuilder(EventDefinitions.KIND_NIP90_CONTENT_DISCOVERY, str("Give me content"),
|
||||
tags).to_event(keys)
|
||||
|
||||
signer = NostrSigner.keys(keys)
|
||||
client = Client(signer)
|
||||
for relay in relay_list:
|
||||
client.add_relay(relay)
|
||||
ropts = RelayOptions().ping(False)
|
||||
client.add_relay_with_opts("wss://nostr.band", ropts)
|
||||
client.connect()
|
||||
config = DVMConfig
|
||||
send_event(event, client=client, dvm_config=config)
|
||||
return event.as_json()
|
||||
|
||||
|
||||
def nostr_client_test_image_private(prompt, cashutoken):
|
||||
keys = Keys.parse(check_and_set_private_key("test_client"))
|
||||
receiver_keys = Keys.parse(check_and_set_private_key("replicate_sdxl"))
|
||||
@ -244,8 +273,9 @@ def nostr_client():
|
||||
# nostr_client_test_image("a beautiful purple ostrich watching the sunset")
|
||||
# nostr_client_test_search_profile("dontbelieve")
|
||||
wot = ["99bb5591c9116600f845107d31f9b59e2f7c7e09a1ff802e84f1d43da557ca64"]
|
||||
nostr_client_test_disovery("99bb5591c9116600f845107d31f9b59e2f7c7e09a1ff802e84f1d43da557ca64", "a21592a70ef9a00695efb3f7e816e17742d251559aff154b16d063a408bcd74d")
|
||||
#nostr_client_test_censor_filter(wot)
|
||||
nostr_client_test_inactive_filter("99bb5591c9116600f845107d31f9b59e2f7c7e09a1ff802e84f1d43da557ca64")
|
||||
#nostr_client_test_inactive_filter("99bb5591c9116600f845107d31f9b59e2f7c7e09a1ff802e84f1d43da557ca64")
|
||||
|
||||
# nostr_client_test_tts("Hello, this is a test. Mic check one, two.")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user