43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
import streamlit as st
|
|
from dotenv import load_dotenv
|
|
from api import fetch_okrs
|
|
from utils import construct_prompt, extract_llm_response
|
|
from styles import apply_styles
|
|
from config import SYSTEM_PROMPT, INPUT_TEMPLATE
|
|
|
|
# Load environment variables
|
|
load_dotenv()
|
|
|
|
# Apply custom styles
|
|
apply_styles()
|
|
|
|
# Streamlit App Layout
|
|
st.title("OKR Generator")
|
|
st.subheader("Enter your idea or goal:")
|
|
|
|
user_input = st.text_area(
|
|
"Input your idea here:",
|
|
value=st.session_state.get("user_input", INPUT_TEMPLATE.strip()),
|
|
height=200,
|
|
)
|
|
|
|
if st.button("Generate OKRs"):
|
|
if not user_input.strip():
|
|
st.warning("Please provide some input before generating OKRs.")
|
|
else:
|
|
with st.spinner("Generating OKRs..."):
|
|
prompt = construct_prompt(user_input)
|
|
response = fetch_okrs(prompt=prompt, system_prompt=SYSTEM_PROMPT)
|
|
if response:
|
|
objective, key_results = extract_llm_response(response)
|
|
st.session_state["objective"] = objective
|
|
st.session_state["key_results"] = key_results
|
|
|
|
if "objective" in st.session_state:
|
|
st.subheader("Proposal Objective:")
|
|
st.write(st.session_state["objective"])
|
|
|
|
st.subheader("Proposal Key Results:")
|
|
for kr in st.session_state["key_results"]:
|
|
st.write(kr)
|