主题
python
import streamlit as st
@st.dialog("请输入Api Key")
def enter_apiKey():
apiKey = st.text_input("Api Key...")
if st.button("提交"):
st.session_state.apiKey = apiKey
st.rerun()
question = st.text_input("主题/问题?")
if st.button("生成"):
if not "apiKey" in st.session_state.keys():
enter_apiKey()
st.stop()
if question == "":
st.error("请输入问题")
st.stop()