mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-03-23 02:35:52 +08:00
修复了一些配置重载的bug
This commit is contained in:
parent
53380d76c2
commit
c79316c7c8
@ -513,10 +513,9 @@ def get_prompt_template(type: str, name: str) -> Optional[str]:
|
|||||||
type: "llm_chat","knowledge_base_chat","search_engine_chat"的其中一种,如果有新功能,应该进行加入。
|
type: "llm_chat","knowledge_base_chat","search_engine_chat"的其中一种,如果有新功能,应该进行加入。
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from chatchat.configs import prompt_config
|
from chatchat.configs import PROMPT_TEMPLATES
|
||||||
import importlib
|
|
||||||
importlib.reload(prompt_config) # TODO: 检查configs/prompt_config.py文件有修改再重新加载
|
return PROMPT_TEMPLATES.get(type, {}).get(name)
|
||||||
return prompt_config.PROMPT_TEMPLATES.get(type, {}).get(name)
|
|
||||||
|
|
||||||
|
|
||||||
def set_httpx_config(
|
def set_httpx_config(
|
||||||
@ -704,18 +703,20 @@ def get_tool(name: str = None) -> Union[BaseTool, Dict[str, BaseTool]]:
|
|||||||
from chatchat.server.agent import tools_factory
|
from chatchat.server.agent import tools_factory
|
||||||
importlib.reload(tools_factory)
|
importlib.reload(tools_factory)
|
||||||
|
|
||||||
|
from chatchat.server.agent.tools_factory import tools_registry
|
||||||
if name is None:
|
if name is None:
|
||||||
return tools_factory.tools_registry._TOOLS_REGISTRY
|
return tools_registry._TOOLS_REGISTRY
|
||||||
else:
|
else:
|
||||||
return tools_factory.tools_registry._TOOLS_REGISTRY.get(name)
|
return tools_registry._TOOLS_REGISTRY.get(name)
|
||||||
|
|
||||||
|
|
||||||
def get_tool_config(name: str = None) -> Dict:
|
def get_tool_config(name: str = None) -> Dict:
|
||||||
import importlib
|
import importlib
|
||||||
from chatchat.configs import model_config
|
# TODO 因为使用了变量更新,不支持重载
|
||||||
importlib.reload(model_config)
|
# from chatchat.configs import model_config
|
||||||
|
# importlib.reload(model_config)
|
||||||
|
from chatchat.configs import TOOL_CONFIG
|
||||||
if name is None:
|
if name is None:
|
||||||
return model_config.TOOL_CONFIG
|
return TOOL_CONFIG
|
||||||
else:
|
else:
|
||||||
return model_config.TOOL_CONFIG.get(name, {})
|
return TOOL_CONFIG.get(name, {})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user