Нормализовать переводы строк в LF

Решение по TD-STYLE-ANALYZERS: LF — инструменты проекта (Python/Node) пишут LF,
CRLF-.sh не работают на Linux CI (sh scripts/ci.sh), большинство файлов уже были
LF. Добавлен .gitattributes (* text=auto eol=lf, бинарные исключения),
.editorconfig переведён на lf, 1029 файлов конвертированы, git add --renormalize.
Из индекса убраны закравшиеся archive/**/__pycache__/*.pyc.
This commit is contained in:
Rustam Khalimov
2026-09-11 19:01:42 +03:00
parent 39c9bdc1b7
commit 713d554dc2
751 changed files with 94507 additions and 94486 deletions
+70 -70
View File
@@ -1,70 +1,70 @@
"""HTTP-API автономного ML-сервиса LeadRadar.
Запуск: uvicorn server:app --host 0.0.0.0 --port 8100
(в compose сервис `ml`, наружу порт не публикуется).
"""
from __future__ import annotations
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
import model as m
app = FastAPI(title="LeadRadar ML", version="1.0.0")
class LearnItem(BaseModel):
text: str
label: str
delta: float = 1.0
class PredictBody(BaseModel):
text: str
class BatchBody(BaseModel):
items: list[LearnItem]
@app.get("/health")
def health() -> dict:
return {"ok": True, "service": "leadradar-ml"}
@app.get("/status")
def status() -> dict:
return m.status()
@app.post("/learn")
def learn(body: LearnItem) -> dict:
if not body.text.strip() or not body.label.strip():
raise HTTPException(400, "text и label обязательны")
m.learn(body.label, body.text, body.delta)
return {"ok": True}
@app.post("/learn-batch")
def learn_batch(body: BatchBody) -> dict:
m.learn_batch([it.model_dump() for it in body.items])
return {"ok": True, "learned": len(body.items)}
@app.post("/predict")
def predict(body: PredictBody) -> dict:
if not body.text.strip():
raise HTTPException(400, "text обязателен")
return m.predict(body.text)
@app.post("/reset")
def reset() -> dict:
m.reset()
return {"ok": True}
@app.on_event("startup")
def _startup() -> None:
# прогреваем соединение с БД модели
m.status()
"""HTTP-API автономного ML-сервиса LeadRadar.
Запуск: uvicorn server:app --host 0.0.0.0 --port 8100
(в compose сервис `ml`, наружу порт не публикуется).
"""
from __future__ import annotations
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
import model as m
app = FastAPI(title="LeadRadar ML", version="1.0.0")
class LearnItem(BaseModel):
text: str
label: str
delta: float = 1.0
class PredictBody(BaseModel):
text: str
class BatchBody(BaseModel):
items: list[LearnItem]
@app.get("/health")
def health() -> dict:
return {"ok": True, "service": "leadradar-ml"}
@app.get("/status")
def status() -> dict:
return m.status()
@app.post("/learn")
def learn(body: LearnItem) -> dict:
if not body.text.strip() or not body.label.strip():
raise HTTPException(400, "text и label обязательны")
m.learn(body.label, body.text, body.delta)
return {"ok": True}
@app.post("/learn-batch")
def learn_batch(body: BatchBody) -> dict:
m.learn_batch([it.model_dump() for it in body.items])
return {"ok": True, "learned": len(body.items)}
@app.post("/predict")
def predict(body: PredictBody) -> dict:
if not body.text.strip():
raise HTTPException(400, "text обязателен")
return m.predict(body.text)
@app.post("/reset")
def reset() -> dict:
m.reset()
return {"ok": True}
@app.on_event("startup")
def _startup() -> None:
# прогреваем соединение с БД модели
m.status()