mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-01-29 18:29:44 +08:00
该类的实例对象用于存储工作空间的配置信息,如工作空间的路径等
工作空间的配置信息存储在用户的家目录下的.config/chatchat/workspace/workspace_config.json文件中。
注意:不存在则读取默认
48 lines
1.1 KiB
Python
48 lines
1.1 KiB
Python
from chatchat.configs import config_workspace as workspace
|
|
|
|
|
|
def main():
|
|
import argparse
|
|
|
|
parser = argparse.ArgumentParser(description="chatchat工作空间配置")
|
|
# 只能选择true或false
|
|
parser.add_argument(
|
|
"-v",
|
|
"--verbose",
|
|
choices=["true", "false"],
|
|
help="是否开启详细日志"
|
|
)
|
|
parser.add_argument(
|
|
"-d",
|
|
"--data",
|
|
help="数据存放路径"
|
|
)
|
|
parser.add_argument(
|
|
"-f",
|
|
"--format",
|
|
help="日志格式"
|
|
)
|
|
parser.add_argument(
|
|
"--clear",
|
|
action="store_true",
|
|
help="清除配置"
|
|
)
|
|
args = parser.parse_args()
|
|
|
|
if args.verbose:
|
|
if args.verbose.lower() == "true":
|
|
workspace.set_log_verbose(True)
|
|
else:
|
|
workspace.set_log_verbose(False)
|
|
if args.data:
|
|
workspace.set_data_path(args.data)
|
|
if args.format:
|
|
workspace.set_log_format(args.format)
|
|
if args.clear:
|
|
workspace.clear()
|
|
print(workspace.get_config())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|