xiaozhi-esp32-server/main/xiaozhi-server/core/providers/intent/base.py
lapy c5ff101e66 feat(xiaozhi-server): western provider set, English defaults, runtime, and plugins
- Defaults and config aligned with English-first product surface

- Adds/removes ASR/TTS paths; drops China-only provider implementations and bundled SenseVoice assets

- Westernizes prompts, plugin/tool copy, connection and handler behavior on upstream fixes

- Powermem max_tokens and OpenAI no-thinking guard preserved on downstream path
2026-04-25 17:05:08 +01:00

33 lines
1.1 KiB
Python

from abc import ABC, abstractmethod
from typing import List, Dict
from config.logger import setup_logging
TAG = __name__
logger = setup_logging()
class IntentProviderBase(ABC):
def __init__(self, config):
self.config = config
def set_llm(self, llm):
self.llm = llm
# Get model name and type information
model_name = getattr(llm, "model_name", str(llm.__class__.__name__))
# Record more detailed logs
logger.bind(tag=TAG).info(f"Intent recognition set LLM: {model_name}")
@abstractmethod
async def detect_intent(self, conn, dialogue_history: List[Dict], text: str) -> str:
"""
Detect intent of user's last sentence
Args:
dialogue_history: Dialogue history list, each record contains role and content
Returns:
Returns identified intent in format:
- "continue chat"
- "end chat"
- "play music song_name" or "play random music"
- "query weather location_name" or "query weather [current location]"
"""
pass