mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-29 04:08:12 +08:00
Fix tiny issues (#14006)
### What problem does this PR solve? As title ### Type of change - [x] Refactoring <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Improved authentication error logging to better distinguish between JWT and API token failures. * Enhanced code documentation with clarifying comments for better maintainability. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -11,6 +11,7 @@ from peewee import DoesNotExist
|
||||
class UserCanvasVersionService(CommonService):
|
||||
model = UserCanvasVersion
|
||||
|
||||
# Build a stable display name for saved snapshots.
|
||||
@staticmethod
|
||||
def build_version_title(user_nickname, agent_title, ts=None):
|
||||
tenant = str(user_nickname or "").strip() or "tenant"
|
||||
@@ -18,6 +19,7 @@ class UserCanvasVersionService(CommonService):
|
||||
stamp = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(ts)) if ts is not None else time.strftime("%Y-%m-%d %H:%M:%S")
|
||||
return "{0}_{1}_{2}".format(tenant, title, stamp)
|
||||
|
||||
# Normalize DSL before comparing or writing version content.
|
||||
@staticmethod
|
||||
def _normalize_dsl(dsl):
|
||||
normalized = dsl
|
||||
@@ -143,6 +145,7 @@ class UserCanvasVersionService(CommonService):
|
||||
.first()
|
||||
)
|
||||
|
||||
# Repeated saves with the same DSL only refresh the latest snapshot.
|
||||
if latest and cls._normalize_dsl(latest.dsl) == normalized_dsl:
|
||||
# Protect released version: if latest is released and current is not,
|
||||
# create a new version instead of updating
|
||||
@@ -170,6 +173,7 @@ class UserCanvasVersionService(CommonService):
|
||||
cls.delete_all_versions(user_canvas_id)
|
||||
return latest.id, False
|
||||
|
||||
# Real content changes create a new snapshot.
|
||||
insert_data = {"user_canvas_id": user_canvas_id, "dsl": normalized_dsl}
|
||||
if title is not None:
|
||||
insert_data["title"] = title
|
||||
|
||||
Reference in New Issue
Block a user