Revert chatqna async and enhance tests (#1598)

align with opea-project/GenAIComps#1354
This commit is contained in:
Spycsh
2025-03-03 23:03:44 +08:00
committed by GitHub
parent e8b07c28ec
commit ce38a84372
4 changed files with 8 additions and 7 deletions

View File

@@ -166,10 +166,10 @@ def align_outputs(self, data, cur_node, inputs, runtime_graph, llm_parameters_di
return next_data
async def align_generator(self, gen, **kwargs):
def align_generator(self, gen, **kwargs):
# OpenAI response format
# b'data:{"id":"","object":"text_completion","created":1725530204,"model":"meta-llama/Meta-Llama-3-8B-Instruct","system_fingerprint":"2.0.1-native","choices":[{"index":0,"delta":{"role":"assistant","content":"?"},"logprobs":null,"finish_reason":null}]}\n\n'
async for line in gen:
for line in gen:
line = line.decode("utf-8")
start = line.find("{")
end = line.rfind("}") + 1