Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +29 -1
src/streamlit_app.py
CHANGED
|
@@ -2,7 +2,7 @@ import asyncio
|
|
| 2 |
import streamlit as st
|
| 3 |
from typing import Dict, Any, List
|
| 4 |
from agents import Agent, Runner, trace, set_default_openai_key
|
| 5 |
-
from
|
| 6 |
from agents.tool import function_tool
|
| 7 |
|
| 8 |
#Setup page configuration using streamlit
|
|
@@ -11,3 +11,31 @@ st.set_page_config(
|
|
| 11 |
page_icon = "",
|
| 12 |
layout = "wide"
|
| 13 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import streamlit as st
|
| 3 |
from typing import Dict, Any, List
|
| 4 |
from agents import Agent, Runner, trace, set_default_openai_key
|
| 5 |
+
from firecrawl import FirecrawlApp
|
| 6 |
from agents.tool import function_tool
|
| 7 |
|
| 8 |
#Setup page configuration using streamlit
|
|
|
|
| 11 |
page_icon = "",
|
| 12 |
layout = "wide"
|
| 13 |
)
|
| 14 |
+
|
| 15 |
+
if "openai_api_key" not in st.session_state:
|
| 16 |
+
st.session_state.openai_api_key = ""
|
| 17 |
+
if "firecrawl_api_key" not in st.session_state:
|
| 18 |
+
st.session_state.firecrawl_api_key = ""
|
| 19 |
+
|
| 20 |
+
with st.sidebar:
|
| 21 |
+
st.title("API Configuration")
|
| 22 |
+
openai_api_key = st.text_input(
|
| 23 |
+
"OpenAI API key",
|
| 24 |
+
value = st.session_state.openai_api_key,
|
| 25 |
+
type = "password"
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
firecrawl_api_key = st.text_input(
|
| 29 |
+
"OpenAI API key",
|
| 30 |
+
value = st.session_state.firecrawl_api_key,
|
| 31 |
+
type = "password"
|
| 32 |
+
)
|
| 33 |
+
|
| 34 |
+
if openai_api_key:
|
| 35 |
+
st.session_state.openai_api_key = openai_api_key
|
| 36 |
+
set_default_openai_key(openai_api_key)
|
| 37 |
+
if firecrawl_api_key:
|
| 38 |
+
st.session_state.firecrawl_api_key = firecrawl_api_key
|
| 39 |
+
set_default_openai_key(firecrawl_api_key)
|
| 40 |
+
|
| 41 |
+
|