This commit is contained in:
yumoqing 2024-07-08 20:30:57 +08:00
parent 8b57dadd04
commit 4bc140bafe
2 changed files with 6 additions and 1 deletions

View File

@ -97,6 +97,10 @@ class BaseProcessor(AppLogger):
if self.retResponse is not None:
self.set_response_headers(self.retResponse)
return self.retResponse
elif isinstance(self.content, Response):
return self.content
elif isinstance(self.content, StreamResponse):
return self.content
elif isinstance(self.content, DictObject):
self.content = json.dumps(self.content, indent=4)
jsonflg = True

View File

@ -41,7 +41,7 @@ class StreamLlmProxy:
if '[DONE]' in ll:
return
try:
print('write_chunk(),l=', ll)
# print('write_chunk(),l=', ll)
l = self.line_chunk_match(ll)
d = DictObject(** json.loads(l))
j = {}
@ -66,6 +66,7 @@ class StreamLlmProxy:
print_exc()
async def stream_handle(self, chunk):
print('chunk=', chunk)
chunk = chunk.decode('utf-8')
chunk = self.remain_str + chunk
lines = chunk.split('\n')