[Frontend] Improve error message (#31987)

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
Cyrus Leung
2026-01-09 04:07:03 +08:00
committed by GitHub
parent f16bfbe5bc
commit aa125ecf0e
3 changed files with 20 additions and 4 deletions

View File

@@ -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)