Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
# File: app.py
|
| 2 |
import streamlit as st
|
| 3 |
-
|
| 4 |
from orchestrator.dispatcher import Dispatcher
|
| 5 |
from components.sidebar import render_sidebar
|
| 6 |
from components.paper_list import render_paper_list
|
|
@@ -9,16 +8,24 @@ from components.graph_view import render_graph
|
|
| 9 |
|
| 10 |
|
| 11 |
def main():
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
if search_clicked and query:
|
| 18 |
dispatcher = Dispatcher()
|
| 19 |
|
| 20 |
-
# 1. Search papers
|
| 21 |
-
papers = dispatcher.search_papers(query)
|
| 22 |
render_paper_list(papers)
|
| 23 |
|
| 24 |
# 2. Show notebook for the first paper
|
|
@@ -27,7 +34,7 @@ def main():
|
|
| 27 |
notebook_cells = dispatcher.get_notebook_cells(first_id)
|
| 28 |
render_notebook(notebook_cells)
|
| 29 |
|
| 30 |
-
# 3. Visualize knowledge graph
|
| 31 |
graph_data = dispatcher.get_graph(first_id)
|
| 32 |
render_graph(graph_data)
|
| 33 |
|
|
|
|
| 1 |
# File: app.py
|
| 2 |
import streamlit as st
|
|
|
|
| 3 |
from orchestrator.dispatcher import Dispatcher
|
| 4 |
from components.sidebar import render_sidebar
|
| 5 |
from components.paper_list import render_paper_list
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
def main():
|
| 11 |
+
# Page configuration with theming
|
| 12 |
+
st.set_page_config(page_title="AI Research Companion", layout="wide", initial_sidebar_state="expanded")
|
| 13 |
+
|
| 14 |
+
# Render sidebar for inputs: query, num results, theme
|
| 15 |
+
query, num_results, theme, search_clicked = render_sidebar()
|
| 16 |
|
| 17 |
+
# Dynamically inject simple dark CSS if chosen
|
| 18 |
+
if theme == "Dark":
|
| 19 |
+
st.markdown(
|
| 20 |
+
"<style>body {background-color: #0E1117; color: #E6E1DC;} .stButton>button {background-color: #2563EB; color: white;}</style>",
|
| 21 |
+
unsafe_allow_html=True
|
| 22 |
+
)
|
| 23 |
|
| 24 |
if search_clicked and query:
|
| 25 |
dispatcher = Dispatcher()
|
| 26 |
|
| 27 |
+
# 1. Search for papers via MCP servers
|
| 28 |
+
papers = dispatcher.search_papers(query, limit=num_results)
|
| 29 |
render_paper_list(papers)
|
| 30 |
|
| 31 |
# 2. Show notebook for the first paper
|
|
|
|
| 34 |
notebook_cells = dispatcher.get_notebook_cells(first_id)
|
| 35 |
render_notebook(notebook_cells)
|
| 36 |
|
| 37 |
+
# 3. Visualize a knowledge graph for the paper
|
| 38 |
graph_data = dispatcher.get_graph(first_id)
|
| 39 |
render_graph(graph_data)
|
| 40 |
|