Skip to content

Commit fe3ac85

Browse files
authored
Merge pull request #175 from aws-samples/spy_dev
add force_set_cookie
2 parents aed23dd + d9e3dd2 commit fe3ac85

File tree

5 files changed

+25
-10
lines changed

5 files changed

+25
-10
lines changed

application/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ WORKDIR /app
88

99
COPY requirements.txt /app/
1010

11-
ARG AWS_REGION=us-east-1
11+
#ARG AWS_REGION=us-east-1
1212
ENV AWS_REGION=${AWS_REGION}
1313

1414
# Print the AWS_REGION for verification

application/Dockerfile-api

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ WORKDIR /app
44

55
COPY . /app/
66

7-
ARG AWS_REGION=us-east-1
7+
#ARG AWS_REGION=us-east-1
88
ENV AWS_REGION=${AWS_REGION}
99

1010
# Print the AWS_REGION for verification

application/Index.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import streamlit as st
2-
from utils.navigation import get_authenticator
2+
from utils.navigation import get_authenticator, force_set_cookie
33

44
st.set_page_config(
55
page_title="Intelligent BI",
@@ -10,6 +10,7 @@
1010
name, authentication_status, username = authenticator.login('main')
1111

1212
if authentication_status:
13+
force_set_cookie(authenticator)
1314
st.switch_page("pages/mainpage.py")
1415
elif authentication_status == False:
1516
st.error('Username/password is incorrect')

application/pages/5_🪙_Prompt_Management.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,18 @@ def main():
3636
prompt_type_selected_table = st.selectbox("Prompt Type", prompt_map.keys(), index=None,
3737
format_func=lambda x: prompt_map[x].get('title'),
3838
placeholder="Please select a prompt type")
39-
40-
profile_detail = ProfileManagement.get_profile_by_name(current_profile)
41-
prompt_map = profile_detail.prompt_map
42-
4339
if prompt_type_selected_table is not None:
4440
single_type_prompt_map = prompt_map.get(prompt_type_selected_table)
4541
system_prompt = single_type_prompt_map.get('system_prompt')
46-
user_prompt = single_type_prompt_map.get('user_prompt')
4742
model_selected_table = st.selectbox("LLM Model", system_prompt.keys(), index=None,
4843
placeholder="Please select a model")
4944

5045
if model_selected_table is not None:
46+
profile_detail = ProfileManagement.get_profile_by_name(current_profile)
47+
prompt_map = profile_detail.prompt_map
48+
single_type_prompt_map = prompt_map.get(prompt_type_selected_table)
49+
system_prompt = single_type_prompt_map.get('system_prompt')
50+
user_prompt = single_type_prompt_map.get('user_prompt')
5151
system_prompt_input = st.text_area('System Prompt', system_prompt[model_selected_table], height=300)
5252
user_prompt_input = st.text_area('User Prompt', user_prompt[model_selected_table], height=500)
5353

application/utils/navigation.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ def get_authenticator():
2020
)
2121

2222

23+
def force_set_cookie(authenticator):
24+
"""
25+
Force the cookie
26+
:param authenticator:
27+
:return:
28+
"""
29+
try:
30+
authenticator.cookie_handler.set_cookie()
31+
except:
32+
pass
33+
34+
2335
def get_current_page_name():
2436
ctx = get_script_run_ctx()
2537
if ctx is None:
@@ -35,12 +47,14 @@ def make_sidebar():
3547
if st.session_state.get('authentication_status'):
3648
st.page_link("pages/mainpage.py", label="Index")
3749
st.page_link("pages/1_🌍_Generative_BI_Playground.py", label="Generative BI Playground", icon="🌍")
38-
st.markdown(":gray[Data Customization Management]", help='Add your own datasources and customize description for LLM to better understand them')
50+
st.markdown(":gray[Data Customization Management]",
51+
help='Add your own datasources and customize description for LLM to better understand them')
3952
st.page_link("pages/2_🪙_Data_Connection_Management.py", label="Data Connection Management", icon="🪙")
4053
st.page_link("pages/3_🪙_Data_Profile_Management.py", label="Data Profile Management", icon="🪙")
4154
st.page_link("pages/4_🪙_Schema_Description_Management.py", label="Schema Description Management", icon="🪙")
4255
st.page_link("pages/5_🪙_Prompt_Management.py", label="Prompt Management", icon="🪙")
43-
st.markdown(":gray[Performance Enhancement]", help='Optimize your LLM for better performance by adding RAG or agent')
56+
st.markdown(":gray[Performance Enhancement]",
57+
help='Optimize your LLM for better performance by adding RAG or agent')
4458
st.page_link("pages/6_📚_Index_Management.py", label="Index Management", icon="📚")
4559
st.page_link("pages/7_📚_Entity_Management.py", label="Entity Management", icon="📚")
4660
st.page_link("pages/8_📚_Agent_Cot_Management.py", label="Agent Cot Management", icon="📚")

0 commit comments

Comments
 (0)