def METHOD_NAME(utterance, state, top_k, top_p, temperature, repetition_penalty, max_length):
    """Model inference."""
    utterance = utterance.strip().replace("<br>", "\n")
    context = state.setdefault("context", [])
    if not utterance:
        gr.Warning("invalid inputs")
        # gr.Warning("请输入有效问题")
        shown_context = get_shown_context(context)
        return None, shown_context, context, state
    context.append({"role": "user", "utterance": utterance})
    data = {
        "context": utterance,
        "top_k": top_k,
        "top_p": top_p,
        "temperature": temperature,
        "repetition_penalty": repetition_penalty,
        "max_length": max_length,
        "min_length": 1,
    }
    result = requests.post(f"http://0.0.0.0:{args.flask_port}/api/chat", json=data).json()
    bot_response = result["result"]["response"]
    context.append(bot_response)
    shown_context = get_shown_context(context)
    return None, shown_context, context, state