fix: persist environment selection, support Kilo AI provider, resolve Superset virtual columns for translation preview
- Add environment_id to TranslationJob model/schema/API + DB migration - Pass environmentId from page to TranslationPreview and fetchPreview - Fix _fetch_sample_rows: use result_type='samples' to include virtual cols - Add 'kilo' and 'openrouter' to supported LLM provider types - Make response_format conditional (skip for non-OpenAI upstream providers) - Remove source_table field from form (redundant with datasource) - Restore datasourceSearch display from saved job on page load - Add request/response logging for LLM API calls
This commit is contained in:
@@ -475,6 +475,38 @@ def _ensure_filter_source_enum_values(bind_engine):
|
||||
# @SIDE_EFFECT: Executes ALTER TABLE statements against dataset review tables in the application database.
|
||||
# @RELATION: [DEPENDS_ON] ->[DatasetReviewSession]
|
||||
# @RELATION: [DEPENDS_ON] ->[ImportedFilter]
|
||||
def _ensure_translation_jobs_columns(bind_engine):
|
||||
with belief_scope("_ensure_translation_jobs_columns"):
|
||||
table_name = "translation_jobs"
|
||||
inspector = inspect(bind_engine)
|
||||
if table_name not in inspector.get_table_names():
|
||||
return
|
||||
|
||||
existing_columns = {
|
||||
str(column.get("name") or "").strip()
|
||||
for column in inspector.get_columns(table_name)
|
||||
}
|
||||
|
||||
if "environment_id" not in existing_columns:
|
||||
try:
|
||||
with bind_engine.begin() as connection:
|
||||
connection.execute(
|
||||
text(
|
||||
"ALTER TABLE translation_jobs "
|
||||
"ADD COLUMN environment_id VARCHAR"
|
||||
)
|
||||
)
|
||||
logger.reflect(
|
||||
"Added environment_id column to translation_jobs",
|
||||
)
|
||||
except Exception as migration_error:
|
||||
logger.explore(
|
||||
"Failed to add environment_id to translation_jobs",
|
||||
extra={"error": str(migration_error)},
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
def _ensure_dataset_review_session_columns(bind_engine):
|
||||
with belief_scope("_ensure_dataset_review_session_columns"):
|
||||
inspector = inspect(bind_engine)
|
||||
@@ -573,6 +605,7 @@ def init_db():
|
||||
ensure_connection_configs_table(engine)
|
||||
_ensure_filter_source_enum_values(engine)
|
||||
_ensure_dataset_review_session_columns(engine)
|
||||
_ensure_translation_jobs_columns(engine)
|
||||
|
||||
|
||||
# [/DEF:init_db:Function]
|
||||
|
||||
Reference in New Issue
Block a user