This commit is contained in:
Believethehype
2024-06-14 19:42:48 +02:00
parent 738768749a
commit fb4b742628
4 changed files with 8 additions and 10 deletions

View File

@@ -51,9 +51,9 @@ class Bot:
self.job_list = [] self.job_list = []
print("Nostr BOT public key: " + str(pk.to_bech32()) + " Hex: " + str(pk.to_hex()) + " Name: " + self.NAME + print("Nostr BOT public key: " + str(pk.to_bech32()) + " Hex: " + str(pk.to_hex()) + " Name: " + self.NAME) # +
" Supported DVM tasks: " + #" Supported DVM tasks: " +
', '.join(p.NAME + ":" + p.TASK for p in self.dvm_config.SUPPORTED_DVMS) + "\n") #', '.join(p.NAME + ":" + p.TASK for p in self.dvm_config.SUPPORTED_DVMS) + "\n")
for relay in self.dvm_config.RELAY_LIST: for relay in self.dvm_config.RELAY_LIST:
await self.client.add_relay(relay) await self.client.add_relay(relay)
@@ -69,7 +69,7 @@ class Bot:
kinds.append(Kind(dvm.KIND.as_u64() + 1000)) kinds.append(Kind(dvm.KIND.as_u64() + 1000))
dvm_filter = (Filter().kinds(kinds).since(Timestamp.now())) 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) create_sql_table(self.dvm_config.DB)
await admin_make_database_updates(adminconfig=self.admin_config, dvmconfig=self.dvm_config, client=self.client) await admin_make_database_updates(adminconfig=self.admin_config, dvmconfig=self.dvm_config, client=self.client)

View File

@@ -163,12 +163,12 @@ class DVMTaskInterface:
# f.close() # f.close()
def process_venv(identifier): async def process_venv(identifier):
args = DVMTaskInterface.process_args() args = DVMTaskInterface.process_args()
dvm_config = build_default_config(args.identifier) dvm_config = build_default_config(args.identifier)
dvm = identifier(name="", dvm_config=dvm_config, nip89config=NIP89Config(), admin_config=None) dvm = identifier(name="", dvm_config=dvm_config, nip89config=NIP89Config(), admin_config=None)
try: try:
result = dvm.process(json.loads(args.request)) result = asyncio.run(dvm.process(json.loads(args.request)))
DVMTaskInterface.write_output(result, args.output) DVMTaskInterface.write_output(result, args.output)
except Exception as e: except Exception as e:
DVMTaskInterface.write_output("Error: " + str(e), args.output) DVMTaskInterface.write_output("Error: " + str(e), args.output)

View File

@@ -24,12 +24,10 @@ Outputs: An url to an Image
class ImageGenerationDALLE(DVMTaskInterface): class ImageGenerationDALLE(DVMTaskInterface):
KIND: EventDefinitions.KIND_NIP90_GENERATE_IMAGE KIND = EventDefinitions.KIND_NIP90_GENERATE_IMAGE
TASK: str = "text-to-image" TASK: str = "text-to-image"
FIX_COST: float = 120 FIX_COST: float = 120
dependencies = [("nostr-dvm", "nostr-dvm"), dependencies = [("nostr-dvm", "nostr-dvm"),
("requests", "requests"),
("pillow", "pillow"),
("openai", "openai==1.3.5")] ("openai", "openai==1.3.5")]
async def init_dvm(self, name, dvm_config: DVMConfig, nip89config: NIP89Config, nip88config: NIP88Config = None, async def init_dvm(self, name, dvm_config: DVMConfig, nip89config: NIP89Config, nip88config: NIP88Config = None,

View File

@@ -1,6 +1,6 @@
from setuptools import setup, find_packages 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' 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') LONG_DESCRIPTION = ('A framework to build and run Nostr NIP90 Data Vending Machines. See the github repository for more information')