Xolkin commited on
Commit
b2d69ec
·
verified ·
1 Parent(s): 213e053

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -11,11 +11,11 @@ def respond(
11
  temperature,
12
  top_p,
13
  ):
14
- # Send a default greeting message if the chat history is empty
15
  if not history:
16
  greeting = "Привет, помощник врача EMS штата Alta."
17
  history.append((None, greeting))
18
- yield greeting
19
 
20
  messages = [{"role": "system", "content": system_message}]
21
 
@@ -41,9 +41,9 @@ def respond(
41
  response += token
42
  yield response
43
  except Exception as e:
44
- yield f"An error occurred: {e}"
45
 
46
- # Highlight the diagnosis in bold
47
  diagnosis_start = response.find("Предварительный диагноз:")
48
  if diagnosis_start != -1:
49
  diagnosis_end = response.find("\n", diagnosis_start)
@@ -52,7 +52,7 @@ def respond(
52
  diagnosis = response[diagnosis_start:diagnosis_end]
53
  response = response[:diagnosis_start] + f"<b>{diagnosis}</b>" + response[diagnosis_end:]
54
 
55
- # Add an identification message to the response
56
  final_response = f"{response}\n\nСоздано больницей EMS штата Alta"
57
  yield final_response
58
 
 
11
  temperature,
12
  top_p,
13
  ):
14
+ # Отправляем приветственное сообщение, если история пуста
15
  if not history:
16
  greeting = "Привет, помощник врача EMS штата Alta."
17
  history.append((None, greeting))
18
+ return history, greeting
19
 
20
  messages = [{"role": "system", "content": system_message}]
21
 
 
41
  response += token
42
  yield response
43
  except Exception as e:
44
+ yield f"Произошла ошибка: {e}"
45
 
46
+ # Выделяем предварительный диагноз жирным шрифтом
47
  diagnosis_start = response.find("Предварительный диагноз:")
48
  if diagnosis_start != -1:
49
  diagnosis_end = response.find("\n", diagnosis_start)
 
52
  diagnosis = response[diagnosis_start:diagnosis_end]
53
  response = response[:diagnosis_start] + f"<b>{diagnosis}</b>" + response[diagnosis_end:]
54
 
55
+ # Добавляем идентификационное сообщение к ответу
56
  final_response = f"{response}\n\nСоздано больницей EMS штата Alta"
57
  yield final_response
58