Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 21, 2024
1 parent f917ae6 commit ae2f6ba
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions comps/cores/mega/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ async def execute(
if (
self.services[cur_node].service_type == ServiceType.LLM
or self.services[cur_node].service_type == ServiceType.LVM
):
):
if llm_parameters.streaming:
llm_parameters_dict = llm_parameters.dict()

for field, value in llm_parameters_dict.items():
if inputs.get(field) != value:
inputs[field] = value
# Still leave to sync requests.post for StreamingResponse

response = requests.post(
url=endpoint, data=json.dumps(inputs), proxies={"http": None}, stream=True, timeout=1000
)
Expand All @@ -153,7 +153,7 @@ async def execute(
cur_node = downstream[0]
hitted_ends = [".", "?", "!", "。", ",", "!"]
downstream_endpoint = self.services[downstream[0]].endpoint_path

def generate():
if response:
buffered_chunk_str = ""
Expand All @@ -178,7 +178,7 @@ def generate():
yield from self.token_generator(res_txt, is_last=is_last)
else:
yield chunk

Check warning on line 180 in comps/cores/mega/orchestrator.py

View check run for this annotation

Codecov / codecov/patch

comps/cores/mega/orchestrator.py#L180

Added line #L180 was not covered by tests

return StreamingResponse(generate(), media_type="text/event-stream"), cur_node
else:
async with session.post(endpoint, json=inputs) as response:
Expand Down

0 comments on commit ae2f6ba

Please sign in to comment.