From 77eef27cad9b0e5b0551d5a8ea9485779ee7dc18 Mon Sep 17 00:00:00 2001 From: tanaka takashi Date: Thu, 9 Jul 2026 19:52:03 +0900 Subject: 停止ボタンの不具合修正(停止ボタンを押すと送信できなくなるバグを修正) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LLMがメッセージ生成途上で画面スクロールしにくい問題を修正 チャットメッセージバルーンをコピペ対応 トークン消費量をリングゲージで可視化(表示タイミングに不具合あり) --- tests/test_llm.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/test_llm.py') diff --git a/tests/test_llm.py b/tests/test_llm.py index cbb9910..3002a77 100644 --- a/tests/test_llm.py +++ b/tests/test_llm.py @@ -12,6 +12,7 @@ from ollama._types import ResponseError from ollama_web.llm import ( _embed_images_in_content, _is_image_message, + _token_counts, chat_with_tools, stream_chat_with_tools, ) @@ -81,3 +82,26 @@ def test_stream_chat_with_tools_accepts_capability_set() -> None: ) with pytest.raises(ResponseError): list(gen) + + +def test_token_counts_extracts_from_dict() -> None: + assert _token_counts({"prompt_eval_count": 100, "eval_count": 50}) == { + "prompt_eval_count": 100, + "eval_count": 50, + } + + +def test_token_counts_extracts_from_object() -> None: + class FakeResp: + prompt_eval_count = 200 + eval_count = 30 + + assert _token_counts(FakeResp()) == { + "prompt_eval_count": 200, + "eval_count": 30, + } + + +def test_token_counts_returns_none_when_missing() -> None: + assert _token_counts({}) is None + assert _token_counts(None) is None \ No newline at end of file -- cgit v1.2.3