From 6d44178f63418eb8b992b5b40b369596e08f27e1 Mon Sep 17 00:00:00 2001 From: yangdx Date: Wed, 15 Jan 2025 21:26:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=E6=B5=81=E7=BB=93=E6=9D=9F=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lightrag/api/lightrag_ollama.py | 24 ++++++++++++------------ test_lightrag_ollama_chat.py | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lightrag/api/lightrag_ollama.py b/lightrag/api/lightrag_ollama.py index 959506d5..5a066e15 100644 --- a/lightrag/api/lightrag_ollama.py +++ b/lightrag/api/lightrag_ollama.py @@ -743,12 +743,12 @@ def create_app(args): "model": LIGHTRAG_MODEL, "created_at": LIGHTRAG_CREATED_AT, "done": True, - "total_duration": 0, # 由于我们没有实际统计这些指标,暂时使用默认值 - "load_duration": 0, - "prompt_eval_count": 0, - "prompt_eval_duration": 0, - "eval_count": 0, - "eval_duration": 0 + "total_duration": 1, # 由于我们没有实际统计这些指标,暂时使用默认值 + "load_duration": 1, + "prompt_eval_count": 999, + "prompt_eval_duration": 1, + "eval_count": 999, + "eval_duration": 1 } yield f"data: {json.dumps(data, ensure_ascii=False)}\n\n" return # 确保生成器在发送完成标记后立即结束 @@ -789,12 +789,12 @@ def create_app(args): "images": None }, "done": True, - "total_duration": 0, # 由于我们没有实际统计这些指标,暂时使用默认值 - "load_duration": 0, - "prompt_eval_count": 0, - "prompt_eval_duration": 0, - "eval_count": 0, - "eval_duration": 0 + "total_duration": 1, # 由于我们没有实际统计这些指标,暂时使用默认值 + "load_duration": 1, + "prompt_eval_count": 999, + "prompt_eval_duration": 1, + "eval_count": 999, + "eval_duration": 1 } except Exception as e: raise HTTPException(status_code=500, detail=str(e)) diff --git a/test_lightrag_ollama_chat.py b/test_lightrag_ollama_chat.py index 60158ac2..f8947585 100644 --- a/test_lightrag_ollama_chat.py +++ b/test_lightrag_ollama_chat.py @@ -70,7 +70,7 @@ def test_stream_chat(): for event in client.events(): try: data = json.loads(event.data) - if data.get("done", False): # 如果是完成标记 + if data.get("done", True): # 如果是完成标记 if "total_duration" in data: # 最终的性能统计消息 print("\n=== 性能统计 ===") print(json.dumps(data, ensure_ascii=False, indent=2))