mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-03-17 13:21:48 +01:00
fixes
This commit is contained in:
parent
b5da913caf
commit
7783abaa12
@ -31,7 +31,7 @@ class DVMTaskInterface:
|
||||
admin_config: AdminConfig
|
||||
dependencies = []
|
||||
|
||||
def __init__(self, name, dvm_config: DVMConfig, nip89config: NIP89Config, nip88config: NIP88Config,
|
||||
def __init__(self, name, dvm_config: DVMConfig, nip89config: NIP89Config, nip88config: NIP88Config = None,
|
||||
admin_config: AdminConfig = None,
|
||||
options=None, task=None):
|
||||
self.init(name, dvm_config, admin_config, nip88config, nip89config, task)
|
||||
@ -59,7 +59,7 @@ class DVMTaskInterface:
|
||||
dvm_config.NIP89 = self.NIP89_announcement(nip89config)
|
||||
|
||||
if nip88config is None:
|
||||
dvm_config.NIP88 = NIP88Config()
|
||||
dvm_config.NIP88 = None
|
||||
else:
|
||||
dvm_config.NIP88 = nip88config
|
||||
|
||||
|
@ -165,7 +165,7 @@ def build_example(name, identifier, admin_config):
|
||||
# Add NIP89
|
||||
nip89info = {
|
||||
"name": name,
|
||||
"image": "https://image.nostr.build/a99ab925084029d9468fef8330ff3d9be2cf67da473b024f2a6d48b5cd77197f.jpg",
|
||||
"image": "https://nostr.band/android-chrome-192x192.png",
|
||||
"about": "I search notes on Nostr.band.",
|
||||
"encryptionSupported": True,
|
||||
"cashuAccepted": True,
|
||||
|
@ -97,6 +97,7 @@ class DicoverContentCurrentlyPopular(DVMTaskInterface):
|
||||
# Query events from database
|
||||
timestamp_hour_ago = Timestamp.now().as_secs() - 3600
|
||||
lasthour = Timestamp.from_secs(timestamp_hour_ago)
|
||||
|
||||
filter1 = Filter().kind(definitions.EventDefinitions.KIND_NOTE).since(lasthour)
|
||||
events = cli.database().query([filter1])
|
||||
ns.finallist = {}
|
||||
|
@ -78,8 +78,9 @@ class TrendingNotesNostrBand(DVMTaskInterface):
|
||||
|
||||
return json.dumps(result_list)
|
||||
|
||||
except:
|
||||
return "error"
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return json.dumps([])
|
||||
|
||||
def post_process(self, result, event):
|
||||
"""Overwrite the interface function to return a social client readable format, if requested"""
|
||||
@ -104,7 +105,7 @@ def build_example(name, identifier, admin_config):
|
||||
|
||||
nip89info = {
|
||||
"name": name,
|
||||
"image": "https://image.nostr.build/4dc758923c7bfc5ba92030e6419272ec7470c3809d36e88e99f3a9daece88bac.png",
|
||||
"image": "https://nostr.band/android-chrome-192x192.png",
|
||||
"about": "I show trending notes from nostr.band",
|
||||
"amount": "Free",
|
||||
"encryptionSupported": True,
|
||||
|
@ -25,7 +25,7 @@ class ImageInterrogator(DVMTaskInterface):
|
||||
TASK: str = "image-to-text"
|
||||
FIX_COST: float = 80
|
||||
|
||||
def __init__(self, name, dvm_config: DVMConfig, nip89config: NIP89Config, nip88config: NIP88Config,
|
||||
def __init__(self, name, dvm_config: DVMConfig, nip89config: NIP89Config, nip88config: NIP88Config = None,
|
||||
admin_config: AdminConfig = None, options=None):
|
||||
super().__init__(name=name, dvm_config=dvm_config, nip89config=nip89config, nip88config=nip88config,
|
||||
admin_config=admin_config, options=options)
|
||||
|
@ -95,7 +95,7 @@ class SearchUser(DVMTaskInterface):
|
||||
|
||||
# Query events from database
|
||||
|
||||
filter1 = Filter().kind(0)
|
||||
filter1 = Filter().kind(Kind(0))
|
||||
events = cli.database().query([filter1])
|
||||
# for event in events:
|
||||
# print(event.as_json())
|
||||
|
@ -109,7 +109,7 @@ class SummarizationUnleashedChat(DVMTaskInterface):
|
||||
for model in client.models.list():
|
||||
print('- ' + model.id)
|
||||
|
||||
content = "Summarize the following notes: " + str(options["prompt"])[:4000]
|
||||
content = "Summarize the following notes: " + str(options["prompt"])[:3500]
|
||||
normal_stream = client.chat.completions.create(
|
||||
messages=[
|
||||
{
|
||||
|
@ -114,7 +114,11 @@ def get_from_sql_table(db, npub):
|
||||
user.lud16 = row[5]
|
||||
user.name = row[6]
|
||||
user.lastactive = row[7]
|
||||
user.subscribed = row[8]
|
||||
try:
|
||||
user.subscribed = row[8]
|
||||
except:
|
||||
user.subscribed = False
|
||||
|
||||
|
||||
return user
|
||||
|
||||
|
2
setup.py
2
setup.py
@ -15,7 +15,7 @@ setup(
|
||||
long_description=LONG_DESCRIPTION,
|
||||
packages=find_packages(include=['nostr_dvm', 'nostr_dvm.*']),
|
||||
|
||||
install_requires=["nostr-sdk==0.10.0",
|
||||
install_requires=["nostr-sdk=>0.10.0",
|
||||
"bech32",
|
||||
"pycryptodome==3.20.0",
|
||||
"python-dotenv==1.0.0",
|
||||
|
@ -1,4 +1,5 @@
|
||||
import os
|
||||
import threading
|
||||
from pathlib import Path
|
||||
|
||||
import dotenv
|
||||
@ -37,9 +38,10 @@ def playground():
|
||||
subscription_config.LNBITS_INVOICE_KEY = invoice_key
|
||||
subscription_config.LNBITS_ADMIN_KEY = admin_key # The dvm might pay failed jobs back
|
||||
subscription_config.LNBITS_URL = os.getenv("LNBITS_HOST")
|
||||
Subscription(subscription_config)
|
||||
x = threading.Thread(target=Subscription, args=(Subscription(subscription_config),))
|
||||
x.start()
|
||||
|
||||
keep_alive()
|
||||
#keep_alive()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
x
Reference in New Issue
Block a user