浏览代码

fix: xxx is not bound to a Session (#24966)

tags/1.8.1
Will 2 个月前
父节点
当前提交
b5216df4fe
没有帐户链接到提交者的电子邮件
共有 2 个文件被更改,包括 5 次插入2 次删除
  1. 1
    1
      api/core/app/apps/advanced_chat/app_generator.py
  2. 4
    1
      api/services/account_service.py

+ 1
- 1
api/core/app/apps/advanced_chat/app_generator.py 查看文件

@@ -453,7 +453,7 @@ class AdvancedChatAppGenerator(MessageBasedAppGenerator):
# release database connection, because the following new thread operations may take a long time
db.session.refresh(workflow)
db.session.refresh(message)
db.session.refresh(user)
# db.session.refresh(user)
db.session.close()

# return response or stream generator

+ 4
- 1
api/services/account_service.py 查看文件

@@ -145,7 +145,10 @@ class AccountService:
if naive_utc_now() - account.last_active_at > timedelta(minutes=10):
account.last_active_at = naive_utc_now()
db.session.commit()

# NOTE: make sure account is accessible outside of a db session
# This ensures that it will work correctly after upgrading to Flask version 3.1.2
db.session.refresh(account)
db.session.close()
return account

@staticmethod

正在加载...
取消
保存