Spaces:
Running
on
Zero
Running
on
Zero
Update multipurpose_chatbot/demos/chat_interface.py
Browse files
multipurpose_chatbot/demos/chat_interface.py
CHANGED
@@ -110,8 +110,14 @@ def format_conversation(history, system_prompt=None):
|
|
110 |
)
|
111 |
for h in history
|
112 |
])
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
if system_prompt is not None:
|
114 |
-
_str = f"<<<
|
115 |
return _str
|
116 |
|
117 |
|
@@ -153,6 +159,8 @@ def chat_response_stream_multiturn_engine(
|
|
153 |
else:
|
154 |
response, num_tokens = outputs, -1
|
155 |
yield response, num_tokens
|
|
|
|
|
156 |
|
157 |
if response is not None:
|
158 |
yield response, num_tokens
|
|
|
110 |
)
|
111 |
for h in history
|
112 |
])
|
113 |
+
_str = ""
|
114 |
+
for mes, res in history:
|
115 |
+
if mes is not None:
|
116 |
+
_str += f'<<<User>>> {mes}\n'
|
117 |
+
if res is not None:
|
118 |
+
_str += f'<<<Asst>>> {res}\n'
|
119 |
if system_prompt is not None:
|
120 |
+
_str = f"<<<Syst>>> {system_prompt}\n" + _str
|
121 |
return _str
|
122 |
|
123 |
|
|
|
159 |
else:
|
160 |
response, num_tokens = outputs, -1
|
161 |
yield response, num_tokens
|
162 |
+
|
163 |
+
print(format_conversation(history + [[message, response]]))
|
164 |
|
165 |
if response is not None:
|
166 |
yield response, num_tokens
|