fix web ui demo

Former-commit-id: e566a68a27872f730b111078977048755ec74a40
This commit is contained in:
hiyouga 2023-11-16 18:41:55 +08:00
parent da411066c9
commit caf3cbf8d7

View File

@ -29,14 +29,14 @@ class WebChatModel(ChatModel):
if not lazy_init: # read arguments from command line if not lazy_init: # read arguments from command line
super().__init__() super().__init__()
if demo_mode: # load config.json by default if demo_mode: # load demo_config.json if exists
import json import json
try: try:
with open("demo_config.json", "r", encoding="utf-8") as f: with open("demo_config.json", "r", encoding="utf-8") as f:
args = json.load(f) args = json.load(f)
except:
raise ValueError("Cannot find `demo_config.json` at current directory.")
super().__init__(args) super().__init__(args)
except:
print("Cannot find `demo_config.json` at current directory.")
@property @property
def loaded(self) -> bool: def loaded(self) -> bool: