Header changed

This commit is contained in:
0Xiao0
2024-05-30 11:25:57 +08:00
parent 381e0398f6
commit f61a9ad6e6

View File

@ -24,7 +24,7 @@ class Chat(Blackbox):
return isinstance(data, list)
# model_name有 Qwen1.5-14B-Chat , internlm2-chat-20b
@logging_time()
#@logging_time()
def processing(self, prompt: str, context: list, settings: dict) -> str:
if settings is None:
@ -121,11 +121,17 @@ class Chat(Blackbox):
url = 'https://api.openai.com/v1/completions'
# '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'
key = user_model_key
header = {
'Content-Type': 'application/json',
'Authorization': "Bearer " + key
}
# 自定义model
else:
url = user_model_url
key = user_model_key
header = {
'Content-Type': 'application/json',
}
prompt_template = [
@ -149,11 +155,6 @@ class Chat(Blackbox):
"stop": str(user_stop)
}
header = {
'Content-Type': 'application/json',
'Authorization': "Bearer " + key
}
fastchat_response = requests.post(url, json=chat_inputs, headers=header)
return fastchat_response.json()["choices"][0]["message"]["content"]