Spaces:
Running
Running
修正newbing交互的不合理代码
Browse files
request_llm/bridge_newbing.py
CHANGED
@@ -88,14 +88,14 @@ class NewBingHandle(Process):
|
|
88 |
if a not in self.local_history:
|
89 |
self.local_history.append(a)
|
90 |
prompt += a + '\n'
|
91 |
-
if b not in self.local_history:
|
92 |
-
|
93 |
-
|
94 |
|
95 |
# 问题
|
96 |
prompt += question
|
97 |
self.local_history.append(question)
|
98 |
-
|
99 |
# 提交
|
100 |
async for final, response in self.newbing_model.ask_stream(
|
101 |
prompt=question,
|
@@ -108,7 +108,8 @@ class NewBingHandle(Process):
|
|
108 |
else:
|
109 |
print('-------- receive final ---------')
|
110 |
self.child.send('[Finish]')
|
111 |
-
|
|
|
112 |
|
113 |
def run(self):
|
114 |
"""
|
@@ -245,6 +246,6 @@ def predict(inputs, llm_kwargs, plugin_kwargs, chatbot, history=[], system_promp
|
|
245 |
chatbot[-1] = (inputs, preprocess_newbing_out(response))
|
246 |
yield from update_ui(chatbot=chatbot, history=history, msg="NewBing响应缓慢,尚未完成全部响应,请耐心完成后再提交新问题。")
|
247 |
|
248 |
-
history.extend([inputs,
|
249 |
yield from update_ui(chatbot=chatbot, history=history, msg="完成全部响应,请提交新问题。")
|
250 |
|
|
|
88 |
if a not in self.local_history:
|
89 |
self.local_history.append(a)
|
90 |
prompt += a + '\n'
|
91 |
+
# if b not in self.local_history:
|
92 |
+
# self.local_history.append(b)
|
93 |
+
# prompt += b + '\n'
|
94 |
|
95 |
# 问题
|
96 |
prompt += question
|
97 |
self.local_history.append(question)
|
98 |
+
print('question:', question)
|
99 |
# 提交
|
100 |
async for final, response in self.newbing_model.ask_stream(
|
101 |
prompt=question,
|
|
|
108 |
else:
|
109 |
print('-------- receive final ---------')
|
110 |
self.child.send('[Finish]')
|
111 |
+
# self.local_history.append(response)
|
112 |
+
|
113 |
|
114 |
def run(self):
|
115 |
"""
|
|
|
246 |
chatbot[-1] = (inputs, preprocess_newbing_out(response))
|
247 |
yield from update_ui(chatbot=chatbot, history=history, msg="NewBing响应缓慢,尚未完成全部响应,请耐心完成后再提交新问题。")
|
248 |
|
249 |
+
history.extend([inputs, response])
|
250 |
yield from update_ui(chatbot=chatbot, history=history, msg="完成全部响应,请提交新问题。")
|
251 |
|