Added new settings store on the config yaml file
This commit is contained in:
parent
f7f1553f1d
commit
345a3861b0
1 changed files with 69 additions and 0 deletions
|
|
@ -65,6 +65,16 @@ async def get_settings(request, session_manager):
|
||||||
"ingest_flow_id": LANGFLOW_INGEST_FLOW_ID,
|
"ingest_flow_id": LANGFLOW_INGEST_FLOW_ID,
|
||||||
"langflow_public_url": LANGFLOW_PUBLIC_URL,
|
"langflow_public_url": LANGFLOW_PUBLIC_URL,
|
||||||
"edited": openrag_config.edited,
|
"edited": openrag_config.edited,
|
||||||
|
# Onboarding state
|
||||||
|
"onboarding": {
|
||||||
|
"current_step": openrag_config.onboarding.current_step,
|
||||||
|
"assistant_message": openrag_config.onboarding.assistant_message,
|
||||||
|
"selected_nudge": openrag_config.onboarding.selected_nudge,
|
||||||
|
"card_steps": openrag_config.onboarding.card_steps,
|
||||||
|
"upload_steps": openrag_config.onboarding.upload_steps,
|
||||||
|
"openrag_docs_filter_id": openrag_config.onboarding.openrag_docs_filter_id,
|
||||||
|
"user_doc_filter_id": openrag_config.onboarding.user_doc_filter_id,
|
||||||
|
},
|
||||||
# OpenRAG configuration
|
# OpenRAG configuration
|
||||||
"providers": {
|
"providers": {
|
||||||
"openai": {
|
"openai": {
|
||||||
|
|
@ -1353,6 +1363,65 @@ async def _update_langflow_chunk_settings(config, flows_service):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
async def update_onboarding_state(request):
|
||||||
|
"""Update onboarding state in configuration"""
|
||||||
|
try:
|
||||||
|
await TelemetryClient.send_event(Category.ONBOARDING, MessageId.ORB_ONBOARD_START)
|
||||||
|
|
||||||
|
# Parse request body
|
||||||
|
body = await request.json()
|
||||||
|
|
||||||
|
# Validate allowed fields
|
||||||
|
allowed_fields = {
|
||||||
|
"current_step",
|
||||||
|
"assistant_message",
|
||||||
|
"selected_nudge",
|
||||||
|
"card_steps",
|
||||||
|
"upload_steps",
|
||||||
|
"openrag_docs_filter_id",
|
||||||
|
"user_doc_filter_id",
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check for invalid fields
|
||||||
|
invalid_fields = set(body.keys()) - allowed_fields
|
||||||
|
if invalid_fields:
|
||||||
|
return JSONResponse(
|
||||||
|
{
|
||||||
|
"error": f"Invalid fields: {', '.join(invalid_fields)}. Allowed fields: {', '.join(allowed_fields)}"
|
||||||
|
},
|
||||||
|
status_code=400,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Update onboarding state using config manager
|
||||||
|
success = config_manager.update_onboarding_state(**body)
|
||||||
|
|
||||||
|
if not success:
|
||||||
|
return JSONResponse(
|
||||||
|
{"error": "Failed to update onboarding state"},
|
||||||
|
status_code=500,
|
||||||
|
)
|
||||||
|
|
||||||
|
logger.info(f"Onboarding state updated: {body}")
|
||||||
|
|
||||||
|
return JSONResponse(
|
||||||
|
{
|
||||||
|
"message": "Onboarding state updated successfully",
|
||||||
|
"updated_fields": list(body.keys()),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
return JSONResponse(
|
||||||
|
{"error": "Invalid JSON in request body"}, status_code=400
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Error updating onboarding state: {str(e)}")
|
||||||
|
return JSONResponse(
|
||||||
|
{"error": f"Failed to update onboarding state: {str(e)}"},
|
||||||
|
status_code=500,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
async def reapply_all_settings(session_manager = None):
|
async def reapply_all_settings(session_manager = None):
|
||||||
"""
|
"""
|
||||||
Reapply all current configuration settings to Langflow flows and global variables.
|
Reapply all current configuration settings to Langflow flows and global variables.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue