f2306a3d11
Lint and Test / lint_test (3.11) (push) Has been cancelled
Lint and Test / lint_test (3.10) (push) Has been cancelled
Lint and Test / lint_test (3.12) (push) Has been cancelled
Publish to PyPI and release / Build distribution (push) Has been cancelled
Codespell / Check for spelling errors (push) Has been cancelled
Publish to PyPI and release / Publish to PyPI (push) Has been cancelled
Publish to PyPI and release / Make release (push) Has been cancelled
23 lines
641 B
Python
23 lines
641 B
Python
from pathlib import Path
|
|
from typing import Dict, List
|
|
|
|
from ..config import cfg
|
|
from ..role import SystemRole
|
|
from .handler import Handler
|
|
|
|
CHAT_CACHE_LENGTH = int(cfg.get("CHAT_CACHE_LENGTH"))
|
|
CHAT_CACHE_PATH = Path(cfg.get("CHAT_CACHE_PATH"))
|
|
|
|
|
|
class DefaultHandler(Handler):
|
|
def __init__(self, role: SystemRole, markdown: bool) -> None:
|
|
super().__init__(role, markdown)
|
|
self.role = role
|
|
|
|
def make_messages(self, prompt: str) -> List[Dict[str, str]]:
|
|
messages = [
|
|
{"role": "system", "content": self.role.role},
|
|
{"role": "user", "content": prompt},
|
|
]
|
|
return messages
|