feat: unify multimodels translation providers, remove self-hosting (Ollama/LibreTranslate), and fix local SQLite configuration
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m21s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m21s
This commit is contained in:
@@ -66,8 +66,7 @@ async def get_available_providers():
|
||||
from routes.admin_routes import load_settings
|
||||
|
||||
settings = load_settings()
|
||||
is_dev = os.getenv("APP_ENV", "production").lower() == "development" or \
|
||||
os.getenv("SHOW_OLLAMA", "false").lower() == "true"
|
||||
is_dev = os.getenv("APP_ENV", "production").lower() == "development"
|
||||
|
||||
def _key_ready(key_var: str) -> bool:
|
||||
return bool(os.getenv(key_var, "").strip())
|
||||
@@ -208,22 +207,7 @@ async def get_available_providers():
|
||||
"model": model,
|
||||
})
|
||||
|
||||
# Ollama — dev only
|
||||
if is_dev and _is_enabled("ollama", url_var="OLLAMA_BASE_URL"):
|
||||
oll_cfg = getattr(settings, "ollama", None)
|
||||
model = _resolve_model(
|
||||
oll_cfg.model if oll_cfg else None,
|
||||
"OLLAMA_MODEL",
|
||||
"llama3",
|
||||
)
|
||||
available.append({
|
||||
"id": "ollama",
|
||||
"label": "Ollama (Local)",
|
||||
"description": "Modèle LLM local — développement uniquement",
|
||||
"mode": "llm",
|
||||
"tier": "dev",
|
||||
"model": model,
|
||||
})
|
||||
|
||||
|
||||
return JSONResponse(
|
||||
status_code=200,
|
||||
@@ -640,29 +624,7 @@ async def reconstruct_document(
|
||||
)
|
||||
|
||||
|
||||
@router.get("/ollama/models")
|
||||
async def list_ollama_models(base_url: Optional[str] = None):
|
||||
"""List available Ollama models"""
|
||||
from services.translation_service import OllamaTranslationProvider
|
||||
|
||||
url = base_url or config.OLLAMA_BASE_URL
|
||||
models = OllamaTranslationProvider.list_models(url)
|
||||
|
||||
return {"ollama_url": url, "models": models, "count": len(models)}
|
||||
|
||||
|
||||
@router.post("/ollama/configure")
|
||||
async def configure_ollama(base_url: str = Form(...), model: str = Form(...)):
|
||||
"""Configure Ollama settings"""
|
||||
config.OLLAMA_BASE_URL = base_url
|
||||
config.OLLAMA_MODEL = model
|
||||
|
||||
return {
|
||||
"status": "success",
|
||||
"message": "Ollama configuration updated",
|
||||
"ollama_url": base_url,
|
||||
"model": model,
|
||||
}
|
||||
|
||||
|
||||
@router.get("/metrics")
|
||||
|
||||
Reference in New Issue
Block a user