File size: 929 Bytes
60f5b9f
5206fbb
9dddd1e
e84256c
 
9dddd1e
e84256c
 
 
5206fbb
 
 
 
 
16d3fdf
eb0ed9e
9163cdf
4b20003
 
9163cdf
ada0a19
9163cdf
bef36b3
5206fbb
 
 
1500cdd
 
5206fbb
bef36b3
1500cdd
0c0e0a0
bef36b3
ada0a19
5206fbb
bc723d2
5206fbb
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
38
# pylint: disable=invalid-name
""" A Streamlit app for GnosisPages. """
import os
from pathlib import Path

import openai
import streamlit as st
from dotenv import load_dotenv

from gnosis.chroma_client import ChromaDB
import gnosis.gui_messages as gm
from gnosis import settings
from gnosis.components.sidebar import sidebar
from gnosis.components.main import main

load_dotenv(Path(__file__).parent / ".env")

openai.api_key = os.getenv("OPENAI_API_KEY")

if "api_message" not in st.session_state:
    st.session_state.api_message = gm.api_message(openai.api_key)


if "wk_button" not in st.session_state:
    st.session_state.wk_button = False

if "chroma_db" not in st.session_state:
    st.session_state.chroma_db = ChromaDB(openai.api_key)

# Build settings
chroma_db = st.session_state.chroma_db
collection = settings.build(chroma_db)

# Sidebar
sidebar(chroma_db, collection)

main(openai.api_key, chroma_db, collection)