handle some errors in output sanitizing filter
This commit is contained in:
parent
6180d238b3
commit
8aa2a44da7
|
@ -2,7 +2,7 @@
|
||||||
title: Output Sanitization Filter
|
title: Output Sanitization Filter
|
||||||
author: projectmoon
|
author: projectmoon
|
||||||
author_url: https://git.agnos.is/projectmoon/open-webui-filters
|
author_url: https://git.agnos.is/projectmoon/open-webui-filters
|
||||||
version: 0.1.0
|
version: 0.1.2
|
||||||
required_open_webui_version: 0.3.9
|
required_open_webui_version: 0.3.9
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -55,4 +55,9 @@ class Filter:
|
||||||
last_reply: dict = body["messages"][-1]
|
last_reply: dict = body["messages"][-1]
|
||||||
last_reply = last_reply["content"].strip()
|
last_reply = last_reply["content"].strip()
|
||||||
replaced_message = strip_prefixes(last_reply, self.valves.start_removals)
|
replaced_message = strip_prefixes(last_reply, self.valves.start_removals)
|
||||||
await self.replace_message(replaced_message)
|
|
||||||
|
if replaced_message != last_reply:
|
||||||
|
body["messages"][-1]["content"] = replaced_message
|
||||||
|
await self.replace_message(replaced_message)
|
||||||
|
|
||||||
|
return body
|
||||||
|
|
Loading…
Reference in New Issue