mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2026-07-28 05:00:38 +03:00
refactor: update parameter names in validation functions for clarity
This commit is contained in:
+1
-3
@@ -1,7 +1,6 @@
|
|||||||
from contextlib import asynccontextmanager
|
from contextlib import asynccontextmanager
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import asyncpg
|
|
||||||
from fastapi import Depends, FastAPI, Request
|
from fastapi import Depends, FastAPI, Request
|
||||||
from fastapi.responses import HTMLResponse
|
from fastapi.responses import HTMLResponse
|
||||||
from fastapi.templating import Jinja2Templates
|
from fastapi.templating import Jinja2Templates
|
||||||
@@ -23,7 +22,6 @@ from app.middleware.profiler import ProfilingMiddleware
|
|||||||
from app.redis import get_redis
|
from app.redis import get_redis
|
||||||
from app.services.auth import AuthBearer
|
from app.services.auth import AuthBearer
|
||||||
from app.services.chat_agent import build_chat_agent
|
from app.services.chat_agent import build_chat_agent
|
||||||
from app.services.chat_session import ChatSessionManager
|
|
||||||
|
|
||||||
templates = Jinja2Templates(directory=Path(__file__).parent.parent / "templates")
|
templates = Jinja2Templates(directory=Path(__file__).parent.parent / "templates")
|
||||||
|
|
||||||
@@ -32,7 +30,7 @@ templates = Jinja2Templates(directory=Path(__file__).parent.parent / "templates"
|
|||||||
async def lifespan(app: FastAPI):
|
async def lifespan(app: FastAPI):
|
||||||
app.logger = get_logger()
|
app.logger = get_logger()
|
||||||
app.redis = await get_redis()
|
app.redis = await get_redis()
|
||||||
postgres_dsn = global_settings.postgres_url.unicode_string()
|
global_settings.postgres_url.unicode_string()
|
||||||
# Chat service: initialize the pluggable model-client adapter. The session
|
# Chat service: initialize the pluggable model-client adapter. The session
|
||||||
# manager is now a singleton and will be auto-instantiated on first access.
|
# manager is now a singleton and will be auto-instantiated on first access.
|
||||||
# See app/services/chat_agent.py to swap the local stub for a real model
|
# See app/services/chat_agent.py to swap the local stub for a real model
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class LocalEchoAgent:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def _validate_base_url(instance: OllamaChatAgent, attribute: attrs.Attribute, value: str) -> None:
|
def _validate_base_url(_instance: OllamaChatAgent, _attribute: attrs.Attribute, value: str) -> None:
|
||||||
"""Validate that base_url is a valid HTTP(S) URL.
|
"""Validate that base_url is a valid HTTP(S) URL.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@@ -92,7 +92,7 @@ def _validate_base_url(instance: OllamaChatAgent, attribute: attrs.Attribute, va
|
|||||||
raise ValueError(msg)
|
raise ValueError(msg)
|
||||||
|
|
||||||
|
|
||||||
def _validate_timeout(instance: OllamaChatAgent, attribute: attrs.Attribute, value: float) -> None:
|
def _validate_timeout(_instance: OllamaChatAgent, _attribute: attrs.Attribute, value: float) -> None:
|
||||||
"""Validate that timeout is positive.
|
"""Validate that timeout is positive.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
import httpx
|
import httpx
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from app.services.chat_agent import OllamaChatAgent, LocalEchoAgent, build_chat_agent
|
|
||||||
from app.config import ChatConfig
|
from app.config import ChatConfig
|
||||||
|
from app.services.chat_agent import LocalEchoAgent, OllamaChatAgent, build_chat_agent
|
||||||
|
|
||||||
|
|
||||||
class TestOllamaChatAgentAttrsFeatures:
|
class TestOllamaChatAgentAttrsFeatures:
|
||||||
|
|||||||
Reference in New Issue
Block a user