2024-04-08 18:51:46 +08:00
|
|
|
from core.app.apps.agent_chat.app_config_manager import AgentChatAppConfigManager
|
|
|
|
from core.app.apps.chat.app_config_manager import ChatAppConfigManager
|
|
|
|
from core.app.apps.completion.app_config_manager import CompletionAppConfigManager
|
|
|
|
from models.model import AppMode
|
2023-07-27 13:08:57 +08:00
|
|
|
|
|
|
|
|
2023-05-15 08:51:32 +08:00
|
|
|
class AppModelConfigService:
|
|
|
|
|
2023-11-06 19:36:16 +08:00
|
|
|
@classmethod
|
2024-04-08 18:51:46 +08:00
|
|
|
def validate_configuration(cls, tenant_id: str, config: dict, app_mode: AppMode) -> dict:
|
|
|
|
if app_mode == AppMode.CHAT:
|
|
|
|
return ChatAppConfigManager.config_validate(tenant_id, config)
|
|
|
|
elif app_mode == AppMode.AGENT_CHAT:
|
|
|
|
return AgentChatAppConfigManager.config_validate(tenant_id, config)
|
|
|
|
elif app_mode == AppMode.COMPLETION:
|
|
|
|
return CompletionAppConfigManager.config_validate(tenant_id, config)
|
2024-01-02 23:42:00 +08:00
|
|
|
else:
|
2024-04-08 18:51:46 +08:00
|
|
|
raise ValueError(f"Invalid app mode: {app_mode}")
|