mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-05-21 23:24:44 +02:00
Deprecate Config.get_system_prompt() and fix callback type annotation
- 7a: Config.get_system_prompt() now logs a deprecation warning. PersonalityManager.get_system_prompt() is the canonical source (wired in commit 4). LLMConfig.system_prompt kept for backwards compat as fallback when personality is not configured. - 7b: Fix AnnouncementScheduler callback type from asyncio.coroutine (a decorator, not a type) to Awaitable[None] from typing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ab7e52b9fb
commit
2a857bcb70
2 changed files with 14 additions and 3 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import random
|
import random
|
||||||
from typing import Callable, Optional
|
from typing import Awaitable, Callable, Optional
|
||||||
|
|
||||||
from .config import AnnouncementsConfig
|
from .config import AnnouncementsConfig
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@ class AnnouncementScheduler:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
config: AnnouncementsConfig,
|
config: AnnouncementsConfig,
|
||||||
send_callback: Callable[[str, int], asyncio.coroutine],
|
send_callback: Callable[[str, int], Awaitable[None]],
|
||||||
):
|
):
|
||||||
"""Initialize the announcement scheduler.
|
"""Initialize the announcement scheduler.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
"""Configuration management for MeshAI."""
|
"""Configuration management for MeshAI."""
|
||||||
|
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
@ -7,6 +8,8 @@ from typing import Optional
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
_config_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class BotConfig:
|
class BotConfig:
|
||||||
|
|
@ -284,7 +287,15 @@ class Config:
|
||||||
_config_path: Optional[Path] = field(default=None, repr=False)
|
_config_path: Optional[Path] = field(default=None, repr=False)
|
||||||
|
|
||||||
def get_system_prompt(self) -> str:
|
def get_system_prompt(self) -> str:
|
||||||
"""Get effective system prompt, preferring personality config."""
|
"""Get effective system prompt, preferring personality config.
|
||||||
|
|
||||||
|
Deprecated: Use PersonalityManager.get_system_prompt() instead.
|
||||||
|
Kept for backwards compatibility.
|
||||||
|
"""
|
||||||
|
_config_logger.warning(
|
||||||
|
"Config.get_system_prompt() is deprecated. "
|
||||||
|
"Use PersonalityManager.get_system_prompt() instead."
|
||||||
|
)
|
||||||
if self.personality.system_prompt:
|
if self.personality.system_prompt:
|
||||||
return self.personality.system_prompt
|
return self.personality.system_prompt
|
||||||
return self.llm.system_prompt
|
return self.llm.system_prompt
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue