deals with thoughtstepsdisplay now
Browse files- app/app.py +9 -16
app/app.py
CHANGED
|
@@ -64,36 +64,29 @@ def main():
|
|
| 64 |
with st.chat_message(message.role):
|
| 65 |
|
| 66 |
for thought in message.thoughts:
|
| 67 |
-
print_thought(thought
|
| 68 |
|
| 69 |
if message.content:
|
| 70 |
if message.role == 'user':
|
| 71 |
st.markdown(message.content)
|
| 72 |
else:
|
| 73 |
-
print_thought(message.content
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
-
if
|
| 78 |
-
big_message_attr.append(BigMessage(role="user", content=
|
| 79 |
|
| 80 |
with st.chat_message("user"):
|
| 81 |
-
st.markdown(
|
| 82 |
|
| 83 |
with st.chat_message("assistant"):
|
| 84 |
-
messages = [{
|
| 85 |
-
"role": "system",
|
| 86 |
-
"content": SYSTEM_PROMPT
|
| 87 |
-
}]
|
| 88 |
|
| 89 |
-
messages += [m.to_message() for m in big_message_attr]
|
| 90 |
|
| 91 |
thoughts = []
|
|
|
|
| 92 |
|
| 93 |
-
#add json keyword in user message , helps in json output
|
| 94 |
-
for message in messages:
|
| 95 |
-
if message["role"] == "user":
|
| 96 |
-
message["content"] = f"{message['content']}, json format"
|
| 97 |
|
| 98 |
start_time = time.time()
|
| 99 |
|
|
@@ -115,7 +108,7 @@ def main():
|
|
| 115 |
|
| 116 |
thoughts.append(step)
|
| 117 |
|
| 118 |
-
st.write(step.
|
| 119 |
# add breakline after each step
|
| 120 |
st.markdown('---')
|
| 121 |
status.update(label=step.step_title, state="running", expanded=False)
|
|
@@ -126,7 +119,7 @@ def main():
|
|
| 126 |
)
|
| 127 |
|
| 128 |
last_step = thoughts.pop()
|
| 129 |
-
print_thought(last_step
|
| 130 |
|
| 131 |
big_message_attr.append(BigMessage(
|
| 132 |
role="assistant",
|
|
|
|
| 64 |
with st.chat_message(message.role):
|
| 65 |
|
| 66 |
for thought in message.thoughts:
|
| 67 |
+
print_thought(thought, is_final=False)
|
| 68 |
|
| 69 |
if message.content:
|
| 70 |
if message.role == 'user':
|
| 71 |
st.markdown(message.content)
|
| 72 |
else:
|
| 73 |
+
print_thought(message.content, is_final=True)
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
+
if user_input := st.chat_input("What is up bro?"):
|
| 78 |
+
big_message_attr.append(BigMessage(role="user", content=user_input, thoughts=[]))
|
| 79 |
|
| 80 |
with st.chat_message("user"):
|
| 81 |
+
st.markdown(user_input)
|
| 82 |
|
| 83 |
with st.chat_message("assistant"):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
|
|
|
| 85 |
|
| 86 |
thoughts = []
|
| 87 |
+
messages = [message.to_message() for message in big_message_attr]
|
| 88 |
|
| 89 |
+
messages[-1]['content'] += ", json format" #add json keyword in user message , helps in json output
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |
start_time = time.time()
|
| 92 |
|
|
|
|
| 108 |
|
| 109 |
thoughts.append(step)
|
| 110 |
|
| 111 |
+
st.write(step.md())
|
| 112 |
# add breakline after each step
|
| 113 |
st.markdown('---')
|
| 114 |
status.update(label=step.step_title, state="running", expanded=False)
|
|
|
|
| 119 |
)
|
| 120 |
|
| 121 |
last_step = thoughts.pop()
|
| 122 |
+
print_thought(last_step, is_final=True)
|
| 123 |
|
| 124 |
big_message_attr.append(BigMessage(
|
| 125 |
role="assistant",
|