Skip to content

Commit

Permalink
Update weipu api
Browse files Browse the repository at this point in the history
  • Loading branch information
w5688414 committed Feb 22, 2024
1 parent 4aca819 commit ddceb1e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions erniebot-agent/src/erniebot_agent/chat_models/erniebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,10 @@ def convert_response_to_output(response: ChatCompletionResponse, output_type: Ty
)
else:
return output_type(
content=response.result,
content=response.rbody,
function_call=None,
plugin_info=None,
search_info=None,
token_usage=response.usage,
token_usage=None,
clarify=clarify,
)
5 changes: 3 additions & 2 deletions erniebot/src/erniebot/backends/aistudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async def arequest(

@classmethod
def handle_response(cls, resp: EBResponse) -> EBResponse:
if resp["errorCode"] != 0:
if "errorCode" in resp and resp["errorCode"] != 0:
ecode = resp["errorCode"]
emsg = resp["errorMsg"]
if ecode in (4, 17):
Expand All @@ -117,5 +117,6 @@ def _add_aistudio_fields_to_headers(self, headers: HeadersType) -> HeadersType:
"Key 'Authorization' already exists in `headers`: %r",
headers["Authorization"],
)
headers["Authorization"] = f"token {self._access_token}"
# headers["Authorization"] = f"token {self._access_token}"
headers["Authorization"] = f"{self._access_token}"
return headers

0 comments on commit ddceb1e

Please sign in to comment.