Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: fix-app-site-missing command (#5714)
takatost8e5569f77328
diff --git a/api/commands.py b/api/commands.pyindex fa6221df52a..56217c898e2 100644--- a/api/commands.py+++ b/api/commands.py@@ -593,17 +593,22 @@ def fix_app_site_missing():"""click.echo(click.style('Start fix app related site missing issue.', fg='green'))+ failed_app_ids = []while True:- try:- sql = """select apps.id as id from apps left join sites on sites.app_id=apps.id+ sql = """select apps.id as id from apps left join sites on sites.app_id=apps.idwhere sites.id is null limit 1000"""- with db.engine.begin() as conn:- rs = conn.execute(db.text(sql))+ with db.engine.begin() as conn:+ rs = conn.execute(db.text(sql))++ processed_count = 0+ for i in rs:+ processed_count += 1+ app_id = str(i.id)++ if app_id in failed_app_ids:+ continue- processed_count = 0- for i in rs:- processed_count += 1- app_id = str(i.id)+ try:app = db.session.query(App).filter(App.id == app_id).first()tenant = app.tenantif tenant:@@ -615,13 +620,15 @@ where sites.id is null limit 1000"""account = accounts[0]print("Fix app {} related site missing issue.".format(app.id))app_was_created.send(app, account=account)+ except Exception as e:+ failed_app_ids.append(app_id)+ click.echo(click.style('Fix app {} related site missing issue failed!'.format(app_id), fg='red'))+ logging.exception(f'Fix app related site missing issue failed, error: {e}')+ continue++ if not processed_count:+ break- if not processed_count:- break- except Exception as e:- click.echo(click.style('Fix app related site missing issue failed!', fg='red'))- logging.exception(f'Fix app related site missing issue failed, error: {e}')- continueclick.echo(click.style('Congratulations! Fix app related site missing issue successful!', fg='green'))