mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-22 08:07:56 +01:00
Fix the impersonate response role
This commit is contained in:
parent
34b493b231
commit
38b3daad55
@ -371,6 +371,7 @@ def chat_completions_common(body: dict, is_legacy: bool = False, stream=False, p
|
|||||||
|
|
||||||
yield chunk
|
yield chunk
|
||||||
else:
|
else:
|
||||||
|
role = 'user' if impersonate else 'assistant'
|
||||||
resp = {
|
resp = {
|
||||||
"id": cmpl_id,
|
"id": cmpl_id,
|
||||||
"object": object_type,
|
"object": object_type,
|
||||||
@ -379,7 +380,7 @@ def chat_completions_common(body: dict, is_legacy: bool = False, stream=False, p
|
|||||||
resp_list: [{
|
resp_list: [{
|
||||||
"index": 0,
|
"index": 0,
|
||||||
"finish_reason": stop_reason,
|
"finish_reason": stop_reason,
|
||||||
"message": {"role": "assistant", "content": answer}
|
"message": {"role": role, "content": answer}
|
||||||
}],
|
}],
|
||||||
"usage": {
|
"usage": {
|
||||||
"prompt_tokens": token_count,
|
"prompt_tokens": token_count,
|
||||||
|
Loading…
Reference in New Issue
Block a user