Spaces:
Running
Running
ryanrwatkins
commited on
Commit
•
68ac0c3
1
Parent(s):
2b0a4ff
Update app.py
Browse files
app.py
CHANGED
@@ -177,7 +177,8 @@ def submit_message(prompt, prompt_template, temperature, max_tokens, context_len
|
|
177 |
# https://colab.research.google.com/drive/1dzdNDZyofRB0f2KIB4gHXmIza7ehMX30?usp=sharing#scrollTo=b-ejDn_JfpWW
|
178 |
|
179 |
history.append(prompt_msg)
|
180 |
-
history.append(completion.
|
|
|
181 |
#history.append(completion["result"].choices[0].message.to_dict())
|
182 |
|
183 |
state['total_tokens'] += completion['usage']['total_tokens']
|
@@ -187,8 +188,8 @@ def submit_message(prompt, prompt_template, temperature, max_tokens, context_len
|
|
187 |
history.append("error")
|
188 |
|
189 |
total_tokens_used_msg = f"Total tokens used: {state['total_tokens']}"
|
190 |
-
|
191 |
-
chat_messages = [(history[0]['content'],history[1]['content'])]
|
192 |
return '', chat_messages, total_tokens_used_msg, state
|
193 |
|
194 |
def clear_conversation():
|
|
|
177 |
# https://colab.research.google.com/drive/1dzdNDZyofRB0f2KIB4gHXmIza7ehMX30?usp=sharing#scrollTo=b-ejDn_JfpWW
|
178 |
|
179 |
history.append(prompt_msg)
|
180 |
+
history.append(completion.to_dict())
|
181 |
+
#history.append(completion.choices[0].message.to_dict())
|
182 |
#history.append(completion["result"].choices[0].message.to_dict())
|
183 |
|
184 |
state['total_tokens'] += completion['usage']['total_tokens']
|
|
|
188 |
history.append("error")
|
189 |
|
190 |
total_tokens_used_msg = f"Total tokens used: {state['total_tokens']}"
|
191 |
+
chat_messages = [(history[i]['content'], history[i+1]['content']) for i in range(0, len(history)-1, 2)]
|
192 |
+
#chat_messages = [(history[0]['content'],history[1]['content'])]
|
193 |
return '', chat_messages, total_tokens_used_msg, state
|
194 |
|
195 |
def clear_conversation():
|