From 817170670b5a59d29df85fb89b85e2ef9c04084e Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Thu, 16 May 2024 12:45:27 +0200 Subject: [PATCH] allow randomness for customized processing messages --- nostr_dvm/utils/output_utils.py | 10 ++++++++-- setup.py | 2 +- tests/discovery.py | 10 +++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/nostr_dvm/utils/output_utils.py b/nostr_dvm/utils/output_utils.py index 67f52b2..86530f5 100644 --- a/nostr_dvm/utils/output_utils.py +++ b/nostr_dvm/utils/output_utils.py @@ -1,6 +1,7 @@ import json import datetime as datetime import os +import random from types import NoneType import emoji @@ -186,9 +187,14 @@ def build_status_reaction(status, task, amount, content, dvm_config): alt_description = "This is a reaction to a NIP90 DVM AI task. " if status == "processing": - if content is not None and content != "": - alt_description = content + if content is not None: + if isinstance(content, list) or isinstance(content, dict): + message = random.choice(content) + else: + message = content + alt_description = message reaction = alt_description + else: alt_description = "NIP90 DVM task " + task + " started processing. " reaction = alt_description + emoji.emojize(":thumbs_up:") diff --git a/setup.py b/setup.py index d6be0bd..2c18c71 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -VERSION = '0.3.9' +VERSION = '0.4.0' 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') diff --git a/tests/discovery.py b/tests/discovery.py index 1ebfa50..8f334af 100644 --- a/tests/discovery.py +++ b/tests/discovery.py @@ -34,7 +34,7 @@ def playground(): "search_list": ["garden", "gardening", "nature", " plants ", " plant ", " herb ", " herbs " " pine ", "homesteading", "rosemary", "chicken", "🪻", "🌿", "☘️", "🌲", "flower", "forest", "watering", "permies", "planting", "farm", "vegetable", "fruit", " grass ", "sunshine", - "#flowerstr", "#bloomscrolling", "#treestr", "#plantstr"], + "#flowerstr", "#bloomscrolling", "#treestr", "#plantstr", "touchgrass",], "avoid_list": ["porn", "smoke", "nsfw", "bitcoin", "bolt12", "bolt11", "github", "currency", "utxo", "encryption", "government", "airpod", "ipad", "iphone", "android", "warren", "moderna", "pfizer", @@ -51,7 +51,7 @@ def playground(): image = "https://image.nostr.build/a816f3f5e98e91e8a47d50f4cd7a2c17545f556d9bb0a6086a659b9abdf7ab68.jpg" description = "I show recent notes about plants and gardening" - custom_processing_msg = "Finding the best notes for you. #blooming" + custom_processing_msg = ["Finding the best notes for you.. #blooming", "Looking for some positivity.. #touchgrass", "Looking for #goodvibes.."] discovery_test_sub = content_discovery_currently_popular_topic.build_example("Garden & Growth", "discovery_content_garden", admin_config_plants, options_plants, image, @@ -85,7 +85,7 @@ def playground(): image = "https://image.nostr.build/f609311532c470f663e129510a76c9a1912ae9bc4aaaf058e5ba21cfb512c88e.jpg" description = "I show recent notes about animals" - custom_processing_msg = "Looking for fluffy frens..." + custom_processing_msg = ["Looking for fluffy frens...", "Let's see if we find some animals for you..", "Looking for the goodest bois and girls.."] discovery_animals = content_discovery_currently_popular_topic.build_example("Fluffy Frens", "discovery_content_fluffy", @@ -97,7 +97,7 @@ def playground(): admin_config_followers = AdminConfig() admin_config_followers.REBROADCAST_NIP89 = False admin_config_followers.UPDATE_PROFILE = False - custom_processing_msg = "Looking for popular notes from your followers.." + custom_processing_msg = ["Looking for popular notes from npubs you follow..", "Let's see what npubs you follow have been up to..", "Processing a personalized feed, just for you.."] discovery_followers = content_discovery_currently_popular_followers.build_example("Currently Popular Notes from npubs you follow", "discovery_content_followers", @@ -109,7 +109,7 @@ def playground(): admin_config_global_popular = AdminConfig() admin_config_global_popular.REBROADCAST_NIP89 = False admin_config_global_popular.UPDATE_PROFILE = False - custom_processing_msg = "Looking for popular notes on the Nostr.." + custom_processing_msg = ["Looking for popular notes on the Nostr..", "Let's see what's trending on Nostr..", "Finding the best notes for you.."] discovery_global = content_discovery_currently_popular.build_example("Currently Popular Notes DVM",