fix: add missing database commit and remove unused agent service files
Some checks failed
AITBC CI/CD Pipeline / lint-and-test (3.11) (push) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.12) (push) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.13) (push) Has been cancelled
AITBC CI/CD Pipeline / test-cli (push) Has been cancelled
AITBC CI/CD Pipeline / test-services (push) Has been cancelled
AITBC CI/CD Pipeline / test-production-services (push) Has been cancelled
AITBC CI/CD Pipeline / security-scan (push) Has been cancelled
AITBC CI/CD Pipeline / build (push) Has been cancelled
AITBC CI/CD Pipeline / deploy-staging (push) Has been cancelled
AITBC CI/CD Pipeline / deploy-production (push) Has been cancelled
AITBC CI/CD Pipeline / performance-test (push) Has been cancelled
AITBC CI/CD Pipeline / docs (push) Has been cancelled
AITBC CI/CD Pipeline / release (push) Has been cancelled
AITBC CI/CD Pipeline / notify (push) Has been cancelled
Security Scanning / Bandit Security Scan (apps/coordinator-api/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (cli/aitbc_cli) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-core/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-crypto/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-sdk/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (tests) (push) Has been cancelled
Security Scanning / CodeQL Security Analysis (javascript) (push) Has been cancelled
Security Scanning / CodeQL Security Analysis (python) (push) Has been cancelled
Security Scanning / Dependency Security Scan (push) Has been cancelled
Security Scanning / Container Security Scan (push) Has been cancelled
Security Scanning / OSSF Scorecard (push) Has been cancelled
Security Scanning / Security Summary Report (push) Has been cancelled

- Add conn.commit() to agent registration in agent-registry
- Remove unused integration_layer.py and coordinator.py from agent-services
- Fix blockchain RPC endpoint from /rpc/sync to /rpc/syncStatus
- Replace Annotated[Session, Depends(get_session)] with Session = Depends(get_session) for cleaner dependency injection syntax across marketplace routers
This commit is contained in:
2026-03-24 13:20:56 +01:00
parent f6c4b00c4a
commit f0535d3881
20 changed files with 1520 additions and 410 deletions

View File

@@ -48,7 +48,7 @@ async def blockchain_sync_status():
rpc_url = settings.blockchain_rpc_url.rstrip('/')
async with httpx.AsyncClient() as client:
response = await client.get(f"{rpc_url}/rpc/sync", timeout=5.0)
response = await client.get(f"{rpc_url}/rpc/syncStatus", timeout=5.0)
if response.status_code == 200:
data = response.json()
return {

View File

@@ -20,7 +20,7 @@ limiter = Limiter(key_func=get_remote_address)
router = APIRouter(tags=["marketplace"])
def _get_service(session: Annotated[Session, Depends(get_session)]) -> MarketplaceService:
def _get_service(session: Session = Depends(get_session)) -> MarketplaceService:
return MarketplaceService(session)
@@ -33,7 +33,7 @@ def _get_service(session: Annotated[Session, Depends(get_session)]) -> Marketpla
async def list_marketplace_offers(
request: Request,
*,
session: Annotated[Session, Depends(get_session)],
session: Session = Depends(get_session),
status_filter: str | None = Query(default=None, alias="status", description="Filter by offer status"),
limit: int = Query(default=100, ge=1, le=500),
offset: int = Query(default=0, ge=0),
@@ -60,7 +60,7 @@ async def list_marketplace_offers(
async def get_marketplace_stats(
request: Request,
*,
session: Annotated[Session, Depends(get_session)]
session: Session = Depends(get_session)
) -> MarketplaceStatsView:
marketplace_requests_total.labels(endpoint="/marketplace/stats", method="GET").inc()
service = _get_service(session)
@@ -80,7 +80,7 @@ async def get_marketplace_stats(
async def submit_marketplace_bid(
request: Request,
payload: MarketplaceBidRequest,
session: Annotated[Session, Depends(get_session)],
session: Session = Depends(get_session),
) -> dict[str, str]:
marketplace_requests_total.labels(endpoint="/marketplace/bids", method="POST").inc()
service = _get_service(session)
@@ -102,7 +102,7 @@ async def submit_marketplace_bid(
)
async def list_marketplace_bids(
*,
session: Annotated[Session, Depends(get_session)],
session: Session = Depends(get_session),
status_filter: str | None = Query(default=None, alias="status", description="Filter by bid status"),
provider_filter: str | None = Query(default=None, alias="provider", description="Filter by provider ID"),
limit: int = Query(default=100, ge=1, le=500),
@@ -127,7 +127,7 @@ async def list_marketplace_bids(
)
async def get_marketplace_bid(
bid_id: str,
session: Annotated[Session, Depends(get_session)],
session: Session = Depends(get_session),
) -> MarketplaceBidView:
marketplace_requests_total.labels(endpoint="/marketplace/bids/{bid_id}", method="GET").inc()
service = _get_service(session)

View File

@@ -50,7 +50,7 @@ class MarketplaceAnalyticsRequest(BaseModel):
async def create_royalty_distribution(
request: RoyaltyDistributionRequest,
offer_id: str,
session: Session = Depends(Annotated[Session, Depends(get_session)]),
session: Session = Depends(get_session),
current_user: str = Depends(require_admin_key())
):
"""Create royalty distribution for marketplace offer"""
@@ -74,7 +74,7 @@ async def create_royalty_distribution(
async def calculate_royalties(
offer_id: str,
sale_amount: float,
session: Session = Depends(Annotated[Session, Depends(get_session)]),
session: Session = Depends(get_session),
current_user: str = Depends(require_admin_key())
):
"""Calculate royalties for a sale"""
@@ -97,7 +97,7 @@ async def calculate_royalties(
async def create_model_license(
request: ModelLicenseRequest,
offer_id: str,
session: Session = Depends(Annotated[Session, Depends(get_session)]),
session: Session = Depends(get_session),
current_user: str = Depends(require_admin_key())
):
"""Create model license for marketplace offer"""
@@ -123,7 +123,7 @@ async def create_model_license(
async def verify_model(
request: ModelVerificationRequest,
offer_id: str,
session: Session = Depends(Annotated[Session, Depends(get_session)]),
session: Session = Depends(get_session),
current_user: str = Depends(require_admin_key())
):
"""Verify model quality and performance"""
@@ -145,7 +145,7 @@ async def verify_model(
@router.post("/analytics")
async def get_marketplace_analytics(
request: MarketplaceAnalyticsRequest,
session: Session = Depends(Annotated[Session, Depends(get_session)]),
session: Session = Depends(get_session),
current_user: str = Depends(require_admin_key())
):
"""Get marketplace analytics and insights"""

View File

@@ -6,7 +6,7 @@ Basic marketplace enhancement features compatible with existing domain models
import asyncio
from aitbc.logging import get_logger
from typing import Dict, List, Optional, Any
from datetime import datetime
from datetime import datetime, timedelta
from uuid import uuid4
from enum import Enum
@@ -225,12 +225,12 @@ class EnhancedMarketplaceService:
offers_query = select(MarketplaceOffer).where(
MarketplaceOffer.created_at >= start_date
)
offers = self.session.execute(offers_query).all()
offers = self.session.execute(offers_query).scalars().all()
bids_query = select(MarketplaceBid).where(
MarketplaceBid.created_at >= start_date
MarketplaceBid.submitted_at >= start_date
)
bids = self.session.execute(bids_query).all()
bids = self.session.execute(bids_query).scalars().all()
# Calculate analytics
analytics = {
@@ -264,7 +264,7 @@ class EnhancedMarketplaceService:
if "revenue" in metrics:
analytics["metrics"]["revenue"] = {
"total_revenue": sum(bid.amount or 0 for bid in bids),
"total_revenue": sum(bid.price or 0 for bid in bids),
"average_price": sum(offer.price or 0 for offer in offers) / len(offers) if offers else 0,
"revenue_growth": 0.12
}