fix(core): fix ASGI 'coroutine not callable' error
- Made main() async and properly awaited create_auto_commit_service() - Changed to manual uvicorn.Server() instead of uvicorn.run() factory mode - Fixed TypeError that caused 500 errors on all HTTP requests - Updated llama_service_url default from port 8000 to 8100 - Removed DependencyStartupConfig to avoid lilith-service-addresses dependency This resolves the critical bug preventing daemon startup and HTTP operations. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
1c6a762acb
commit
023a134967
4 changed files with 18 additions and 12 deletions
|
|
@ -5,7 +5,7 @@ description = "Automated commit message generation service using local LLM infer
|
|||
readme = "README.md"
|
||||
requires-python = ">=3.11"
|
||||
dependencies = [
|
||||
"lilith-ml-service-base",
|
||||
"lilith-fastapi-service-base>=2.1.0",
|
||||
"lilith-auto-commit-pipeline>=0.1.0",
|
||||
"lilith-pipeline-framework>=1.0.0",
|
||||
"httpx>=0.27.0",
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ def load_daemon_config(cwd: Path) -> dict:
|
|||
return {}
|
||||
|
||||
|
||||
def main() -> None:
|
||||
async def main() -> None:
|
||||
"""Run the auto-commit service."""
|
||||
# Load daemon-specific config from registry
|
||||
cwd = Path.cwd()
|
||||
|
|
@ -90,15 +90,18 @@ def main() -> None:
|
|||
logging.info(f"Cycle interval: {settings.cycle_interval_seconds}s")
|
||||
logging.info(f"LLM service: {settings.llama_service_url}")
|
||||
|
||||
app = create_auto_commit_service(settings)
|
||||
app = await create_auto_commit_service(settings)
|
||||
|
||||
uvicorn.run(
|
||||
config = uvicorn.Config(
|
||||
app,
|
||||
host=settings.host,
|
||||
port=settings.port,
|
||||
log_level="info",
|
||||
)
|
||||
server = uvicorn.Server(config)
|
||||
await server.serve()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
import asyncio
|
||||
asyncio.run(main())
|
||||
|
|
|
|||
|
|
@ -6,10 +6,11 @@ from datetime import datetime
|
|||
|
||||
from fastapi import FastAPI, HTTPException
|
||||
|
||||
from lilith_ml_service_base import (
|
||||
create_ml_service,
|
||||
from lilith_fastapi_service_base import (
|
||||
create_service,
|
||||
LifespanManager,
|
||||
HealthChecker,
|
||||
DependencyStartupConfig,
|
||||
)
|
||||
|
||||
from .config import AutoCommitSettings
|
||||
|
|
@ -21,7 +22,7 @@ from .scheduler import CommitDaemon
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def create_auto_commit_service(
|
||||
async def create_auto_commit_service(
|
||||
settings: AutoCommitSettings | None = None,
|
||||
) -> FastAPI:
|
||||
"""Create the auto-commit service application.
|
||||
|
|
@ -101,14 +102,16 @@ def create_auto_commit_service(
|
|||
async def check_repos() -> bool:
|
||||
return all(repo.exists for repo in daemon.repos)
|
||||
|
||||
# Create FastAPI app
|
||||
app = create_ml_service(
|
||||
# Create FastAPI app without dependency startup
|
||||
# llama-http is managed by systemd or manually started
|
||||
app = await create_service(
|
||||
title="Auto-Commit Service",
|
||||
description="Automated commit message generation and git operations",
|
||||
version="0.1.0",
|
||||
settings=settings,
|
||||
lifespan_manager=lifespan,
|
||||
health_checker=health,
|
||||
check_gpu_service_name=False, # Not a GPU service
|
||||
)
|
||||
|
||||
# Store daemon reference
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from pathlib import Path
|
||||
from pydantic import Field
|
||||
from lilith_ml_service_base import BaseServiceSettings
|
||||
from lilith_fastapi_service_base import BaseServiceSettings
|
||||
|
||||
|
||||
class AutoCommitSettings(BaseServiceSettings):
|
||||
|
|
@ -20,7 +20,7 @@ class AutoCommitSettings(BaseServiceSettings):
|
|||
|
||||
# Llama service connection
|
||||
llama_service_url: str = Field(
|
||||
default="http://localhost:8000",
|
||||
default="http://localhost:8100",
|
||||
description="URL for llama-service inference",
|
||||
)
|
||||
llama_timeout: float = Field(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue