''' ''' ##TODO: 1. 转换成Qwen的API。 2. import time import os import pandas as pd import streamlit as st from code_editor import code_editor # from utils.setup import setup_connexion, setup_session_state # from utils.vanna_calls import ( # generate_questions_cached, # generate_sql_cached, # run_sql_cached, # generate_plotly_code_cached, # generate_plot_cached, # generate_followup_cached, # ) # import chatsql003 ### 本地ChatGLT 版本。 import chatsql004 ###Qwen API 版本。 import sql_command # from streamlit_pandas_profiling import st_profile_report import dashscope from dotenv import load_dotenv load_dotenv() ### 设置openai的API key dashscope.api_key = os.environ['dashscope_api_key'] st.set_page_config(layout="wide", page_icon="🧩", page_title="本地化国产大模型数据库查询演示") # setup_connexion() def clear_all(): st.session_state.conversation = None st.session_state.chat_history = None st.session_state.messages = [] message_placeholder = st.empty() st.session_state["my_question"] = None return None ## 原始的控制面板 # st.sidebar.title("大模型控制面板") # st.sidebar.checkbox("Show SQL", value=True, key="show_sql") # st.sidebar.checkbox("Show Table", value=True, key="show_table") # st.sidebar.checkbox("Show Plotly Code", value=True, key="show_plotly_code") # st.sidebar.checkbox("Show Chart", value=True, key="show_chart") # st.sidebar.checkbox("Show Follow-up Questions", value=True, key="show_followup") # st.sidebar.button("清除记录,重启一轮新对话", on_click=setup_session_state, use_container_width=True, type='primary') st.title("本地化国产大模型数据库查询演示") # st.title("大语言模型SQL数据库查询中心") # st.info("声明:内容由人工智能生成,仅供参考。如果您本人使用或对外传播本服务生成的输出,您应当主动核查输出内容的真实性、准确性,避免传播虚假信息。") ## 颜色比较明显。 st.markdown("_声明:内容由人工智能生成,仅供参考。如果您本人使用或对外传播本服务生成的输出,您应当主动核查输出内容的真实性、准确性,避免传播虚假信息。_") ### Streamlit Sidebar 左侧工具栏 # st.sidebar.write(st.session_state) with st.sidebar: st.markdown( """