F-Droid 在 开源一个Open WebUI函数 中发帖
from pydantic import BaseModel, Field
from typing import Optional, Callable, Any, Awaitable
import re
import time
from open_webui.utils.misc import get_last_assistant_message
def count_characters(text: str) -> int:
chinese_chars = re.findall(r"[\u4e00-\u9fff]", text)
english_words = re.findall(r"\b\w+\b", text)
punctuation_marks = re.findall(r"[^\w\s]", text)
total_count = len(c...