fix
Browse files
app.py
CHANGED
@@ -31,7 +31,7 @@ def get_prompt(user_query, system_prompt, messages="", sep="\n\n### "):
|
|
31 |
msgs = [": \n" + user_query, ": "]
|
32 |
if messages:
|
33 |
roles.insert(1, "ε
₯ε")
|
34 |
-
msgs.insert(1, ": \n" + "\n".join(message["content"] for message in messages))
|
35 |
|
36 |
for role, msg in zip(roles, msgs):
|
37 |
prompt += sep + role + msg
|
@@ -89,10 +89,10 @@ for message in st.session_state["messages"]:
|
|
89 |
if user_prompt := st.chat_input("θ³ͺεγιδΏ‘γγ¦γγ γγ"):
|
90 |
with st.chat_message("user"):
|
91 |
st.text(user_prompt)
|
|
|
92 |
token_kength = get_input_token_length(user_query=user_prompt, system_prompt=st.session_state["options"]["system_prompt"], messages=st.session_state["messages"])
|
93 |
response = f"{token_kength}: " + get_prompt(user_query=user_prompt, system_prompt=st.session_state["options"]["system_prompt"], messages=st.session_state["messages"])
|
94 |
with st.chat_message("assistant"):
|
95 |
st.text(response)
|
96 |
-
st.session_state["messages"].append({"role": "user", "content": user_prompt})
|
97 |
st.session_state["messages"].append({"role": "assistant", "content": response})
|
98 |
|
|
|
31 |
msgs = [": \n" + user_query, ": "]
|
32 |
if messages:
|
33 |
roles.insert(1, "ε
₯ε")
|
34 |
+
msgs.insert(1, ": \n" + "\n\n".join(message["content"] for message in messages))
|
35 |
|
36 |
for role, msg in zip(roles, msgs):
|
37 |
prompt += sep + role + msg
|
|
|
89 |
if user_prompt := st.chat_input("θ³ͺεγιδΏ‘γγ¦γγ γγ"):
|
90 |
with st.chat_message("user"):
|
91 |
st.text(user_prompt)
|
92 |
+
st.session_state["messages"].append({"role": "user", "content": user_prompt})
|
93 |
token_kength = get_input_token_length(user_query=user_prompt, system_prompt=st.session_state["options"]["system_prompt"], messages=st.session_state["messages"])
|
94 |
response = f"{token_kength}: " + get_prompt(user_query=user_prompt, system_prompt=st.session_state["options"]["system_prompt"], messages=st.session_state["messages"])
|
95 |
with st.chat_message("assistant"):
|
96 |
st.text(response)
|
|
|
97 |
st.session_state["messages"].append({"role": "assistant", "content": response})
|
98 |
|