Skip to content

Commit

Permalink
solve customized OpenAIVision model api_host issue (#1125)
Browse files Browse the repository at this point in the history
  • Loading branch information
vc12345679 authored Jun 19, 2024
1 parent 8a2fd56 commit b9a5bca
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions modules/models/OpenAIVision.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,10 @@ def _get_response(self, stream=False):
else:
timeout = TIMEOUT_ALL

# 如果有自定义的api-host,使用自定义host发送请求,否则使用默认设置发送请求
if shared.state.chat_completion_url != CHAT_COMPLETION_URL:
logging.debug(f"使用自定义API URL: {shared.state.chat_completion_url}")

with retrieve_proxy():
try:
response = requests.post(
shared.state.chat_completion_url,
self.chat_completion_url,
headers=headers,
json=payload,
stream=stream,
Expand Down Expand Up @@ -282,13 +278,10 @@ def _single_query_at_once(self, history, temperature=1.0):
"model": self.model_name,
"messages": history,
}
# 如果有自定义的api-host,使用自定义host发送请求,否则使用默认设置发送请求
if shared.state.chat_completion_url != CHAT_COMPLETION_URL:
logging.debug(f"使用自定义API URL: {shared.state.chat_completion_url}")

with retrieve_proxy():
response = requests.post(
shared.state.chat_completion_url,
self.chat_completion_url,
headers=headers,
json=payload,
stream=False,
Expand Down

0 comments on commit b9a5bca

Please sign in to comment.