mirror of
https://github.com/langgenius/dify.git
synced 2026-04-26 02:06:35 +08:00
optimize codes
This commit is contained in:
parent
95c5848d05
commit
c4e6ed1aa2
@ -178,7 +178,7 @@ class AccountService:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def close_account(account: Account) -> None:
|
def close_account(account: Account) -> None:
|
||||||
"""todo: Close account"""
|
"""Close account"""
|
||||||
account.status = AccountStatus.CLOSED.value
|
account.status = AccountStatus.CLOSED.value
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
@ -443,7 +443,7 @@ class RegisterService:
|
|||||||
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
db.session.rollback() # todo: do not work
|
db.session.rollback()
|
||||||
logging.error(f'Register failed: {e}')
|
logging.error(f'Register failed: {e}')
|
||||||
raise AccountRegisterError(f'Registration failed: {e}') from e
|
raise AccountRegisterError(f'Registration failed: {e}') from e
|
||||||
|
|
||||||
|
|||||||
@ -118,8 +118,6 @@ class WorkflowService:
|
|||||||
if not draft_workflow:
|
if not draft_workflow:
|
||||||
raise ValueError('No valid workflow found.')
|
raise ValueError('No valid workflow found.')
|
||||||
|
|
||||||
# TODO check if the workflow structure is valid
|
|
||||||
|
|
||||||
# create new workflow
|
# create new workflow
|
||||||
workflow = Workflow(
|
workflow = Workflow(
|
||||||
tenant_id=app_model.tenant_id,
|
tenant_id=app_model.tenant_id,
|
||||||
|
|||||||
@ -27,7 +27,7 @@ def send_invite_member_mail_task(language: str, to: str, token: str, inviter_nam
|
|||||||
fg='green'))
|
fg='green'))
|
||||||
start_at = time.perf_counter()
|
start_at = time.perf_counter()
|
||||||
|
|
||||||
# TODO send invite member mail using different languages
|
# send invite member mail using different languages
|
||||||
try:
|
try:
|
||||||
url = f'{current_app.config.get("CONSOLE_WEB_URL")}/activate?token={token}'
|
url = f'{current_app.config.get("CONSOLE_WEB_URL")}/activate?token={token}'
|
||||||
if language == 'zh-Hans':
|
if language == 'zh-Hans':
|
||||||
|
|||||||
@ -51,6 +51,3 @@ def test_execute_answer():
|
|||||||
|
|
||||||
assert result.status == WorkflowNodeExecutionStatus.SUCCEEDED
|
assert result.status == WorkflowNodeExecutionStatus.SUCCEEDED
|
||||||
assert result.outputs['answer'] == "Today's weather is sunny\nYou are a helpful AI.\n{{img}}\nFin."
|
assert result.outputs['answer'] == "Today's weather is sunny\nYou are a helpful AI.\n{{img}}\nFin."
|
||||||
|
|
||||||
|
|
||||||
# TODO test files
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user