Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -152,11 +152,16 @@ def merlin_chat(message, history):
|
|
152 |
#start = cleanStr.find('{')
|
153 |
#if start<=0:
|
154 |
# continue
|
155 |
-
end = cleanStr.find('
|
156 |
if end<=0:
|
157 |
continue
|
158 |
cleanStr = cleanStr[:end]
|
159 |
-
|
|
|
|
|
|
|
|
|
|
|
160 |
return "🤔"
|
161 |
|
162 |
gr.ChatInterface(merlin_chat).launch()
|
|
|
152 |
#start = cleanStr.find('{')
|
153 |
#if start<=0:
|
154 |
# continue
|
155 |
+
end = cleanStr.find('}') + 1
|
156 |
if end<=0:
|
157 |
continue
|
158 |
cleanStr = cleanStr[:end]
|
159 |
+
messageStr = prompt + cleanStr + ']'
|
160 |
+
messages = json.loads(messageStr)
|
161 |
+
message = messages[-1]
|
162 |
+
if message['role'] != 'assistant':
|
163 |
+
continue
|
164 |
+
return message['content']
|
165 |
return "🤔"
|
166 |
|
167 |
gr.ChatInterface(merlin_chat).launch()
|