Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -62,11 +62,16 @@ def stream_chat(
|
|
62 |
print(f'history: {history}')
|
63 |
|
64 |
conversation = []
|
65 |
-
for prompt, answer in history:
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
70 |
conversation.append(UserMessage(content=message))
|
71 |
|
72 |
print(f'history: {conversation}')
|
@@ -96,7 +101,7 @@ with gr.Blocks(theme="citrus", css=CSS) as demo:
|
|
96 |
fn=stream_chat,
|
97 |
title="Mistral-lab",
|
98 |
chatbot=chatbot,
|
99 |
-
|
100 |
fill_height=True,
|
101 |
examples=[
|
102 |
["Help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option."],
|
|
|
62 |
print(f'history: {history}')
|
63 |
|
64 |
conversation = []
|
65 |
+
# for prompt, answer in history:
|
66 |
+
# conversation.append(UserMessage(content=prompt))
|
67 |
+
# conversation.append(AssistantMessage(content=answer))
|
68 |
+
|
69 |
+
for item in history:
|
70 |
+
if item[role] == "user":
|
71 |
+
conversation.append(UserMessage(content=item[content]))
|
72 |
+
elif item[role] == "assistant":
|
73 |
+
conversation.append(AssistantMessage(content=item[content]))
|
74 |
+
|
75 |
conversation.append(UserMessage(content=message))
|
76 |
|
77 |
print(f'history: {conversation}')
|
|
|
101 |
fn=stream_chat,
|
102 |
title="Mistral-lab",
|
103 |
chatbot=chatbot,
|
104 |
+
type="messages",
|
105 |
fill_height=True,
|
106 |
examples=[
|
107 |
["Help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option."],
|