diff --git a/CHANGELOG.md b/CHANGELOG.md index 084d7a7..b71f223 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -82,6 +82,13 @@ # Checkpoint Summarization Filter +**0.2.1:** + - Fix `None - int` error when setting num_ctx in a chat, and then + unsetting it. + +**0.2.0:** + - Update for newer versions of OpenWebUI (0.3.29+). + **0.1.0:** - Initial release. diff --git a/checkpoint_summary_filter.py b/checkpoint_summary_filter.py index 9a3cbac..e4a174e 100644 --- a/checkpoint_summary_filter.py +++ b/checkpoint_summary_filter.py @@ -2,7 +2,7 @@ title: Checkpoint Summary Filter author: projectmoon author_url: https://git.agnos.is/projectmoon/open-webui-filters -version: 0.2.0 +version: 0.2.1 license: AGPL-3.0+ required_open_webui_version: 0.3.29 """ @@ -438,7 +438,8 @@ async def calculate_num_ctx(chat_id: str, user_id, model: dict) -> int: # useful info. chat = json.loads(chat.chat) if "params" in chat and "num_ctx" in chat["params"]: - return chat["params"]["num_ctx"] + if chat["params"]["num_ctx"] is not None: + return chat["params"]["num_ctx"] # then check open web ui model def num_ctx = extract_owu_model_param(model, "num_ctx") @@ -621,7 +622,7 @@ class Filter: if system_prompt: system_prompt["content"] += f"\n\n{summary_message}" else: - system_prompt = { "role": "system", "content": summary_message } + system_prompt = { "role": "system", "content": summary_message } # drop old messages, reapply system prompt.