lang detect

This commit is contained in:
2026-05-20 17:15:31 +03:00
parent c617754cca
commit 084f782065
28 changed files with 1103 additions and 530 deletions

View File

@@ -19,7 +19,6 @@ from src.core.logger import belief_scope, logger
from src.core.task_manager import TaskManager
from src.schemas.auth import User
from src.services.git_service import GitService
from src.services.llm_prompt_templates import is_multimodal_model
from src.services.llm_provider import LLMProviderService
from ._dataset_review_dispatch import _dispatch_dataset_review_intent
@@ -281,8 +280,7 @@ async def _dispatch_intent(intent: dict[str, Any], current_user: User, task_mana
if not dashboard_id or not env_id or (not provider_id):
raise HTTPException(status_code=422, detail='Missing dashboard_id/environment/provider. Укажите ID/slug дашборда или окружение.')
provider = LLMProviderService(db).get_provider(provider_id)
provider_model = provider.default_model if provider else ''
if not is_multimodal_model(provider_model, provider.provider_type if provider else None):
if not provider or not bool(provider.is_multimodal):
raise HTTPException(status_code=422, detail='Selected provider model is not multimodal for dashboard validation. Выберите мультимодальную модель (например, gpt-4o).')
task = await task_manager.create_task(plugin_id='llm_dashboard_validation', params={'dashboard_id': str(dashboard_id), 'environment_id': env_id, 'provider_id': provider_id}, user_id=current_user.id)
logger.reflect('Belief protocol postcondition checkpoint for _dispatch_intent')

View File

@@ -83,6 +83,7 @@ async def get_providers(
api_key=mask_api_key(service.get_decrypted_api_key(p.id)) if p.api_key else "",
default_model=p.default_model,
is_active=p.is_active,
is_multimodal=bool(p.is_multimodal) if p.is_multimodal is not None else False,
)
for p in providers
]
@@ -268,6 +269,7 @@ async def create_provider(
api_key=mask_api_key(config.api_key),
default_model=provider.default_model,
is_active=provider.is_active,
is_multimodal=bool(provider.is_multimodal) if provider.is_multimodal is not None else False,
)
@@ -303,6 +305,7 @@ async def update_provider(
api_key=mask_api_key(service.get_decrypted_api_key(provider.id)) if provider.api_key else "",
default_model=provider.default_model,
is_active=provider.is_active,
is_multimodal=bool(provider.is_multimodal) if provider.is_multimodal is not None else False,
)

View File

@@ -21,7 +21,6 @@ from ...dependencies import (
has_permission,
)
from ...services.llm_prompt_templates import (
is_multimodal_model,
normalize_llm_settings,
resolve_bound_provider_id,
)
@@ -104,10 +103,7 @@ async def create_task(
raise ValueError(f"LLM Provider {provider_id} not found")
if (
request.plugin_id == "llm_dashboard_validation"
and not is_multimodal_model(
db_provider.default_model,
db_provider.provider_type,
)
and not bool(db_provider.is_multimodal)
):
raise HTTPException(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,

View File

@@ -250,11 +250,8 @@ async def get_datasource_columns(
# #endregion get_datasource_columns
# #region check_target_schema [C:3] [TYPE Function]
# #region check_target_schema [C:3] [TYPE Function] [SEMANTICS api,translate,validate]
# @BRIEF Проверяет схему целевой таблицы: какие колонки ожидаются, какие есть, каких не хватает.
# @PRE User has translate.job.view permission.
# @POST Возвращает diff expected vs actual columns.
# @SIDE_EFFECT Делает SQL-запрос к information_schema.columns через Superset SQL Lab.
# @RELATION DEPENDS_ON -> [validate_target_table_schema]
# @RELATION DEPENDS_ON -> [TargetSchemaValidationRequest]
# @RELATION DEPENDS_ON -> [TargetSchemaValidationResponse]