Merge remote-tracking branch 'origin/new-page-framework' into llm_framework

This commit is contained in:
aries_ckt 2023-07-03 22:13:25 +08:00
commit ba48fa3e08
2 changed files with 4 additions and 3 deletions

View File

@ -281,7 +281,7 @@ async def stream_generator(chat):
)
msg = msg.replace("\n", "\\n")
yield f"data:{msg}\n\n"
await asyncio.sleep(0.1)
await asyncio.sleep(0.02)
else:
for chunk in model_response:
if chunk:
@ -291,7 +291,7 @@ async def stream_generator(chat):
msg = msg.replace("\n", "\\n")
yield f"data:{msg}\n\n"
await asyncio.sleep(0.1)
await asyncio.sleep(0.02)
chat.current_message.add_ai_message(msg)
chat.current_message.add_view_message(msg)

View File

@ -172,7 +172,8 @@ class BaseChat(ABC):
from pilot.server.llmserver import worker
output = worker.generate_stream_gate(payload)
for rsp in output:
rsp_str = str(rsp, "utf-8")
rsp = rsp.replace(b"\0", b"")
rsp_str = rsp.decode()
print("[TEST: output]:", rsp_str)
### output parse