修改页面布局|增加访问者ip打印

This commit is contained in:
w_xiaolizu
2023-04-19 09:52:03 +08:00
parent aebd48bc84
commit de2ad563ef
5 changed files with 259 additions and 15 deletions

View File

@ -90,7 +90,7 @@ async def run(context, max_token=512):
def predict_tgui(inputs, top_p, temperature, chatbot, history=[], system_prompt='', stream = True, additional_fn=None):
def predict_tgui(inputs, top_p, temperature, chatbot, history=[], system_prompt='', ipaddr='', stream = True, additional_fn=None):
"""
发送至chatGPT流式获取输出。
用于基础的对话功能。
@ -108,7 +108,7 @@ def predict_tgui(inputs, top_p, temperature, chatbot, history=[], system_prompt=
inputs = core_functional[additional_fn]["Prefix"] + inputs + core_functional[additional_fn]["Suffix"]
raw_input = "What I would like to say is the following: " + inputs
logging.info(f'[raw_input] {raw_input}')
logging.info(f'[raw_input]_{ipaddr} {raw_input}')
history.extend([inputs, ""])
chatbot.append([inputs, ""])
yield from update_ui(chatbot=chatbot, history=history, msg="等待响应") # 刷新界面
@ -140,7 +140,7 @@ def predict_tgui(inputs, top_p, temperature, chatbot, history=[], system_prompt=
chatbot[-1] = (history[-2], history[-1])
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
logging.info(f'[response] {tgui_say}')
logging.info(f'[response]_{ipaddr} {tgui_say}')