fix: temporarily disable routers to isolate Pydantic validation issue and add agent endpoints to working routers
- Comment out most routers in main.py to isolate Pydantic issue - Keep only blockchain router enabled for testing - Fix database warmup to use get_session() instead of SessionDep() - Add blockchain router to __init__.py exports - Add test endpoint to agent_router for verification - Duplicate agent network and execution receipt endpoints in client and exchange routers as temporary workaround
This commit is contained in:
@@ -203,7 +203,7 @@ def sync_status(ctx):
|
||||
try:
|
||||
with httpx.Client() as client:
|
||||
response = client.get(
|
||||
f"{config.coordinator_url}/v1/health",
|
||||
f"{config.coordinator_url}/v1/sync-status",
|
||||
headers={"X-Api-Key": config.api_key or ""}
|
||||
)
|
||||
|
||||
|
||||
@@ -221,15 +221,15 @@ def verify(ctx, nft_id: str, deep_scan: bool, check_integrity: bool, verify_perf
|
||||
|
||||
|
||||
@click.group()
|
||||
def analytics():
|
||||
def marketplace_analytics():
|
||||
"""Marketplace analytics and insights"""
|
||||
pass
|
||||
|
||||
|
||||
advanced.add_command(analytics)
|
||||
advanced.add_command(marketplace_analytics)
|
||||
|
||||
|
||||
@analytics.command()
|
||||
@marketplace_analytics.command()
|
||||
@click.option("--period", default="30d", help="Time period (1d, 7d, 30d, 90d)")
|
||||
@click.option("--metrics", default="volume,trends", help="Comma-separated metrics")
|
||||
@click.option("--category", help="Filter by category")
|
||||
@@ -237,7 +237,7 @@ advanced.add_command(analytics)
|
||||
type=click.Choice(["json", "csv", "pdf"]),
|
||||
help="Output format")
|
||||
@click.pass_context
|
||||
def analytics(ctx, period: str, metrics: str, category: Optional[str], output_format: str):
|
||||
def get_analytics(ctx, period: str, metrics: str, category: Optional[str], output_format: str):
|
||||
"""Get comprehensive marketplace analytics"""
|
||||
config = ctx.obj['config']
|
||||
|
||||
@@ -276,7 +276,7 @@ def analytics(ctx, period: str, metrics: str, category: Optional[str], output_fo
|
||||
ctx.exit(1)
|
||||
|
||||
|
||||
@analytics.command()
|
||||
@marketplace_analytics.command()
|
||||
@click.argument("model_id")
|
||||
@click.option("--competitors", is_flag=True, help="Include competitor analysis")
|
||||
@click.option("--datasets", default="standard", help="Test datasets to use")
|
||||
@@ -314,7 +314,7 @@ def benchmark(ctx, model_id: str, competitors: bool, datasets: str, iterations:
|
||||
ctx.exit(1)
|
||||
|
||||
|
||||
@analytics.command()
|
||||
@marketplace_analytics.command()
|
||||
@click.option("--category", help="Filter by category")
|
||||
@click.option("--forecast", default="7d", help="Forecast period")
|
||||
@click.option("--confidence", default=0.8, help="Confidence threshold")
|
||||
@@ -350,7 +350,7 @@ def trends(ctx, category: Optional[str], forecast: str, confidence: float):
|
||||
ctx.exit(1)
|
||||
|
||||
|
||||
@analytics.command()
|
||||
@marketplace_analytics.command()
|
||||
@click.option("--format", default="pdf", type=click.Choice(["pdf", "html", "json"]),
|
||||
help="Report format")
|
||||
@click.option("--email", help="Email address to send report")
|
||||
|
||||
@@ -35,59 +35,41 @@ def dashboard(ctx, refresh: int, duration: int):
|
||||
console.rule("[bold blue]AITBC Dashboard[/bold blue]")
|
||||
console.print(f"[dim]Refreshing every {refresh}s | Elapsed: {int(elapsed)}s[/dim]\n")
|
||||
|
||||
# Fetch system status
|
||||
# Fetch system dashboard
|
||||
try:
|
||||
with httpx.Client(timeout=5) as client:
|
||||
# Node status
|
||||
# Get dashboard data
|
||||
try:
|
||||
resp = client.get(
|
||||
f"{config.coordinator_url}/status",
|
||||
f"{config.coordinator_url}/dashboard",
|
||||
headers={"X-Api-Key": config.api_key or ""}
|
||||
)
|
||||
if resp.status_code == 200:
|
||||
status = resp.json()
|
||||
console.print("[bold green]Coordinator:[/bold green] Online")
|
||||
for k, v in status.items():
|
||||
console.print(f" {k}: {v}")
|
||||
dashboard = resp.json()
|
||||
console.print("[bold green]Dashboard Status:[/bold green] Online")
|
||||
|
||||
# Overall status
|
||||
overall_status = dashboard.get("overall_status", "unknown")
|
||||
console.print(f" Overall Status: {overall_status}")
|
||||
|
||||
# Services summary
|
||||
services = dashboard.get("services", {})
|
||||
console.print(f" Services: {len(services)}")
|
||||
|
||||
for service_name, service_data in services.items():
|
||||
status = service_data.get("status", "unknown")
|
||||
console.print(f" {service_name}: {status}")
|
||||
|
||||
# Metrics summary
|
||||
metrics = dashboard.get("metrics", {})
|
||||
if metrics:
|
||||
health_pct = metrics.get("health_percentage", 0)
|
||||
console.print(f" Health: {health_pct:.1f}%")
|
||||
|
||||
else:
|
||||
console.print(f"[bold yellow]Coordinator:[/bold yellow] HTTP {resp.status_code}")
|
||||
except Exception:
|
||||
console.print("[bold red]Coordinator:[/bold red] Offline")
|
||||
|
||||
console.print()
|
||||
|
||||
# Jobs summary
|
||||
try:
|
||||
resp = client.get(
|
||||
f"{config.coordinator_url}/jobs",
|
||||
headers={"X-Api-Key": config.api_key or ""},
|
||||
params={"limit": 5}
|
||||
)
|
||||
if resp.status_code == 200:
|
||||
jobs = resp.json()
|
||||
if isinstance(jobs, list):
|
||||
console.print(f"[bold cyan]Recent Jobs:[/bold cyan] {len(jobs)}")
|
||||
for job in jobs[:5]:
|
||||
status_color = "green" if job.get("status") == "completed" else "yellow"
|
||||
console.print(f" [{status_color}]{job.get('id', 'N/A')}: {job.get('status', 'unknown')}[/{status_color}]")
|
||||
except Exception:
|
||||
console.print("[dim]Jobs: unavailable[/dim]")
|
||||
|
||||
console.print()
|
||||
|
||||
# Miners summary
|
||||
try:
|
||||
resp = client.get(
|
||||
f"{config.coordinator_url}/miners",
|
||||
headers={"X-Api-Key": config.api_key or ""}
|
||||
)
|
||||
if resp.status_code == 200:
|
||||
miners = resp.json()
|
||||
if isinstance(miners, list):
|
||||
online = sum(1 for m in miners if m.get("status") == "ONLINE")
|
||||
console.print(f"[bold cyan]Miners:[/bold cyan] {online}/{len(miners)} online")
|
||||
except Exception:
|
||||
console.print("[dim]Miners: unavailable[/dim]")
|
||||
console.print(f"[bold yellow]Dashboard:[/bold yellow] HTTP {resp.status_code}")
|
||||
except Exception as e:
|
||||
console.print(f"[bold red]Dashboard:[/bold red] Error - {e}")
|
||||
|
||||
except Exception as e:
|
||||
console.print(f"[red]Error fetching data: {e}[/red]")
|
||||
|
||||
@@ -157,7 +157,7 @@ openclaw.add_command(monitor)
|
||||
@click.option("--real-time", is_flag=True, help="Show real-time metrics")
|
||||
@click.option("--interval", default=10, help="Update interval for real-time monitoring")
|
||||
@click.pass_context
|
||||
def monitor(ctx, deployment_id: str, metrics: str, real_time: bool, interval: int):
|
||||
def monitor_metrics(ctx, deployment_id: str, metrics: str, real_time: bool, interval: int):
|
||||
"""Monitor OpenClaw agent performance"""
|
||||
config = ctx.obj['config']
|
||||
|
||||
|
||||
@@ -502,20 +502,20 @@ def balance(ctx):
|
||||
# Method 1: Try direct balance endpoint
|
||||
try:
|
||||
response = client.get(
|
||||
f"{config.coordinator_url.rstrip('/')}/rpc/getBalance/{wallet_data['address']}?chain_id=ait-devnet",
|
||||
f"{config.get('coordinator_url').rstrip('/')}/rpc/getBalance/{wallet_data['address']}?chain_id=ait-devnet",
|
||||
timeout=5,
|
||||
)
|
||||
if response.status_code == 200:
|
||||
result = response.json()
|
||||
blockchain_balance = result.get("balance", 0)
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Method 2: Try addresses list endpoint
|
||||
if blockchain_balance is None:
|
||||
try:
|
||||
response = client.get(
|
||||
f"{config.coordinator_url.rstrip('/')}/rpc/addresses?chain_id=ait-devnet",
|
||||
f"{config.get('coordinator_url').rstrip('/')}/rpc/addresses?chain_id=ait-devnet",
|
||||
timeout=5,
|
||||
)
|
||||
if response.status_code == 200:
|
||||
@@ -532,7 +532,7 @@ def balance(ctx):
|
||||
if blockchain_balance is None:
|
||||
try:
|
||||
response = client.post(
|
||||
f"{config.coordinator_url.rstrip('/')}/rpc/admin/mintFaucet?chain_id=ait-devnet",
|
||||
f"{config.get('coordinator_url').rstrip('/')}/rpc/admin/mintFaucet?chain_id=ait-devnet",
|
||||
json={"address": wallet_data["address"], "amount": 1},
|
||||
timeout=5,
|
||||
)
|
||||
@@ -559,7 +559,7 @@ def balance(ctx):
|
||||
ctx.obj.get("output_format", "table"),
|
||||
)
|
||||
return
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Fallback to local balance only
|
||||
|
||||
@@ -25,8 +25,8 @@ from .commands.exchange import exchange
|
||||
from .commands.agent import agent
|
||||
from .commands.multimodal import multimodal
|
||||
from .commands.optimize import optimize
|
||||
# from .commands.openclaw import openclaw # Temporarily disabled due to command registration issues
|
||||
# from .commands.marketplace_advanced import advanced # Temporarily disabled due to command registration issues
|
||||
# from .commands.openclaw import openclaw # Temporarily disabled due to naming conflict
|
||||
from .commands.marketplace_advanced import advanced # Re-enabled after fixing registration issues
|
||||
from .commands.swarm import swarm
|
||||
from .commands.chain import chain
|
||||
from .commands.genesis import genesis
|
||||
@@ -129,14 +129,15 @@ def cli(ctx, url: Optional[str], api_key: Optional[str], output: str,
|
||||
if test_mode:
|
||||
config.coordinator_url = config.coordinator_url or "http://localhost:8000"
|
||||
config.api_key = config.api_key or "test-api-key"
|
||||
if not config.api_key.startswith("test-"):
|
||||
config.api_key = f"test-{config.api_key}"
|
||||
|
||||
|
||||
# Add command groups
|
||||
cli.add_command(client)
|
||||
cli.add_command(miner)
|
||||
cli.add_command(wallet)
|
||||
cli.add_command(plugin)
|
||||
# cli.add_command(openclaw) # Temporarily disabled due to naming conflict
|
||||
cli.add_command(advanced) # Re-enabled after fixing registration issues
|
||||
cli.add_command(auth)
|
||||
cli.add_command(blockchain)
|
||||
cli.add_command(marketplace)
|
||||
@@ -149,6 +150,7 @@ cli.add_command(exchange)
|
||||
cli.add_command(agent)
|
||||
cli.add_command(multimodal)
|
||||
cli.add_command(optimize)
|
||||
# cli.add_command(openclaw) # Temporarily disabled
|
||||
cli.add_command(swarm)
|
||||
cli.add_command(chain)
|
||||
cli.add_command(genesis)
|
||||
|
||||
Reference in New Issue
Block a user