mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-03-17 13:21:48 +01:00
refactor / cleanup
This commit is contained in:
parent
db35d29204
commit
6220d761e5
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 believethehype
|
||||
Copyright (c) 2023-2024 believethehype
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
2
main.py
2
main.py
@ -4,7 +4,7 @@ import dotenv
|
||||
|
||||
from nostr_dvm.tasks.generic_dvm import GenericDVM
|
||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||
from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
||||
from nostr_dvm.utils.dvmconfig import build_default_config
|
||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||
from nostr_sdk import Keys, Kind
|
||||
|
||||
|
@ -310,7 +310,6 @@ async def send_job_status_reaction(original_event_id_hex, original_event_author_
|
||||
|
||||
keys = Keys.parse(dvm_config.PRIVATE_KEY)
|
||||
reaction_event = EventBuilder(EventDefinitions.KIND_FEEDBACK, str(content), reply_tags).to_event(keys)
|
||||
# send_event(reaction_event, client=self.client, dvm_config=self.dvm_config)
|
||||
await send_event_outbox(reaction_event, client=client, dvm_config=dvm_config)
|
||||
|
||||
if dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value:
|
||||
|
@ -132,7 +132,6 @@ def get_all_subscriptions_from_sql_table(db):
|
||||
finally:
|
||||
if con:
|
||||
con.close()
|
||||
# print("The SQLite connection is closed")
|
||||
|
||||
|
||||
def delete_from_subscription_sql_table(db, id):
|
||||
|
@ -18,7 +18,7 @@ from nostr_sdk import PublicKey, SecretKey, Event, EventBuilder, Tag, Keys, gene
|
||||
|
||||
from nostr_dvm.utils.nostr_utils import get_event_by_id, check_and_decrypt_own_tags, update_profile_lnaddress
|
||||
|
||||
# TODO tor connection to lnbits
|
||||
# tor connection to lnbits
|
||||
# proxies = {
|
||||
# 'http': 'socks5h://127.0.0.1:9050',
|
||||
# 'https': 'socks5h://127.0.0.1:9050'
|
||||
|
@ -1,5 +1,3 @@
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
import threading
|
||||
from pathlib import Path
|
||||
@ -10,11 +8,9 @@ from nostr_sdk import Keys
|
||||
from nostr_dvm.bot import Bot
|
||||
from nostr_dvm.tasks import textextraction_pdf, convert_media, discovery_inactive_follows, translation_google
|
||||
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
|
||||
|
@ -9,17 +9,11 @@ from duck_chat import ModelType
|
||||
from nostr_sdk import Keys, Kind
|
||||
|
||||
from nostr_dvm.bot import Bot
|
||||
from nostr_dvm.tasks import textextraction_pdf, convert_media, discovery_inactive_follows, translation_google
|
||||
from nostr_dvm.tasks.generic_dvm import GenericDVM
|
||||
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, build_default_config
|
||||
from nostr_dvm.utils.external_dvm_utils import build_external_dvm
|
||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||
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
|
||||
|
||||
|
||||
|
||||
def playground(announce = False):
|
||||
|
@ -6,16 +6,13 @@ from pathlib import Path
|
||||
import dotenv
|
||||
from nostr_sdk import Keys, LogLevel, init_logger
|
||||
|
||||
from nostr_dvm.tasks import search_users, advanced_search
|
||||
from nostr_dvm.tasks.advanced_search import AdvancedSearch
|
||||
from nostr_dvm.tasks.advanced_search_wine import AdvancedSearchWine
|
||||
from nostr_dvm.tasks.imagegeneration_openai_dalle import ImageGenerationDALLE
|
||||
from nostr_dvm.tasks.search_users import SearchUser
|
||||
|
||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||
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.nostr_utils import check_and_set_private_key
|
||||
from nostr_dvm.utils.zap_utils import check_and_set_ln_bits_keys, get_price_per_sat
|
||||
|
||||
from nostr_dvm.utils.zap_utils import get_price_per_sat
|
||||
|
||||
rebroadcast_NIP89 = False # Announce NIP89 on startup Only do this if you know what you're doing.
|
||||
rebroadcast_NIP65_Relay_List = False
|
||||
|
@ -24,7 +24,6 @@ from nostr_dvm.tasks.content_discovery_currently_popular_topic import DicoverCon
|
||||
from nostr_dvm.tasks.discovery_trending_notes_nostrband import TrendingNotesNostrBand
|
||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||
from nostr_dvm.utils.dvmconfig import build_default_config, DVMConfig
|
||||
from nostr_dvm.utils.mediasource_utils import organize_input_media_data
|
||||
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 create_amount_tag, NIP89Config, check_and_set_d_tag
|
||||
from nostr_dvm.utils.nostr_utils import check_and_set_private_key
|
||||
|
@ -1,10 +1,8 @@
|
||||
import json
|
||||
import os
|
||||
import threading
|
||||
from pathlib import Path
|
||||
|
||||
import dotenv
|
||||
from nostr_sdk import init_logger, LogLevel, Keys, NostrLibrary
|
||||
from nostr_sdk import init_logger, LogLevel
|
||||
|
||||
from nostr_dvm.tasks.content_discovery_currently_popular_topic import DicoverContentCurrentlyPopularbyTopic
|
||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||
|
@ -1,13 +1,11 @@
|
||||
import json
|
||||
import os
|
||||
import threading
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import dotenv
|
||||
from nostr_sdk import init_logger, LogLevel, Keys, NostrLibrary
|
||||
from nostr_sdk import init_logger, LogLevel
|
||||
|
||||
from nostr_dvm.tasks.content_discovery_currently_popular_gallery import DicoverContentCurrentlyPopularGallery
|
||||
from nostr_dvm.tasks.people_discovery_wot import DiscoverPeopleWOT
|
||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||
from nostr_dvm.utils.dvmconfig import build_default_config
|
||||
from nostr_dvm.utils.nip89_utils import create_amount_tag, NIP89Config, check_and_set_d_tag
|
||||
|
@ -6,9 +6,7 @@ from pathlib import Path
|
||||
import dotenv
|
||||
from nostr_sdk import init_logger, LogLevel, Keys, NostrLibrary
|
||||
|
||||
from nostr_dvm.tasks.content_discovery_currently_popular_gallery import DicoverContentCurrentlyPopularGallery
|
||||
from nostr_dvm.tasks.content_discovery_currently_popular_mostr import DicoverContentCurrentlyPopularMostr
|
||||
from nostr_dvm.tasks.people_discovery_wot import DiscoverPeopleWOT
|
||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||
from nostr_dvm.utils.dvmconfig import build_default_config
|
||||
from nostr_dvm.utils.nip89_utils import create_amount_tag, NIP89Config, check_and_set_d_tag
|
||||
|
@ -1,15 +1,11 @@
|
||||
import json
|
||||
import os
|
||||
import threading
|
||||
from pathlib import Path
|
||||
|
||||
import dotenv
|
||||
from nostr_sdk import init_logger, LogLevel, Keys, NostrLibrary
|
||||
|
||||
from nostr_dvm.tasks.content_discovery_currently_popular_gallery import DicoverContentCurrentlyPopularGallery
|
||||
from nostr_dvm.tasks.content_discovery_currently_popular_mostr import DicoverContentCurrentlyPopularMostr
|
||||
from nostr_dvm.tasks.content_discovery_latest_one_per_follower import Discoverlatestperfollower
|
||||
from nostr_dvm.tasks.people_discovery_wot import DiscoverPeopleWOT
|
||||
|
||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||
from nostr_dvm.utils.dvmconfig import build_default_config
|
||||
from nostr_dvm.utils.nip89_utils import create_amount_tag, NIP89Config, check_and_set_d_tag
|
||||
|
@ -1,13 +1,10 @@
|
||||
import json
|
||||
import os
|
||||
import threading
|
||||
from pathlib import Path
|
||||
|
||||
import dotenv
|
||||
from nostr_sdk import init_logger, LogLevel, Keys, NostrLibrary
|
||||
from nostr_sdk import init_logger, LogLevel
|
||||
|
||||
from nostr_dvm.tasks.people_discovery_mywot import DiscoverPeopleMyWOT
|
||||
from nostr_dvm.tasks.people_discovery_wot import DiscoverPeopleWOT
|
||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||
from nostr_dvm.utils.dvmconfig import build_default_config
|
||||
from nostr_dvm.utils.nip89_utils import create_amount_tag, NIP89Config, check_and_set_d_tag
|
||||
|
@ -1,10 +1,8 @@
|
||||
import json
|
||||
import os
|
||||
import threading
|
||||
from pathlib import Path
|
||||
|
||||
import dotenv
|
||||
from nostr_sdk import init_logger, LogLevel, Keys, NostrLibrary
|
||||
from nostr_sdk import init_logger, LogLevel
|
||||
|
||||
from nostr_dvm.tasks.content_discovery_currently_latest_longform import DicoverContentLatestLongForm
|
||||
from nostr_dvm.tasks.content_discovery_currently_latest_wiki import DicoverContentLatestWiki
|
||||
|
@ -1,18 +1,9 @@
|
||||
import os
|
||||
import threading
|
||||
from pathlib import Path
|
||||
|
||||
import dotenv
|
||||
from nostr_sdk import Keys
|
||||
|
||||
from nostr_dvm.subscription import Subscription
|
||||
from nostr_dvm.tasks import content_discovery_currently_popular, discovery_censor_wot, discovery_inactive_follows, \
|
||||
discovery_bot_farms
|
||||
from nostr_dvm.tasks import discovery_bot_farms
|
||||
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.nostr_utils import check_and_set_private_key
|
||||
from nostr_dvm.utils.zap_utils import check_and_set_ln_bits_keys
|
||||
|
||||
|
||||
|
||||
def playground():
|
||||
|
@ -1,6 +1,5 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
from platform import system
|
||||
|
||||
import dotenv
|
||||
from duck_chat import ModelType
|
||||
|
@ -2,16 +2,15 @@ from datetime import timedelta
|
||||
from pathlib import Path
|
||||
|
||||
import dotenv
|
||||
from nostr_sdk import PublicKey, Timestamp, Event, HandleNotification, Alphabet, Filter, SingleLetterTag, Kind
|
||||
from nostr_sdk import PublicKey
|
||||
|
||||
|
||||
import asyncio
|
||||
import argparse
|
||||
|
||||
from nostr_dvm.utils import dvmconfig
|
||||
|
||||
from nostr_dvm.utils.dvmconfig import DVMConfig
|
||||
from nostr_dvm.utils.nut_wallet_utils import NutZapWallet
|
||||
from nostr_dvm.utils.print_utils import bcolors
|
||||
|
||||
|
||||
# Run with params for test functions or set the default here
|
||||
|
@ -7,7 +7,7 @@ from nostr_sdk import Keys, PublicKey
|
||||
|
||||
from nostr_dvm.utils import dvmconfig
|
||||
from nostr_dvm.utils.nwc_tools import nwc_zap
|
||||
from nostr_dvm.utils.zap_utils import create_bolt11_lud16, zaprequest
|
||||
from nostr_dvm.utils.zap_utils import zaprequest
|
||||
|
||||
|
||||
async def playground():
|
||||
|
@ -2,17 +2,10 @@ import json
|
||||
from pathlib import Path
|
||||
|
||||
import dotenv
|
||||
import torch
|
||||
from diffusers import FluxPipeline
|
||||
from nostr_sdk import Kind
|
||||
|
||||
|
||||
from nostr_dvm.tasks.generic_dvm import GenericDVM
|
||||
from nostr_dvm.tasks.summarization_duckduck_ai import SummarizationDuckDuck
|
||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||
from nostr_dvm.utils.dvmconfig import build_default_config
|
||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||
from nostr_dvm.utils.output_utils import upload_media_to_hoster
|
||||
|
||||
|
||||
def playground(announce=False):
|
||||
@ -57,6 +50,5 @@ if __name__ == '__main__':
|
||||
dotenv.load_dotenv(env_path, verbose=True, override=True)
|
||||
else:
|
||||
raise FileNotFoundError(f'.env file not found at {env_path} ')
|
||||
#pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16)
|
||||
|
||||
playground(announce=False)
|
||||
|
@ -1,16 +1,13 @@
|
||||
import asyncio
|
||||
import json
|
||||
import time
|
||||
from pathlib import Path
|
||||
from threading import Thread
|
||||
|
||||
from nostr_dvm.utils.nip65_utils import nip65_announce_relays
|
||||
from nostr_dvm.utils.nut_wallet_utils import NutZapWallet
|
||||
from nostr_dvm.utils.print_utils import bcolors
|
||||
|
||||
import dotenv
|
||||
from nostr_sdk import Keys, Client, Tag, EventBuilder, Filter, HandleNotification, Timestamp, nip04_decrypt, \
|
||||
nip04_encrypt, NostrSigner, PublicKey, Event, Kind, RelayOptions
|
||||
nip04_encrypt, NostrSigner, Event, Kind, RelayOptions
|
||||
|
||||
from nostr_dvm.utils.dvmconfig import DVMConfig
|
||||
from nostr_dvm.utils.nostr_utils import send_event, check_and_set_private_key
|
||||
|
@ -4,13 +4,12 @@ from datetime import timedelta
|
||||
from pathlib import Path
|
||||
|
||||
import dotenv
|
||||
from nostr_sdk import Keys, Client, Tag, EventBuilder, Filter, HandleNotification, Timestamp, nip04_decrypt, \
|
||||
nip04_encrypt, EventId, Options, PublicKey, Event, NostrSigner, Nip19Event, SecretKey, Kind
|
||||
from nostr_sdk import Keys, Client, Tag, Filter, Timestamp, \
|
||||
EventId, Options, PublicKey, NostrSigner, Nip19Event, Kind
|
||||
|
||||
from nostr_dvm.utils import definitions, dvmconfig
|
||||
from nostr_dvm.utils.definitions import relay_timeout
|
||||
from nostr_dvm.utils.dvmconfig import DVMConfig
|
||||
from nostr_dvm.utils.gallery_utils import gallery_announce_list
|
||||
from nostr_dvm.utils.nip89_utils import NIP89Config
|
||||
from nostr_dvm.utils.nostr_utils import check_and_set_private_key
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
import dotenv
|
||||
from nostr_dvm.tasks import texttospeech
|
||||
from nostr_dvm.tasks.texttospeech import TextToSpeech
|
||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||
from nostr_dvm.utils.dvmconfig import build_default_config
|
||||
|
@ -1,10 +1,7 @@
|
||||
import asyncio
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import dotenv
|
||||
from nostr_sdk import Keys
|
||||
|
||||
|
||||
from nostr_dvm.utils.output_utils import upload_media_to_hoster
|
||||
|
||||
@ -18,4 +15,3 @@ if __name__ == '__main__':
|
||||
|
||||
|
||||
asyncio.run(upload_media_to_hoster("tests/output.wav", "key", True))
|
||||
# asyncio.run(upload_media_to_hoster("tests/test.jpeg", dvm_config))
|
||||
|
@ -13,9 +13,8 @@ from nostr_dvm.utils.definitions import relay_timeout
|
||||
|
||||
warnings.filterwarnings('ignore')
|
||||
|
||||
from nostr_sdk import RelayLimits, PublicKey, Options, Client, SecretKey, Keys, NostrSigner, RelayOptions, Filter, \
|
||||
PublicKey, Kind, \
|
||||
NegentropyOptions, NegentropyDirection, ClientBuilder, NostrDatabase, init_logger, LogLevel
|
||||
from nostr_sdk import Options, Keys, NostrSigner, Filter, PublicKey, Kind, \
|
||||
NegentropyOptions, NegentropyDirection, ClientBuilder, NostrDatabase
|
||||
|
||||
|
||||
# init_logger(LogLevel.INFO)
|
||||
|
Loading…
x
Reference in New Issue
Block a user