另外一种方式实现ipadder

This commit is contained in:
w_xiaolizu
2023-04-19 19:34:31 +08:00
parent ee73573655
commit fe6850a0bb
2 changed files with 11 additions and 6 deletions

View File

@ -27,7 +27,7 @@ def ArgsGeneralWrapper(f):
"""
装饰器函数,用于重组输入参数,改变输入参数的顺序与结构。
"""
def decorated(cookies, max_length, llm_model, txt, txt2, top_p, temperature, chatbot, history, system_prompt, *args):
def decorated(cookies, max_length, llm_model, txt, top_p, temperature, chatbot, history, system_prompt, models, ipaddr:gr.Request, *args):
txt_passon = txt
if 'input加密' in models: txt_passon = func_box.encryption_str(txt)
# 引入一个有cookie的chatbot
@ -40,14 +40,14 @@ def ArgsGeneralWrapper(f):
'llm_model': llm_model,
'top_p':top_p,
'max_length': max_length,
'temperature':temperature,
'temperature': temperature,
'ipaddr': ipaddr.client.host
}
plugin_kwargs = {
# 目前还没有
}
chatbot_with_cookie = ChatBotWithCookies(cookies)
chatbot_with_cookie.write_list(chatbot)
# logging.info(f'[user_click]_{adder.client.host} {txt_passon} ----')
yield from f(txt_passon, llm_kwargs, plugin_kwargs, chatbot_with_cookie, history, system_prompt, *args)
return decorated