Skip to content

Commit

Permalink
update chat history
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuan325 committed Feb 28, 2024
1 parent 8da18f5 commit 054d32c
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions llm_demo/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,26 @@ async def login_google(
if user_id_token is None:
raise HTTPException(status_code=401, detail="No user credentials found")

user_name = get_user_name(str(user_id_token), request.app.state.client_id)
client_id = request.app.state.client_id
if not client_id:
raise HTTPException(status_code=400, detail="Client id not found")
user_name = get_user_name(str(user_id_token), client_id)

# create new request session
orchestrator = request.app.state.orchestration_type
orchestrator.set_user_session_header(request.session["uuid"], str(user_id_token))
print("Logged in to Google.")

request.session["history"][0] = {
"type": "ai",
"data": {
"content": f"Welcome to Cymbal Air, {user_name}! How may I assist you?"
},
}
welcome_text = f"Welcome to Cymbal Air, {user_name}! How may I assist you?"
if len(request.session["history"]) == 1:
request.session["history"][0] = {
"type": "ai",
"data": {"content": welcome_text},
}
else:
request.session["history"].append(
{"type": "ai", "data": {"content": welcome_text}}
)

# Redirect to source URL
source_url = request.headers["Referer"]
Expand Down

0 comments on commit 054d32c

Please sign in to comment.