mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-08-01 03:59:51 +00:00
✨ 支持保存历史对话, 规范代码
This commit is contained in:
@ -1,9 +1,11 @@
|
||||
from .util import *
|
||||
|
||||
|
||||
class MarshoContext:
|
||||
"""
|
||||
Marsho 的上下文类
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.contents = {
|
||||
"private": {},
|
||||
@ -38,10 +40,9 @@ class MarshoContext:
|
||||
|
||||
def build(self, target_id: str, is_private: bool) -> list:
|
||||
"""
|
||||
构建返回的上下文,其中包括系统消息
|
||||
构建返回的上下文,不包括系统消息
|
||||
"""
|
||||
spell = get_prompt()
|
||||
target_dict = self._get_target_dict(is_private)
|
||||
if target_id not in target_dict:
|
||||
target_dict[target_id] = []
|
||||
return [spell] + target_dict[target_id]
|
||||
return target_dict[target_id]
|
||||
|
Reference in New Issue
Block a user