From fb4b742628e2725d9850083ad4608b9b0ed18c8f Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Fri, 14 Jun 2024 19:42:48 +0200 Subject: [PATCH] fixes --- nostr_dvm/bot.py | 8 ++++---- nostr_dvm/interfaces/dvmtaskinterface.py | 4 ++-- nostr_dvm/tasks/imagegeneration_openai_dalle.py | 4 +--- setup.py | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/nostr_dvm/bot.py b/nostr_dvm/bot.py index 1dda177..37a03f5 100644 --- a/nostr_dvm/bot.py +++ b/nostr_dvm/bot.py @@ -51,9 +51,9 @@ class Bot: self.job_list = [] - print("Nostr BOT public key: " + str(pk.to_bech32()) + " Hex: " + str(pk.to_hex()) + " Name: " + self.NAME + - " Supported DVM tasks: " + - ', '.join(p.NAME + ":" + p.TASK for p in self.dvm_config.SUPPORTED_DVMS) + "\n") + print("Nostr BOT public key: " + str(pk.to_bech32()) + " Hex: " + str(pk.to_hex()) + " Name: " + self.NAME) # + + #" Supported DVM tasks: " + + #', '.join(p.NAME + ":" + p.TASK for p in self.dvm_config.SUPPORTED_DVMS) + "\n") for relay in self.dvm_config.RELAY_LIST: await self.client.add_relay(relay) @@ -69,7 +69,7 @@ class Bot: kinds.append(Kind(dvm.KIND.as_u64() + 1000)) dvm_filter = (Filter().kinds(kinds).since(Timestamp.now())) - self.client.subscribe([zap_filter, dm_filter, nip59_filter, dvm_filter], None) + await self.client.subscribe([zap_filter, dm_filter, nip59_filter, dvm_filter], None) create_sql_table(self.dvm_config.DB) await admin_make_database_updates(adminconfig=self.admin_config, dvmconfig=self.dvm_config, client=self.client) diff --git a/nostr_dvm/interfaces/dvmtaskinterface.py b/nostr_dvm/interfaces/dvmtaskinterface.py index 011427f..007a35b 100644 --- a/nostr_dvm/interfaces/dvmtaskinterface.py +++ b/nostr_dvm/interfaces/dvmtaskinterface.py @@ -163,12 +163,12 @@ class DVMTaskInterface: # f.close() -def process_venv(identifier): +async def process_venv(identifier): args = DVMTaskInterface.process_args() dvm_config = build_default_config(args.identifier) dvm = identifier(name="", dvm_config=dvm_config, nip89config=NIP89Config(), admin_config=None) try: - result = dvm.process(json.loads(args.request)) + result = asyncio.run(dvm.process(json.loads(args.request))) DVMTaskInterface.write_output(result, args.output) except Exception as e: DVMTaskInterface.write_output("Error: " + str(e), args.output) diff --git a/nostr_dvm/tasks/imagegeneration_openai_dalle.py b/nostr_dvm/tasks/imagegeneration_openai_dalle.py index da09184..5323d3b 100644 --- a/nostr_dvm/tasks/imagegeneration_openai_dalle.py +++ b/nostr_dvm/tasks/imagegeneration_openai_dalle.py @@ -24,12 +24,10 @@ Outputs: An url to an Image class ImageGenerationDALLE(DVMTaskInterface): - KIND: EventDefinitions.KIND_NIP90_GENERATE_IMAGE + KIND = EventDefinitions.KIND_NIP90_GENERATE_IMAGE TASK: str = "text-to-image" FIX_COST: float = 120 dependencies = [("nostr-dvm", "nostr-dvm"), - ("requests", "requests"), - ("pillow", "pillow"), ("openai", "openai==1.3.5")] async def init_dvm(self, name, dvm_config: DVMConfig, nip89config: NIP89Config, nip88config: NIP88Config = None, diff --git a/setup.py b/setup.py index 1674e34..7f47300 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -VERSION = '0.6.9' +VERSION = '0.6.10' DESCRIPTION = 'A framework to build and run Nostr NIP90 Data Vending Machines' LONG_DESCRIPTION = ('A framework to build and run Nostr NIP90 Data Vending Machines. See the github repository for more information')