mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-02-28 08:41:21 +08:00
feat: move loading config method to base class
This commit is contained in:
@@ -10,7 +10,6 @@ from bridge.bridge import Bridge
|
||||
from bridge.context import ContextType
|
||||
from bridge.reply import Reply, ReplyType
|
||||
from common import const
|
||||
from common.log import logger
|
||||
from config import conf
|
||||
from plugins import *
|
||||
|
||||
@@ -119,16 +118,8 @@ class Tool(Plugin):
|
||||
return
|
||||
|
||||
def _read_json(self) -> dict:
|
||||
curdir = os.path.dirname(__file__)
|
||||
config_path = os.path.join(curdir, "config.json")
|
||||
tool_config = super().load_config()
|
||||
if not tool_config:
|
||||
if not os.path.exists(config_path):
|
||||
return {"tools": [], "kwargs": {}}
|
||||
else:
|
||||
with open(config_path, "r") as f:
|
||||
tool_config = json.load(f)
|
||||
return tool_config
|
||||
default_config = {"tools": [], "kwargs": {}}
|
||||
return super().load_config() or default_config
|
||||
|
||||
def _build_tool_kwargs(self, kwargs: dict):
|
||||
tool_model_name = kwargs.get("model_name")
|
||||
|
||||
Reference in New Issue
Block a user