mirror of
https://github.com/langgenius/dify.git
synced 2026-04-29 04:26:30 +08:00
fix
This commit is contained in:
parent
e634d25049
commit
413623598b
@ -11,6 +11,7 @@ from collections.abc import Generator, Mapping
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from hashlib import sha256
|
from hashlib import sha256
|
||||||
from typing import TYPE_CHECKING, Annotated, Any, Optional, Union, cast
|
from typing import TYPE_CHECKING, Annotated, Any, Optional, Union, cast
|
||||||
|
from uuid import UUID
|
||||||
from zoneinfo import available_timezones
|
from zoneinfo import available_timezones
|
||||||
|
|
||||||
from flask import Response, stream_with_context
|
from flask import Response, stream_with_context
|
||||||
@ -119,7 +120,17 @@ def uuid_value(value: Any) -> str:
|
|||||||
raise ValueError(error)
|
raise ValueError(error)
|
||||||
|
|
||||||
|
|
||||||
UUIDStrOrEmpty = Annotated[str, AfterValidator(uuid_value)]
|
def normalize_uuid(value: str | UUID | None) -> str | None:
|
||||||
|
if not value:
|
||||||
|
return None
|
||||||
|
|
||||||
|
try:
|
||||||
|
return uuid_value(value)
|
||||||
|
except ValueError as exc:
|
||||||
|
raise ValueError("must be a valid UUID") from exc
|
||||||
|
|
||||||
|
|
||||||
|
UUIDStrOrEmpty = Annotated[str, AfterValidator(normalize_uuid)]
|
||||||
|
|
||||||
|
|
||||||
def alphanumeric(value: str):
|
def alphanumeric(value: str):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user