app.py
Browse files
app.py
CHANGED
|
@@ -11,7 +11,7 @@ from pydub import AudioSegment
|
|
| 11 |
from io import BytesIO
|
| 12 |
|
| 13 |
# Streamlit Page Config
|
| 14 |
-
st.set_page_config(page_title="Schlager ContractAi")
|
| 15 |
|
| 16 |
# Authentication
|
| 17 |
AUTHORIZED_USERS = {
|
|
@@ -43,9 +43,11 @@ if not st.session_state["authenticated"]:
|
|
| 43 |
st.title("Schlager ContractAi")
|
| 44 |
st.caption("Chat with your contract or manage meeting minutes")
|
| 45 |
|
| 46 |
-
#
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
| 49 |
|
| 50 |
# Tabs
|
| 51 |
tab1, tab2, tab3, tab4 = st.tabs(["Contract", "Technical", "Minutes", "Document Preparation"])
|
|
@@ -111,12 +113,8 @@ with tab4:
|
|
| 111 |
def contract_chat_section(tab, assistant_id, session_key, input_key):
|
| 112 |
with tab:
|
| 113 |
st.subheader("Chat")
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
client = OpenAI(api_key=OPENAI_API_KEY)
|
| 117 |
-
else:
|
| 118 |
-
st.error("Please enter your C2 Group of Technologies Access Key to continue.")
|
| 119 |
-
st.stop()
|
| 120 |
|
| 121 |
if session_key not in st.session_state:
|
| 122 |
st.session_state[session_key] = []
|
|
@@ -164,4 +162,4 @@ ASSISTANT_CONTRACT_ID = "asst_rd9h8PfYuOmHbkvOF3RTmVfn"
|
|
| 164 |
ASSISTANT_TECHNICAL_ID = "asst_xizNZBCJuy4TqdjqjwkxbAki"
|
| 165 |
|
| 166 |
contract_chat_section(tab1, ASSISTANT_CONTRACT_ID, "contract_messages", "contract_input")
|
| 167 |
-
contract_chat_section(tab2, ASSISTANT_TECHNICAL_ID, "technical_messages", "technical_input")
|
|
|
|
| 11 |
from io import BytesIO
|
| 12 |
|
| 13 |
# Streamlit Page Config
|
| 14 |
+
st.set_page_config(page_title="Schlager ContractAi", layout="wide")
|
| 15 |
|
| 16 |
# Authentication
|
| 17 |
AUTHORIZED_USERS = {
|
|
|
|
| 43 |
st.title("Schlager ContractAi")
|
| 44 |
st.caption("Chat with your contract or manage meeting minutes")
|
| 45 |
|
| 46 |
+
# Load API Key from Environment Variable
|
| 47 |
+
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
| 48 |
+
if not OPENAI_API_KEY:
|
| 49 |
+
st.error("Missing OpenAI API key. Please set it as an environment variable.")
|
| 50 |
+
st.stop()
|
| 51 |
|
| 52 |
# Tabs
|
| 53 |
tab1, tab2, tab3, tab4 = st.tabs(["Contract", "Technical", "Minutes", "Document Preparation"])
|
|
|
|
| 113 |
def contract_chat_section(tab, assistant_id, session_key, input_key):
|
| 114 |
with tab:
|
| 115 |
st.subheader("Chat")
|
| 116 |
+
|
| 117 |
+
client = OpenAI(api_key=OPENAI_API_KEY)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
if session_key not in st.session_state:
|
| 120 |
st.session_state[session_key] = []
|
|
|
|
| 162 |
ASSISTANT_TECHNICAL_ID = "asst_xizNZBCJuy4TqdjqjwkxbAki"
|
| 163 |
|
| 164 |
contract_chat_section(tab1, ASSISTANT_CONTRACT_ID, "contract_messages", "contract_input")
|
| 165 |
+
contract_chat_section(tab2, ASSISTANT_TECHNICAL_ID, "technical_messages", "technical_input")
|