Adds current version of files
This commit is contained in:
@@ -8,8 +8,12 @@ import boto3
|
||||
from botocore.exceptions import ClientError
|
||||
import jwt
|
||||
headers = st.context.headers
|
||||
|
||||
# The ID token contains user claims
|
||||
import streamlit as st
|
||||
|
||||
# Using a list of options
|
||||
|
||||
options = ["English", "Portugues", "Espanhol",]
|
||||
language = st.selectbox("Response language:", options)
|
||||
id_token = headers.get('x-amzn-oidc-data')
|
||||
decoded = jwt.decode(id_token, options={"verify_signature": False})
|
||||
|
||||
@@ -20,6 +24,7 @@ user_id = (
|
||||
decoded.get("username") or # Username alternativo
|
||||
decoded.get("user_id") # Campo customizado
|
||||
)
|
||||
email=decoded.get("email")
|
||||
st.header("Assistente Produtos Servicos")
|
||||
url="https://xexm2wsz07-vpce-05915540d0592b921.execute-api.us-east-1.amazonaws.com/dev"
|
||||
payload=[]
|
||||
@@ -47,7 +52,7 @@ if prompt:
|
||||
st.chat_message("user").write(prompt)
|
||||
with st.spinner("Generating response.."):
|
||||
payload=[{"role":"user","content":prompt}]
|
||||
content={"message":payload,"chat_history":st.session_state["chat_history"],"username":user_id}
|
||||
content={"message":payload,"chat_history":st.session_state["chat_history"],"username":user_id,"origem":"Front","email":email,"language":language}
|
||||
headers={"Content-type":"application/json","x-api-key":json.loads(st_auth.get_secret())['api-gateway-api-key']}
|
||||
generated_response=json.loads(requests.post(url,json=content,headers=headers).text)
|
||||
if 'chat_history' in generated_response:
|
||||
|
||||
Reference in New Issue
Block a user