Yingxu He commited on
Commit
3c8df2b
·
verified ·
1 Parent(s): d706b38

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +14 -3
handler.py CHANGED
@@ -21,13 +21,24 @@ class EndpointHandler:
21
  parameters = data.pop("parameters", None)
22
 
23
  str_messages = inputs.split(TURN_BREAKER)
24
- cpp_messages = [chatglm_cpp.ChatMessage(role="system", content=str_messages[0].replace(SYSTEM_SYMBOL))]
 
 
 
25
 
26
  for msg in str_messages[1:]:
27
  if USER_SYMBOL in msg:
28
- cpp_messages.append(chatglm_cpp.ChatMessage(role="user", content=msg.replace(USER_SYMBOL)))
 
 
 
 
29
  else:
30
- cpp_messages.append(chatglm_cpp.ChatMessage(role="assistant", content=msg.replace(ASSISTANT_SYMBOL)))
 
 
 
 
31
 
32
  # pass inputs with all kwargs in data
33
  if parameters is not None:
 
21
  parameters = data.pop("parameters", None)
22
 
23
  str_messages = inputs.split(TURN_BREAKER)
24
+ cpp_messages = [chatglm_cpp.ChatMessage(
25
+ role="system",
26
+ content=str_messages[0].replace(SYSTEM_SYMBOL, "")
27
+ )]
28
 
29
  for msg in str_messages[1:]:
30
  if USER_SYMBOL in msg:
31
+ cpp_messages.append(
32
+ chatglm_cpp.ChatMessage(
33
+ role="user",
34
+ content=msg.replace(USER_SYMBOL, "")
35
+ ))
36
  else:
37
+ cpp_messages.append(
38
+ chatglm_cpp.ChatMessage(
39
+ role="assistant",
40
+ content=msg.replace(ASSISTANT_SYMBOL, "")
41
+ ))
42
 
43
  # pass inputs with all kwargs in data
44
  if parameters is not None: