Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhongsun96 committed Oct 17, 2023
1 parent 557dcd2 commit 62fd3df
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions backend/danswer/chat/personas.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@


def build_system_text_from_persona(persona: Persona) -> str | None:
text = (persona.system_text or "").rstrip()
text = (persona.system_text or "").strip()
if persona.datetime_aware:
current_datetime = datetime.now()
# Format looks like: "October 16, 2023 14:30"
formatted_datetime = current_datetime.strftime("%B %d, %Y %H:%M")

text += (
Expand Down Expand Up @@ -51,8 +52,8 @@ def load_personas_from_yaml(personas_yaml: str = PERSONAS_YAML) -> None:
upsert_persona(
name=persona["name"],
retrieval_enabled=persona.get("retrieval_enabled", True),
# Default to knowing the date/time if not specified, however if there should be no
# system prompt, do not interfere with the system-prompt-less flow by adding a
# Default to knowing the date/time if not specified, however if there is no
# system prompt, do not interfere with the flow by adding a
# system prompt that is ONLY the date info, this would likely not be useful
datetime_aware=persona.get(
"datetime_aware", bool(persona.get("system"))
Expand Down

0 comments on commit 62fd3df

Please sign in to comment.