From dc1c4407033d1a258641dc8dc23624b1d9d39cc1 Mon Sep 17 00:00:00 2001 From: zhaoxi Date: Sun, 26 Apr 2026 23:36:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BA=86=E4=B8=A5?= =?UTF-8?q?=E9=87=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pretor/core/database/module/user.py | 4 +++- pretor/core/database/table/individual.py | 2 +- pretor/core/individual/control_node/control_node.py | 2 +- pretor/utils/access.py | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pretor/core/database/module/user.py b/pretor/core/database/module/user.py index 0ac0ed9..35eb25a 100644 --- a/pretor/core/database/module/user.py +++ b/pretor/core/database/module/user.py @@ -17,6 +17,8 @@ from sqlmodel import select from pretor.utils.error import UserNotExistError, UserPasswordError from pretor.core.database.database_exception import database_exception from pretor.core.database.table.user import UserAuthority +from pretor.utils.access import Accessor + class AuthDatabase: def __init__(self, async_session_maker): self.async_session_maker = async_session_maker @@ -53,7 +55,7 @@ class AuthDatabase: user = results.scalar_one_or_none() if user is None: raise UserNotExistError() - if old_password != user.hashed_password: + if not Accessor.verify_password(old_password, user.hashed_password): raise UserPasswordError() user.hashed_password = new_password session.add(user) diff --git a/pretor/core/database/table/individual.py b/pretor/core/database/table/individual.py index b05e65c..3186a94 100644 --- a/pretor/core/database/table/individual.py +++ b/pretor/core/database/table/individual.py @@ -30,7 +30,7 @@ class WorkerIndividual(SQLModel, table=True): description: str = Field(nullable=False) provider_title: str model_id: str - system_prompt: Optional[dict] + system_prompt: Optional[str] output_template: Optional[dict] = Field(sa_column=Column(JSON),description="输出模板标识") bound_skill: Optional[str] = Field(sa_column=Column(JSON)) workspace: Optional[List[str]] = Field(sa_column=Column(JSON)) diff --git a/pretor/core/individual/control_node/control_node.py b/pretor/core/individual/control_node/control_node.py index 4429d3a..46cbeb6 100644 --- a/pretor/core/individual/control_node/control_node.py +++ b/pretor/core/individual/control_node/control_node.py @@ -69,7 +69,7 @@ class ControlNode: f"=== 当前任务步骤上下文 ===\n" f"- 步骤名称 (Name): {ctx.deps.workflow_step.name}\n" f"- 步骤目标/描述 (Description): {ctx.deps.workflow_step.desc}\n" - f"- 前置输入(input): {ctx.deps.workflow_step.input}\n" + f"- 前置输入(input): {ctx.deps.workflow_step.inputs}\n" ) return prompt diff --git a/pretor/utils/access.py b/pretor/utils/access.py index 0b9eab3..bd5cfef 100644 --- a/pretor/utils/access.py +++ b/pretor/utils/access.py @@ -63,7 +63,7 @@ class Accessor: return jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM) @staticmethod - def _verify_password(plain_password: str, hashed_password: str) -> bool: + def verify_password(plain_password: str, hashed_password: str) -> bool: return password_hasher.verify(plain_password, hashed_password) @staticmethod @@ -84,7 +84,7 @@ class Accessor: status_code=status.HTTP_401_UNAUTHORIZED, detail="用户不存在", ) - if not Accessor._verify_password(password, user.hashed_password): + if not Accessor.verify_password(password, user.hashed_password): raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, detail="用户名或密码错误",