Skip to content

Commit 9931d65

Browse files
authored
fix (#7992)
1 parent 2edcd08 commit 9931d65

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llm/gradio_ui.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ def infer(utterance, state, top_k, top_p, temperature, repetition_penalty, max_l
109109

110110
data = {
111111
"context": utterance,
112-
"history": json.dumps(context),
113112
"top_k": top_k,
114113
"top_p": top_p,
115114
"temperature": temperature,
@@ -118,6 +117,9 @@ def infer(utterance, state, top_k, top_p, temperature, repetition_penalty, max_l
118117
"src_length": src_length,
119118
"min_length": 1,
120119
}
120+
if len(context) > 2:
121+
data["history"] = json.dumps(context[:-2])
122+
121123
res = requests.post(f"http://0.0.0.0:{args.flask_port}/api/chat", json=data, stream=True)
122124
for index, line in enumerate(res.iter_lines()):
123125
result = json.loads(line)

0 commit comments

Comments
 (0)