mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
refac
This commit is contained in:
parent
66f00ce4bf
commit
efcf6db687
1 changed files with 2 additions and 1 deletions
|
|
@ -47,6 +47,7 @@ def prompt_template(template: str, user: Optional[Any] = None) -> str:
|
||||||
user = user.model_dump()
|
user = user.model_dump()
|
||||||
|
|
||||||
if isinstance(user, dict):
|
if isinstance(user, dict):
|
||||||
|
user_info = user.get("info", {}) or {}
|
||||||
birth_date = user.get("date_of_birth")
|
birth_date = user.get("date_of_birth")
|
||||||
age = None
|
age = None
|
||||||
|
|
||||||
|
|
@ -70,7 +71,7 @@ def prompt_template(template: str, user: Optional[Any] = None) -> str:
|
||||||
|
|
||||||
USER_VARIABLES = {
|
USER_VARIABLES = {
|
||||||
"name": str(user.get("name")),
|
"name": str(user.get("name")),
|
||||||
"location": str(user.get("info", {}).get("location")),
|
"location": str(user_info.get("location")),
|
||||||
"bio": str(user.get("bio")),
|
"bio": str(user.get("bio")),
|
||||||
"gender": str(user.get("gender")),
|
"gender": str(user.get("gender")),
|
||||||
"birth_date": str(birth_date),
|
"birth_date": str(birth_date),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue