Merge branch 'main' into feat-node-expand
This commit is contained in:
commit
9e9c0bdd96
1 changed files with 2 additions and 5 deletions
|
|
@ -123,21 +123,18 @@ async def openai_complete_if_cache(
|
||||||
|
|
||||||
async def inner():
|
async def inner():
|
||||||
try:
|
try:
|
||||||
_content = ""
|
|
||||||
async for chunk in response:
|
async for chunk in response:
|
||||||
content = chunk.choices[0].delta.content
|
content = chunk.choices[0].delta.content
|
||||||
if content is None:
|
if content is None:
|
||||||
continue
|
continue
|
||||||
if r"\u" in content:
|
if r"\u" in content:
|
||||||
content = safe_unicode_decode(content.encode("utf-8"))
|
content = safe_unicode_decode(content.encode("utf-8"))
|
||||||
_content += content
|
yield content
|
||||||
return _content
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error in stream response: {str(e)}")
|
logger.error(f"Error in stream response: {str(e)}")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
response_content = await inner()
|
return inner()
|
||||||
return response_content
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue