feat: add language support across configurations and prompts

This commit is contained in:
Tarun 2025-10-12 13:13:42 +05:30
parent 402039f02f
commit 045537aa79
16 changed files with 242 additions and 18 deletions

View file

@ -299,7 +299,10 @@ async def update_user_llm_preferences(
# Validate that all provided LLM config IDs belong to the search space
update_data = preferences.model_dump(exclude_unset=True)
# Store language from configs to validate consistency
languages = set()
for _key, llm_config_id in update_data.items():
if llm_config_id is not None:
# Verify the LLM config belongs to the search space
@ -315,6 +318,16 @@ async def update_user_llm_preferences(
status_code=404,
detail=f"LLM configuration {llm_config_id} not found in this search space",
)
# Collect language for consistency check
languages.add(llm_config.language)
# Check if all selected LLM configs have the same language
if len(languages) > 1:
raise HTTPException(
status_code=400,
detail="All selected LLM configurations must have the same language setting",
)
# Update user preferences
for key, value in update_data.items():