This commit is contained in:
yumoqing 2025-08-07 18:19:29 +08:00
parent 5470d3be33
commit 096c35332a

View File

@ -117,7 +117,15 @@ class UAPI:
async def stream_linify(self, upappid, apiname, callerid, params={}):
gen = liner(self.__call__(upappid, apiname, callerid, params=params))
async for line in gen:
yield line
filter = self.api.chunk_match
if line.startswith(filter):
line = line[len(filter):]
if self.api.streamresponse:
dic = json.loads(line)
line = self.rendertmpl(self.api.streamresponse, dic)
yield line
else:
debug(f'invalid line:{line}')
async def request(self, upappid, apiname, callerid, params={}):
b = b''