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
feat: add last active at for accounts (#375)
John Wang7552a6be3695
diff --git a/api/app.py b/api/app.pyindex b3fcbc220ad..2c6544c0c85 100644--- a/api/app.py+++ b/api/app.py@@ -1,5 +1,7 @@# -*- coding:utf-8 -*-import os+from datetime import datetime+if not os.environ.get("DEBUG") or os.environ.get("DEBUG").lower() != 'true':from gevent import monkeymonkey.patch_all()@@ -122,6 +124,9 @@ def load_user(user_id):account.current_tenant_id = tenant_account_join.tenant_idsession['workspace_id'] = account.current_tenant_id+ account.last_active_at = datetime.utcnow()+ db.session.commit()+# Log in the user with the updated user_idflask_login.login_user(account, remember=True)diff --git a/api/migrations/versions/614f77cecc48_add_last_active_at.py b/api/migrations/versions/614f77cecc48_add_last_active_at.pynew file mode 100644index 00000000000..d0509d29674--- /dev/null+++ b/api/migrations/versions/614f77cecc48_add_last_active_at.py@@ -0,0 +1,32 @@+"""add last active at++Revision ID: 614f77cecc48+Revises: a45f4dfde53b+Create Date: 2023-06-15 13:33:00.357467++"""+from alembic import op+import sqlalchemy as sa+++# revision identifiers, used by Alembic.+revision = '614f77cecc48'+down_revision = 'a45f4dfde53b'+branch_labels = None+depends_on = None+++def upgrade():+ # ### commands auto generated by Alembic - please adjust! ###+ with op.batch_alter_table('accounts', schema=None) as batch_op:+ batch_op.add_column(sa.Column('last_active_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP(0)'), nullable=False))++ # ### end Alembic commands ###+++def downgrade():+ # ### commands auto generated by Alembic - please adjust! ###+ with op.batch_alter_table('accounts', schema=None) as batch_op:+ batch_op.drop_column('last_active_at')++ # ### end Alembic commands ###diff --git a/api/models/account.py b/api/models/account.pyindex de2d3bd71fe..bc15e865089 100644--- a/api/models/account.py+++ b/api/models/account.py@@ -32,6 +32,7 @@ class Account(UserMixin, db.Model):timezone = db.Column(db.String(255))last_login_at = db.Column(db.DateTime)last_login_ip = db.Column(db.String(255))+ last_active_at = db.Column(db.DateTime, nullable=False, server_default=db.text('CURRENT_TIMESTAMP(0)'))status = db.Column(db.String(16), nullable=False, server_default=db.text("'active'::character varying"))initialized_at = db.Column(db.DateTime)created_at = db.Column(db.DateTime, nullable=False, server_default=db.text('CURRENT_TIMESTAMP(0)'))