Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,7 +28,6 @@ class State(TypedDict):
|
|
| 28 |
|
| 29 |
# LLM
|
| 30 |
llm = ChatGroq(model="deepseek-r1-distill-llama-70b")
|
| 31 |
-
# llm_with_tools = llm.bind_tools(tools=tools)
|
| 32 |
|
| 33 |
# Memory
|
| 34 |
memory = MemorySaver()
|
|
@@ -41,11 +40,7 @@ def ai_assistance(state: State):
|
|
| 41 |
# Build LangGraph
|
| 42 |
builder = StateGraph(State)
|
| 43 |
builder.add_node("AI_Assistance", ai_assistance)
|
| 44 |
-
# builder.add_node("tools", ToolNode(tools))
|
| 45 |
-
|
| 46 |
builder.add_edge(START, "AI_Assistance")
|
| 47 |
-
# builder.add_conditional_edges("AI_Assistance", tools_condition)
|
| 48 |
-
# builder.add_edge("tools", "AI_Assistance")
|
| 49 |
builder.add_edge("AI_Assistance", END)
|
| 50 |
graph = builder.compile(checkpointer=memory)
|
| 51 |
|
|
@@ -100,8 +95,6 @@ if "thread_id" not in st.session_state:
|
|
| 100 |
st.session_state.thread_id = "1"
|
| 101 |
if "chat_history" not in st.session_state:
|
| 102 |
st.session_state.chat_history = []
|
| 103 |
-
if "show_upload" not in st.session_state:
|
| 104 |
-
st.session_state.show_upload = False
|
| 105 |
if "selected_tools" not in st.session_state:
|
| 106 |
st.session_state.selected_tools = ["Arxiv", "Wikipedia", "Tavily"]
|
| 107 |
|
|
@@ -113,32 +106,8 @@ for msg in st.session_state.chat_history:
|
|
| 113 |
# Custom Chat Input Box UI
|
| 114 |
with st.container():
|
| 115 |
with st.form("chat_form", clear_on_submit=True):
|
| 116 |
-
st.markdown('<div id="floating-container">', unsafe_allow_html=True)
|
| 117 |
-
|
| 118 |
-
col1, col2 = st.columns([1, 17])
|
| 119 |
-
with col1:
|
| 120 |
-
toggle = st.form_submit_button("➕", use_container_width=True)
|
| 121 |
-
with col2:
|
| 122 |
-
user_input = st.text_input("Ask me", label_visibility="collapsed",placeholder="Ask me Anything")
|
| 123 |
-
|
| 124 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
| 125 |
-
|
| 126 |
-
# Floating Popup for Uploads and Tools
|
| 127 |
-
if toggle:
|
| 128 |
-
st.session_state.show_upload = not st.session_state.show_upload
|
| 129 |
-
|
| 130 |
-
if st.session_state.show_upload:
|
| 131 |
-
with st.expander("📎 Upload Files or Images", expanded=False,width=300):
|
| 132 |
-
st.file_uploader("Upload:", type=["txt", "pdf", "docx"], key="text_file")
|
| 133 |
-
st.file_uploader("Upload image:", type=["jpg", "jpeg", "png"], key="img_file")
|
| 134 |
-
|
| 135 |
-
# st.session_state.selected_tools = st.multiselect(
|
| 136 |
-
# "🛠 Select Tools:",
|
| 137 |
-
# ["Arxiv", "Wikipedia", "Tavily"],
|
| 138 |
-
# default=st.session_state.selected_tools,
|
| 139 |
-
# width= 300
|
| 140 |
-
# )
|
| 141 |
-
|
| 142 |
submitted = st.form_submit_button(label = "Send")
|
| 143 |
if submitted and user_input:
|
| 144 |
st.session_state.chat_history.append(HumanMessage(content=user_input))
|
|
|
|
| 28 |
|
| 29 |
# LLM
|
| 30 |
llm = ChatGroq(model="deepseek-r1-distill-llama-70b")
|
|
|
|
| 31 |
|
| 32 |
# Memory
|
| 33 |
memory = MemorySaver()
|
|
|
|
| 40 |
# Build LangGraph
|
| 41 |
builder = StateGraph(State)
|
| 42 |
builder.add_node("AI_Assistance", ai_assistance)
|
|
|
|
|
|
|
| 43 |
builder.add_edge(START, "AI_Assistance")
|
|
|
|
|
|
|
| 44 |
builder.add_edge("AI_Assistance", END)
|
| 45 |
graph = builder.compile(checkpointer=memory)
|
| 46 |
|
|
|
|
| 95 |
st.session_state.thread_id = "1"
|
| 96 |
if "chat_history" not in st.session_state:
|
| 97 |
st.session_state.chat_history = []
|
|
|
|
|
|
|
| 98 |
if "selected_tools" not in st.session_state:
|
| 99 |
st.session_state.selected_tools = ["Arxiv", "Wikipedia", "Tavily"]
|
| 100 |
|
|
|
|
| 106 |
# Custom Chat Input Box UI
|
| 107 |
with st.container():
|
| 108 |
with st.form("chat_form", clear_on_submit=True):
|
| 109 |
+
st.markdown('<div id="floating-container">', unsafe_allow_html=True)
|
| 110 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
submitted = st.form_submit_button(label = "Send")
|
| 112 |
if submitted and user_input:
|
| 113 |
st.session_state.chat_history.append(HumanMessage(content=user_input))
|