feat(core): Support multi round conversation operator (#986)

This commit is contained in:
Fangyin Cheng
2023-12-27 23:26:28 +08:00
committed by GitHub
parent 9aec636b02
commit b13d3f6d92
63 changed files with 2011 additions and 314 deletions

View File

@@ -1,3 +1,4 @@
import os
from functools import cache
from typing import Any, Dict, Optional
@@ -33,3 +34,19 @@ class AppConfig:
prefix (str): The prefix of config
"""
return {k: v for k, v in self.configs.items() if k.startswith(prefix)}
def get_current_lang(self, default: Optional[str] = None) -> str:
"""Get current language
Args:
default (Optional[str], optional): The default language if not found. Defaults to None.
Returns:
str: The language of user running environment
"""
env_lang = (
"zh"
if os.getenv("LANG") and os.getenv("LANG").startswith("zh")
else default
)
return self.get("dbgpt.app.global.language", env_lang)