门户估价对话、会员与智能体账号,以及生产 Docker 部署一直停在工作区,远端主分支还没有这些改动。 Co-authored-by: Cursor <cursoragent@cursor.com>
15 lines
392 B
Python
15 lines
392 B
Python
from fastapi import Request
|
|
|
|
from app.core.config import get_settings
|
|
|
|
|
|
def client_ip(request: Request) -> str:
|
|
if get_settings().trust_proxy:
|
|
forwarded = request.headers.get("x-forwarded-for", "")
|
|
first = forwarded.split(",")[0].strip()
|
|
if first:
|
|
return first[:64]
|
|
if request.client is None:
|
|
return ""
|
|
return request.client.host or ""
|