mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-13 17:52:38 +02:00
feat: add language support across configurations and prompts
This commit is contained in:
parent
402039f02f
commit
045537aa79
16 changed files with 242 additions and 18 deletions
|
|
@ -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():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue