zhangtao commited on
Commit
9012692
·
1 Parent(s): cac3e6f
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -5,13 +5,13 @@ llm = Llama(model_path="./neuralhermes-2.5-mistral-7b.Q5_K_M.gguf",
5
 
6
 
7
  def chat_completion(messages, history, system_prompt):
8
- messages = [{"role": "system", "content": system_prompt}]
9
  for human, assistant in history:
10
- messages.append({"role": "user", "content": human })
11
- messages.append({"role": "assistant", "content":assistant})
12
- messages.append({"role": "user", "content": messages})
13
  response = llm.create_chat_completion(
14
- messages=messages,
15
  stream=True
16
  )
17
  partial_message = ""
 
5
 
6
 
7
  def chat_completion(messages, history, system_prompt):
8
+ messages_prompts = [{"role": "system", "content": system_prompt}]
9
  for human, assistant in history:
10
+ messages_prompts.append({"role": "user", "content": human })
11
+ messages_prompts.append({"role": "assistant", "content":assistant})
12
+ messages_prompts.append({"role": "user", "content": messages})
13
  response = llm.create_chat_completion(
14
+ messages=messages_prompts,
15
  stream=True
16
  )
17
  partial_message = ""