mirror of https://github.com/Mai-with-u/MaiBot.git
先开个配置项
parent
256bfcf5c2
commit
a6469f6cc7
|
|
@ -0,0 +1,23 @@
|
||||||
|
class ResponseAction:
|
||||||
|
def __init__(self):
|
||||||
|
self.tags = []
|
||||||
|
|
||||||
|
def parse_action(self, msg: str, action: str) -> str:
|
||||||
|
if action in msg:
|
||||||
|
self.tags.append(action)
|
||||||
|
return msg.replace(action, '')
|
||||||
|
return msg
|
||||||
|
|
||||||
|
def empty(self):
|
||||||
|
return len(self.tags) == 0
|
||||||
|
|
||||||
|
def __contains__(self, other: str):
|
||||||
|
if isinstance(other, str):
|
||||||
|
return other in self.tags
|
||||||
|
else:
|
||||||
|
# 非str输入直接抛异常
|
||||||
|
raise TypeError
|
||||||
|
|
||||||
|
def __bool__(self):
|
||||||
|
# 这是为了直接嵌入到llm_generator.py的处理流里 便于跳过消息处理流程
|
||||||
|
return False
|
||||||
|
|
@ -115,7 +115,7 @@ class BotConfig:
|
||||||
# experimental
|
# experimental
|
||||||
enable_friend_chat: bool = False # 是否启用好友聊天
|
enable_friend_chat: bool = False # 是否启用好友聊天
|
||||||
enable_think_flow: bool = False # 是否启用思考流程
|
enable_think_flow: bool = False # 是否启用思考流程
|
||||||
|
enable_think_flow: bool = False # 是否允许执行动作
|
||||||
|
|
||||||
|
|
||||||
# 模型配置
|
# 模型配置
|
||||||
|
|
@ -421,6 +421,7 @@ class BotConfig:
|
||||||
experimental_config = parent["experimental"]
|
experimental_config = parent["experimental"]
|
||||||
config.enable_friend_chat = experimental_config.get("enable_friend_chat", config.enable_friend_chat)
|
config.enable_friend_chat = experimental_config.get("enable_friend_chat", config.enable_friend_chat)
|
||||||
config.enable_think_flow = experimental_config.get("enable_think_flow", config.enable_think_flow)
|
config.enable_think_flow = experimental_config.get("enable_think_flow", config.enable_think_flow)
|
||||||
|
config.enable_action_execute = experimental_config.get("enable_action_execute", config.enable_action_execute)
|
||||||
|
|
||||||
# 版本表达式:>=1.0.0,<2.0.0
|
# 版本表达式:>=1.0.0,<2.0.0
|
||||||
# 允许字段:func: method, support: str, notice: str, necessary: bool
|
# 允许字段:func: method, support: str, notice: str, necessary: bool
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue