diff --git a/config/config.json b/config/config.json index 794011a..9942574 100644 --- a/config/config.json +++ b/config/config.json @@ -4,8 +4,8 @@ "silent_start": "20:00", "silent_end": "07:00", "timezone": "Asia/Shanghai", - "min_interval": 3, - "max_interval": 10, + "min_interval": 1, + "max_interval": 3, "bark_api_url": "https://bark.xorbitlab.xyz", "bark_device_key": "GmFrzGegxFexhNXXXYdzm3", "ntfy_api_url": "https://ntfy.xorbitlab.xyz", diff --git a/quick_test.py b/quick_test.py index dd5b0bb..6c7fe5f 100755 --- a/quick_test.py +++ b/quick_test.py @@ -15,8 +15,11 @@ async def test_full_pipeline(): # Test template system template_manager = TemplateManager() - prompt = template_manager.get_random_prompt() + template_data = template_manager.get_random_prompt() + prompt = template_data["prompt"] + title = template_data["title"] print(f"📋 Selected template: {prompt}") + print(f"📋 Notification title: {title}") # Test Ollama response async with OllamaClient(config) as ollama_client: @@ -27,7 +30,7 @@ async def test_full_pipeline(): # Test notification (will skip if no device key/topic) async with NotificationClient(config) as notification_client: - success = await notification_client.send_notification(response) + success = await notification_client.send_notification(response, title=title) if success: print("✅ Notification pipeline working!") else: diff --git a/scheduler.py b/scheduler.py index ad51e23..be552a3 100644 --- a/scheduler.py +++ b/scheduler.py @@ -77,8 +77,11 @@ class NotificationScheduler: return False # Get random prompt - prompt = self.template_manager.get_random_prompt() + template_data = self.template_manager.get_random_prompt() + prompt = template_data["prompt"] + title = template_data["title"] logger.info(f"Using prompt: {prompt}") + logger.info(f"Notification title: {title}") # Get response from Ollama strip_think_tags = getattr(self.config, 'strip_think_tags', True) @@ -88,7 +91,7 @@ class NotificationScheduler: return False # Send notification - success = await self.notification_client.send_notification(response) + success = await self.notification_client.send_notification(response, title=title) if success: logger.info("Notification sent successfully") else: diff --git a/template_manager.py b/template_manager.py index 7871ee0..801f225 100644 --- a/template_manager.py +++ b/template_manager.py @@ -58,16 +58,19 @@ class TemplateManager: default_templates = [ { "name": "Daily Reflection", + "title": "Daily Reflection", "prompt": "What are your thoughts about {date} at {time}?", "description": "A simple daily reflection prompt" }, { "name": "Mindfulness Check", + "title": "Mindfulness Check", "prompt": "How are you feeling right now on this {day} at {time}?", "description": "A mindfulness check-in prompt" }, { "name": "Gratitude Prompt", + "title": "Gratitude Prompt", "prompt": "What are three things you're grateful for on {date} during this {time_of_day}?", "description": "A gratitude reflection prompt" } @@ -108,20 +111,36 @@ class TemplateManager: return template - def get_random_prompt(self) -> str: - """Get a random prompt template with placeholders filled.""" + def get_random_prompt(self) -> dict: + """Get a random prompt template with placeholders filled. + + Returns: + dict: Contains 'prompt' and 'title' keys with filled placeholders + """ if not self.templates: logger.warning("No templates available") - return "What are your thoughts right now?" + return { + "prompt": "What are your thoughts right now?", + "title": "Random Thought" + } template = random.choice(self.templates) prompt = template.get("prompt", "") - return self._fill_placeholders(prompt) + title = template.get("title", template.get("name", "Notification")) + + return { + "prompt": self._fill_placeholders(prompt), + "title": self._fill_placeholders(title) + } - def add_template(self, name: str, prompt: str, description: str = ""): + def add_template(self, name: str, prompt: str, description: str = "", title: str = None): """Add a new template to the system.""" + if title is None: + title = name + new_template = { "name": name, + "title": title, "prompt": prompt, "description": description } diff --git a/templates/bdsm.json b/templates/bdsm.json index bd6016d..7e3e03b 100644 --- a/templates/bdsm.json +++ b/templates/bdsm.json @@ -1,12 +1,14 @@ [ { "name": "Daily Rule", + "title": "骚逼的每日规矩", "prompt": "你是一个严厉的远程调教者,每天为我制定一条羞耻的日常行为规则,称呼我为‘骚逼’、‘贱货’或‘婊子’,语气威严、高压、不容置疑。规则可适用于任何场景(私密环境如家里可更露骨,公共或其他场景则微妙但不易察觉),但必须对心理产生强烈羞辱感。规则聚焦于一个具体的行为规范(例如特定动作、穿着要求、或隐秘任务,如‘进门必须跪下’或‘在公共场合偷偷调整内衣’)。生成一条每日规则,语言粗俗、口语化,描述生动详细,保持单一焦点,不带任何解释。", "description": "Daily Rule" }, { "name": "Random Domination", + "title": "贱婊子立刻服从命令!", "prompt": "你正在进行一个远程调教场景,定期向我发送羞耻且带有侮辱性的命令。你会用‘骚逼’、‘贱货’、‘婊子’等贬低称呼来称呼我。你的语气必须极具威严,不容置疑,高压强势,绝不询问我的意愿或偏好。当前时间是{time},结合这个时间和典型环境(例如家里,休闲场景),你的指令可以是纯粹的辱骂、要求我汇报状态(例如我穿着什么、在做什么,或其他你能发挥的细节),或命令我执行隐秘但羞耻的任务。现在,给我发送一条消息,语气粗俗但口语化,指令或描述要生动详细,聚焦于一个具体点。", "description": "Random Domination" }