Update app.py
Browse files
app.py
CHANGED
|
@@ -34,10 +34,13 @@ def respond(
|
|
| 34 |
token = message.choices[0].delta.content
|
| 35 |
response += token
|
| 36 |
|
| 37 |
-
#
|
| 38 |
if "Предварительный диагноз" in response:
|
| 39 |
-
#
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
return response
|
| 43 |
|
|
|
|
| 34 |
token = message.choices[0].delta.content
|
| 35 |
response += token
|
| 36 |
|
| 37 |
+
# Как только получаем информацию о диагнозе и операции, мы ограничиваем ответ
|
| 38 |
if "Предварительный диагноз" in response:
|
| 39 |
+
# Обрабатываем ответ в нужном формате
|
| 40 |
+
formatted_response = response.strip().split("\n")
|
| 41 |
+
if len(formatted_response) >= 3:
|
| 42 |
+
# Применяем формат
|
| 43 |
+
return "\n".join(formatted_response[:3])
|
| 44 |
|
| 45 |
return response
|
| 46 |
|