В настоящее время я строю веб -сайт, который включает в себя чат -бот, и при вводе сообщений чата за ним стоит черная ящик, который охватывает часть моего фонового изображения. Есть ли способ удалить его? Я пытался найти его в Devtools, но это просто не работало. < /P>
Вот код, который я использую для этого < /p>
#import packages
from dotenv import load_dotenv
import openai
import streamlit as st
@st.cache_data
def get_response(user_prompt):
response = client.responses.create(
model = "gpt-4o", #Selects the model that you want to use (use the cheap one)
input = [ #List that keeps track of convo history as a list
{"role" : "user", "content": user_prompt} #Prompt
],
temperature = 0.7, #How creative the answer will get
max_output_tokens = 100 #Limit response length
)
return response
#Load enviroment variables from the .env file
load_dotenv()
#Initialize the OpenAI Client
client = openai.OpenAI()
title = st.empty()
subtitle = st.empty()
title.markdown("Hello There!", unsafe_allow_html=True)
subtitle.markdown("How can we help you?", unsafe_allow_html=True)
page_bg_image = """
[data-testid="stAppViewContainer"] {
background-image: url('https://snu.edu.in/site/assets/files/18543/gears-technological-elements-digital-blue-background-symbolizing-network-innovation-communication-3d-rendering.1600x0.webp');
background-size: cover;
}
[data-testid="stHeader"]{
background-color: rgba(0,0,0,0);
}
[data-testid="stBottomBlockContainer"] {
background: rgba(0,0,0,0);
}
"""
st.markdown(page_bg_image, unsafe_allow_html=True)
#Add a text input box for the user prompt
user_prompt = st.chat_input("Enter your prompt: ")
if user_prompt:
title.empty()
subtitle.empty()
st.chat_message("user").write(user_prompt)
with st.spinner("Generating response..."):
response = get_response(user_prompt)
#Print the response
st.chat_message("assistant").write(response.output[0].content[0].text)
В настоящее время я строю веб -сайт, который включает в себя чат -бот, и при вводе сообщений чата за ним стоит черная ящик, который охватывает часть моего фонового изображения. Есть ли способ удалить его? Я пытался найти его в Devtools, но это просто не работало. < /P> Вот код, который я использую для этого < /p> [code]#import packages from dotenv import load_dotenv import openai import streamlit as st
@st.cache_data def get_response(user_prompt): response = client.responses.create( model = "gpt-4o", #Selects the model that you want to use (use the cheap one) input = [ #List that keeps track of convo history as a list {"role" : "user", "content": user_prompt} #Prompt ], temperature = 0.7, #How creative the answer will get max_output_tokens = 100 #Limit response length ) return response #Load enviroment variables from the .env file load_dotenv()
#Initialize the OpenAI Client client = openai.OpenAI() title = st.empty() subtitle = st.empty() title.markdown("Hello There!", unsafe_allow_html=True) subtitle.markdown("How can we help you?", unsafe_allow_html=True) page_bg_image = """
""" st.markdown(page_bg_image, unsafe_allow_html=True) #Add a text input box for the user prompt user_prompt = st.chat_input("Enter your prompt: ") if user_prompt: title.empty() subtitle.empty() st.chat_message("user").write(user_prompt) with st.spinner("Generating response..."): response = get_response(user_prompt) #Print the response st.chat_message("assistant").write(response.output[0].content[0].text) [/code]