zhangtao commited on
Commit
cac3e6f
·
1 Parent(s): e7850f4

修改history格式

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -6,7 +6,9 @@ llm = Llama(model_path="./neuralhermes-2.5-mistral-7b.Q5_K_M.gguf",
6
 
7
  def chat_completion(messages, history, system_prompt):
8
  messages = [{"role": "system", "content": system_prompt}]
9
- messages.extend(history)
 
 
10
  messages.append({"role": "user", "content": messages})
11
  response = llm.create_chat_completion(
12
  messages=messages,
 
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,