answer = ""
with httpx.stream("POST", url, headers=headers, data=payload) as r:
for text in r.iter_text():
response_parse_text = await parse_text(text)
text_res = ""
if response_parse_text:
for text in response_parse_text:
text_res += text
answer = ''.join(text_res)
print(answer)
yield answer
I was testing the streaming output results and found that you need to add a async method right behind the yeild in the async function. for example:
yield answer
await asyncio.sleep(0)
Otherwise the function will be blocked until all the streaming data are received. There are two ways to solve it:
make the async def stream_message sync,
Add a async method below the yield.
I have no idea make this happen, if you figure it out what is happening, catch me later.
in the [claude.py](https://github.com/Amm1rr/WebAI-to-API/blob/master/src/claude.py)
line 239
:I was testing the streaming output results and found that you need to add a async method right behind the yeild in the async function. for example:
Otherwise the function will be blocked until all the streaming data are received. There are two ways to solve it:
async def stream_message
sync,I have no idea make this happen, if you figure it out what is happening, catch me later.