From db93ccafb9d422d7122e10c2cfe4112d9003849c Mon Sep 17 00:00:00 2001 From: congxi Date: Thu, 11 Apr 2024 09:28:35 +0800 Subject: [PATCH] [feature] The model list interface supports returning yaml configuration **Phenomenon and reproduction steps** **Root cause and solution** **Impactions** **Test method** **Affected branch(es)** * main **Checklist** - [ ] Dependencies update required - [ ] Common bug (similar problem in other repo) --- .../llm_agent_app/llm_agent_config.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/df-llm-agent/llm_agent_app/llm_agent_config.py b/df-llm-agent/llm_agent_app/llm_agent_config.py index 07f4819..9e5f8af 100644 --- a/df-llm-agent/llm_agent_app/llm_agent_config.py +++ b/df-llm-agent/llm_agent_app/llm_agent_config.py @@ -4,6 +4,8 @@ from database import db_models from utils import logger +from config import config + log = logger.getLogger(__name__) @@ -66,6 +68,24 @@ async def llm_agent_config_list(cls, user_info, platform=""): if platform: data_info["platform"] = platform + if hasattr(config, "platforms"): + res_config = config.platforms + res = {} + for _info in res_config: + __info = {} + _platform = _info.get('platform', '') + + if platform and platform != _platform: + continue + _enable = _info.get('enable', False) + __info['enable'] = "1" if _enable else "0" + __info['model'] = _info.get('model', '') + __info['engine_name'] = _info.get('engine_name', []) + + res[f"{_platform}"] = __info + + return res + try: if data_info: sql_res = await db_models.LlmConfig.filter(**data_info).all()