Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -55,18 +55,31 @@ tab1, tab2 = st.tabs(["๐ Contract", "๐ Technical"])
|
|
55 |
with tab1:
|
56 |
ASSISTANT_ID = "asst_KsQRedoJUnEeStzfox1o06lO"
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
with st.sidebar:
|
63 |
st.header("โน๏ธ Contract Tools")
|
64 |
if st.button("๐งน Clear Chat"):
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
67 |
st.rerun()
|
68 |
|
69 |
show_image = st.toggle("๐ Show Page Image", value=True)
|
|
|
70 |
keyword = st.text_input("Search by Keyword", placeholder="e.g. defects, WHS, delay")
|
71 |
if st.button("๐ Search Keyword") and keyword:
|
72 |
st.session_state.pending_prompt = f"Find clauses or references related to: {keyword}"
|
@@ -99,6 +112,7 @@ with tab1:
|
|
99 |
if action != actions[0]:
|
100 |
st.session_state.pending_prompt = action
|
101 |
|
|
|
102 |
chat_col, image_col = st.columns([2, 1])
|
103 |
with chat_col:
|
104 |
st.markdown("### ๐ง Ask a Document-Specific Question")
|
|
|
55 |
with tab1:
|
56 |
ASSISTANT_ID = "asst_KsQRedoJUnEeStzfox1o06lO"
|
57 |
|
58 |
+
# Correct session state initialization
|
59 |
+
if "messages" not in st.session_state:
|
60 |
+
st.session_state.messages = []
|
61 |
+
if "thread_id" not in st.session_state:
|
62 |
+
st.session_state.thread_id = None
|
63 |
+
if "image_url" not in st.session_state:
|
64 |
+
st.session_state.image_url = None
|
65 |
+
if "image_updated" not in st.session_state:
|
66 |
+
st.session_state.image_updated = False
|
67 |
+
if "pending_prompt" not in st.session_state:
|
68 |
+
st.session_state.pending_prompt = None
|
69 |
+
|
70 |
+
# Sidebar tools
|
71 |
with st.sidebar:
|
72 |
st.header("โน๏ธ Contract Tools")
|
73 |
if st.button("๐งน Clear Chat"):
|
74 |
+
st.session_state.messages = []
|
75 |
+
st.session_state.thread_id = None
|
76 |
+
st.session_state.image_url = None
|
77 |
+
st.session_state.image_updated = False
|
78 |
+
st.session_state.pending_prompt = None
|
79 |
st.rerun()
|
80 |
|
81 |
show_image = st.toggle("๐ Show Page Image", value=True)
|
82 |
+
|
83 |
keyword = st.text_input("Search by Keyword", placeholder="e.g. defects, WHS, delay")
|
84 |
if st.button("๐ Search Keyword") and keyword:
|
85 |
st.session_state.pending_prompt = f"Find clauses or references related to: {keyword}"
|
|
|
112 |
if action != actions[0]:
|
113 |
st.session_state.pending_prompt = action
|
114 |
|
115 |
+
# Chat + Image layout
|
116 |
chat_col, image_col = st.columns([2, 1])
|
117 |
with chat_col:
|
118 |
st.markdown("### ๐ง Ask a Document-Specific Question")
|