File size: 1,034 Bytes
7bd5533
ee233a4
 
7bd5533
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File: app.py
import streamlit as st

from orchestrator.dispatcher import Dispatcher
from components.sidebar import render_sidebar
from components.paper_list import render_paper_list
from components.notebook_view import render_notebook
from components.graph_view import render_graph


def main():
    st.set_page_config(page_title="AI Research Companion", layout="wide")

    # Render sidebar and get user inputs
    query, search_clicked = render_sidebar()

    if search_clicked and query:
        dispatcher = Dispatcher()

        # 1. Search papers
        papers = dispatcher.search_papers(query)
        render_paper_list(papers)

        # 2. Show notebook for the first paper
        if papers:
            first_id = papers[0]["id"]
            notebook_cells = dispatcher.get_notebook_cells(first_id)
            render_notebook(notebook_cells)

            # 3. Visualize knowledge graph
            graph_data = dispatcher.get_graph(first_id)
            render_graph(graph_data)


if __name__ == "__main__":
    main()