consider multiple keys as source for wot

This commit is contained in:
Believethehype
2024-09-19 12:10:10 +02:00
parent 1c377716c6
commit 826ba2556b
5 changed files with 13 additions and 13 deletions

View File

@@ -18,7 +18,7 @@ from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
from nostr_dvm.utils.nip88_utils import NIP88Config, check_and_set_d_tag_nip88, check_and_set_tiereventid_nip88
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag, create_amount_tag
from nostr_dvm.utils.output_utils import post_process_list_to_events
from nostr_dvm.utils.wot_utils import build_network_from, save_network, print_results
from nostr_dvm.utils.wot_utils import build_wot_network, save_network, print_results
"""
This File contains a Module to update the database for content discovery dvms
@@ -147,12 +147,9 @@ class DicoverContentDBUpdateScheduler(DVMTaskInterface):
if self.dvm_config.WOT_FILTERING:
user = self.dvm_config.WOT_BASED_ON_NPUB
depth = self.dvm_config.WOT_DEPTH
print("Calculating WOT for " + user)
print("Calculating WOT for " + str(self.dvm_config.WOT_BASED_ON_NPUBS))
filtering = cli.filtering()
index_map, G = await build_network_from(user, depth=depth, max_batch=500, max_time_request=10)
index_map, G = await build_wot_network(self.dvm_config.WOT_BASED_ON_NPUBS, depth=self.dvm_config.WOT_DEPTH, max_batch=500, max_time_request=10)
# Do we actually need pagerank here?
#print('computing global pagerank...')

View File

@@ -19,7 +19,7 @@ from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
from nostr_dvm.utils.nip88_utils import NIP88Config, check_and_set_d_tag_nip88, check_and_set_tiereventid_nip88
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag, create_amount_tag
from nostr_dvm.utils.output_utils import post_process_list_to_events, post_process_list_to_users
from nostr_dvm.utils.wot_utils import build_network_from, save_network, load_network, print_results, \
from nostr_dvm.utils.wot_utils import build_wot_network, save_network, load_network, print_results, \
convert_index_to_hex
"""
@@ -141,7 +141,7 @@ class DiscoverPeopleMyWOT(DVMTaskInterface):
#hop1
user_id = PublicKey.parse(options["user"]).to_hex()
index_map, G = await build_network_from(options["user"], depth=int(options["hops"]), max_batch=500, max_time_request=10)
index_map, G = await build_wot_network(options["user"], depth=int(options["hops"]), max_batch=500, max_time_request=10)
if use_files:
save_network(index_map, G, options["user"])

View File

@@ -25,7 +25,10 @@ class DVMConfig:
# Straight Censorship (reply guy spam)
WOT_FILTERING = False
WOT_BASED_ON_NPUB = "99bb5591c9116600f845107d31f9b59e2f7c7e09a1ff802e84f1d43da557ca64"
WOT_BASED_ON_NPUBS = ["99bb5591c9116600f845107d31f9b59e2f7c7e09a1ff802e84f1d43da557ca64",
"460c25e682fda7832b52d1f22d3d22b3176d972f60dcdc3212ed8c92ef85065c",
"3f770d65d3a764a9c5cb503ae123e62ec7598ad035d836e2a810f3877a745b24"
]
WOT_DEPTH = 2

View File

@@ -93,7 +93,7 @@ async def get_following(pks, max_time_request=10, newer_than_time=None):
return following
async def build_network_from(seed_pks, depth=2, max_batch=500, max_time_request=10):
async def build_wot_network(seed_pks, depth=2, max_batch=500, max_time_request=10):
if not seed_pks:
print('Error: seed_pks cannot be empty')
return
@@ -636,5 +636,5 @@ async def convert_index_to_hex(graph, index_map, show_results_num):
def test():
# WARNING, DEPENDING ON DEPTH THIS TAKES LONG
user = '3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d'
index_map, network_graph = asyncio.run(build_network_from(user, depth=2, max_batch=500, max_time_request=10))
index_map, network_graph = asyncio.run(build_wot_network(user, depth=2, max_batch=500, max_time_request=10))
save_network(index_map, network_graph, user)

View File

@@ -27,7 +27,7 @@
"outputs": [],
"source": [
"# Imports\n",
"from nostr_dvm.utils.wot_utils import build_network_from, save_network, load_network, get_mc_pagerank, get_subrank, get_metadata, print_results\n",
"from nostr_dvm.utils.wot_utils import build_wot_network, save_network, load_network, get_mc_pagerank, get_subrank, get_metadata, print_results\n",
"import time\n",
"import networkx as nx\n",
"import random\n",
@@ -85,7 +85,7 @@
}
],
"source": [
"index_map, G = await build_network_from(user, depth=2, max_batch=500, max_time_request=10)\n",
"index_map, G = await build_wot_network(user, depth=2, max_batch=500, max_time_request=10)\n",
"if use_files:\n",
" save_network(index_map, G, user)"
],