Update app.py
Browse files
app.py
CHANGED
@@ -76,6 +76,17 @@ def respond(message, history):
|
|
76 |
response += token
|
77 |
yield response
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
chatbot = gr.ChatInterface(respond, type="messages")
|
80 |
|
81 |
|
|
|
76 |
response += token
|
77 |
yield response
|
78 |
|
79 |
+
if len(response) > char_limit:
|
80 |
+
response = response[:char_limit]
|
81 |
+
|
82 |
+
for punc in [".", "!", "?"]:
|
83 |
+
i = response.rfind(punc)
|
84 |
+
if i != -1:
|
85 |
+
response = response[:i+1]
|
86 |
+
break
|
87 |
+
|
88 |
+
yield response
|
89 |
+
|
90 |
chatbot = gr.ChatInterface(respond, type="messages")
|
91 |
|
92 |
|