[Frontend] Improve error message (#31987)
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
@@ -9,6 +9,7 @@ from argparse import Namespace
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import regex as re
|
||||
from fastapi import Request
|
||||
from fastapi.responses import JSONResponse, StreamingResponse
|
||||
from starlette.background import BackgroundTask, BackgroundTasks
|
||||
@@ -317,3 +318,8 @@ async def process_chat_template(
|
||||
model_config.model,
|
||||
)
|
||||
return resolved_chat_template
|
||||
|
||||
|
||||
def sanitize_message(message: str) -> str:
|
||||
# Avoid leaking memory address from object reprs
|
||||
return re.sub(r" at 0x[0-9a-f]+>", ">", message)
|
||||
|
||||
Reference in New Issue
Block a user