zhangtao
commited on
Commit
·
9012692
1
Parent(s):
cac3e6f
修复bug
Browse files
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 |
-
|
9 |
for human, assistant in history:
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
response = llm.create_chat_completion(
|
14 |
-
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 = ""
|