SeaWolf-AI commited on
Commit
3cdb5a1
·
verified ·
1 Parent(s): 8a4f1d2

fix: define _ip helper (verify 500)

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -71,6 +71,10 @@ SYS = (
71
  "정말로 관련 사실이 하나도 없을 때만 해당 언어로 '관련 정보가 없습니다'라고 답한다. 없는 사실을 지어내지 않는다."
72
  )
73
 
 
 
 
 
74
  @app.get("/health")
75
  def health():
76
  return {"ok": True, "has_key": bool(KEY), "model": MODEL}
 
71
  "정말로 관련 사실이 하나도 없을 때만 해당 언어로 '관련 정보가 없습니다'라고 답한다. 없는 사실을 지어내지 않는다."
72
  )
73
 
74
+ def _ip(req):
75
+ fwd = req.headers.get("x-forwarded-for")
76
+ return (fwd.split(",")[0].strip() if fwd else (req.client.host if req.client else "x")) or "x"
77
+
78
  @app.get("/health")
79
  def health():
80
  return {"ok": True, "has_key": bool(KEY), "model": MODEL}