Spaces:
Build error
Build error
Commit ·
df01697
1
Parent(s): 86bc5e3
Update app.py
Browse files
app.py
CHANGED
|
@@ -111,10 +111,10 @@ The process for the bot is as follows:
|
|
| 111 |
- Tell them you want the FREE Verizon 300 mbps plan.
|
| 112 |
|
| 113 |
|
| 114 |
-
RETURN ALL YOUR MESSAGES INCLUDING IMAGES AS MARKDOWN:
|
| 115 |
"""
|
| 116 |
import os
|
| 117 |
-
openai.api_key =
|
| 118 |
|
| 119 |
if "openai_model" not in st.session_state:
|
| 120 |
st.session_state["openai_model"] = "gpt-4"
|
|
@@ -122,7 +122,7 @@ if "openai_model" not in st.session_state:
|
|
| 122 |
if "messages" not in st.session_state:
|
| 123 |
st.session_state.messages = [{"role": "assistant", "content": """Hello, I am Steady Bot, I am here to guide you through the process of saving on your internet bill! According to my information looks like your provider is Verizon, lets get started!
|
| 124 |
"""}]
|
| 125 |
-
|
| 126 |
|
| 127 |
|
| 128 |
for message in st.session_state.messages:
|
|
@@ -134,19 +134,20 @@ if prompt := st.chat_input("What is up?"):
|
|
| 134 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
| 135 |
with st.chat_message("user"):
|
| 136 |
st.markdown(prompt)
|
| 137 |
-
|
| 138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
message_placeholder = st.empty()
|
| 140 |
full_response = ""
|
| 141 |
for response in openai.ChatCompletion.create(
|
| 142 |
model=st.session_state["openai_model"],
|
| 143 |
-
messages=
|
| 144 |
-
{"role": m["role"], "content": m["content"]}
|
| 145 |
-
for m in st.session_state.messages
|
| 146 |
-
],
|
| 147 |
stream=True,
|
| 148 |
):
|
| 149 |
full_response += response.choices[0].delta.get("content", "")
|
| 150 |
message_placeholder.markdown(full_response + "▌")
|
| 151 |
message_placeholder.markdown(full_response)
|
| 152 |
-
st.session_state.messages.append({"role": "
|
|
|
|
| 111 |
- Tell them you want the FREE Verizon 300 mbps plan.
|
| 112 |
|
| 113 |
|
| 114 |
+
RETURN ALL YOUR MESSAGES INCLUDING IMAGES AS MARKDOWN (including html):
|
| 115 |
"""
|
| 116 |
import os
|
| 117 |
+
openai.api_key = "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"
|
| 118 |
|
| 119 |
if "openai_model" not in st.session_state:
|
| 120 |
st.session_state["openai_model"] = "gpt-4"
|
|
|
|
| 122 |
if "messages" not in st.session_state:
|
| 123 |
st.session_state.messages = [{"role": "assistant", "content": """Hello, I am Steady Bot, I am here to guide you through the process of saving on your internet bill! According to my information looks like your provider is Verizon, lets get started!
|
| 124 |
"""}]
|
| 125 |
+
|
| 126 |
|
| 127 |
|
| 128 |
for message in st.session_state.messages:
|
|
|
|
| 134 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
| 135 |
with st.chat_message("user"):
|
| 136 |
st.markdown(prompt)
|
| 137 |
+
messages=[
|
| 138 |
+
{"role": m["role"], "content": m["content"]}
|
| 139 |
+
for m in st.session_state.messages
|
| 140 |
+
]
|
| 141 |
+
messages.append({"role": "system", "content": system_messages})
|
| 142 |
+
with st.chat_message("Steady"):
|
| 143 |
message_placeholder = st.empty()
|
| 144 |
full_response = ""
|
| 145 |
for response in openai.ChatCompletion.create(
|
| 146 |
model=st.session_state["openai_model"],
|
| 147 |
+
messages=messages,
|
|
|
|
|
|
|
|
|
|
| 148 |
stream=True,
|
| 149 |
):
|
| 150 |
full_response += response.choices[0].delta.get("content", "")
|
| 151 |
message_placeholder.markdown(full_response + "▌")
|
| 152 |
message_placeholder.markdown(full_response)
|
| 153 |
+
st.session_state.messages.append({"role": "Steady", "content": full_response})
|