Compare commits

..
2 Commits
Author SHA1 Message Date
jpmschweitzerandClaude Opus 4.5 31370f053c fix: clean up root endpoint and disable redoc
Build and Push / build (release) Successful in 28s
- Simplify root endpoint to return minimal status info
- Remove obsolete endpoint listings (moved to /docs)
- Clean up verbose app description
- Disable redoc UI

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 11:46:26 +01:00
jpmschweitzerandClaude Opus 4.5 9370c70311 fix: correct Portainer default port to 8001
Port 9000 is Authentik, Portainer runs on 8001

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 11:29:18 +01:00
5 changed files with 14 additions and 98 deletions
+5 -5
View File
@@ -22,11 +22,11 @@ PORT=8083
# ============================================================================= # =============================================================================
# Portainer API (required for container/stack management) # Portainer API (required for container/stack management)
PORTAINER_URL=http://portainer:9000 PORTAINER_URL=http://localhost:8001
PORTAINER_API_KEY=ptr_your-api-key-here PORTAINER_API_KEY=ptr_your-api-key-here
# Nginx Proxy Manager API # Nginx Proxy Manager API
NPM_URL=http://npm:81 NPM_URL=http://localhost:81
NPM_EMAIL=admin@example.com NPM_EMAIL=admin@example.com
NPM_PASSWORD=your-npm-password NPM_PASSWORD=your-npm-password
@@ -35,7 +35,7 @@ NPM_PASSWORD=your-npm-password
# ============================================================================= # =============================================================================
# Home Assistant API # Home Assistant API
HOMEASSISTANT_URL=http://homeassistant:8123 HOMEASSISTANT_URL=http://localhost:8123
HOMEASSISTANT_TOKEN=your-long-lived-access-token HOMEASSISTANT_TOKEN=your-long-lived-access-token
# ============================================================================= # =============================================================================
@@ -43,10 +43,10 @@ HOMEASSISTANT_TOKEN=your-long-lived-access-token
# ============================================================================= # =============================================================================
# Ollama API # Ollama API
OLLAMA_BASE_URL=http://ollama:11434 OLLAMA_BASE_URL=http://localhost:11434
# SearXNG (self-hosted search) # SearXNG (self-hosted search)
SEARXNG_URL=http://searxng:8080 SEARXNG_URL=http://localhost:8080
# ============================================================================= # =============================================================================
# Vector Database # Vector Database
+1 -1
View File
@@ -1,6 +1,6 @@
[project] [project]
name = "core-api" name = "core-api"
version = "1.3.1" version = "1.3.2"
description = "Core Code API - Infrastructure management and tools API" description = "Core Code API - Infrastructure management and tools API"
readme = "README.md" readme = "README.md"
requires-python = ">=3.12" requires-python = ">=3.12"
+1 -14
View File
@@ -52,20 +52,7 @@ class HealthController(BaseController):
"service": settings.app_name, "service": settings.app_name,
"version": settings.app_version, "version": settings.app_version,
"status": "healthy", "status": "healthy",
"documentation": { "docs": "/docs"
"swagger_ui": "/docs",
"redoc": "/redoc",
"openapi_spec": "/openapi.json"
},
"endpoints": {
"chat_completions": "/v1/chat/completions",
"models": "/v1/models",
"conversations": "/v1/conversations",
"dns_lookup": "/tools/dns/lookup",
"infrastructure": "/infrastructure",
"health": "/health",
"health_full": "/health/full"
}
} }
@router.get( @router.get(
+7 -78
View File
@@ -64,89 +64,18 @@ app = FastAPI(
title=settings.app_name, title=settings.app_name,
version=settings.app_version, version=settings.app_version,
description=""" description="""
Core Code API provides OpenAPI-compatible functions and AI orchestration for Open WebUI. Core Code API - Infrastructure management and home automation API.
## Features ## Features
### OpenAI-Compatible API (v1) - **Infrastructure Management** - Container and stack management via Portainer
- `/v1/chat/completions` - Chat completions with streaming support - **Home Automation** - Device control via Home Assistant
- `/v1/models` - List available models - **Tools** - DNS lookup and utilities
Compatible with OpenAI client libraries and Open WebUI.
### Conversation Memory (Phase 2) See `/docs` for the full API reference.
- `/v1/conversations/{id}` - Get conversation history
- `/v1/conversations/{id}/search` - Semantic search within conversation
- `/v1/conversations/search` - Search across all conversations
- `/v1/conversations/{id}/stats` - Get conversation statistics
- `/v1/conversations/{id}/consolidate` - Manual consolidation
- `DELETE /v1/conversations/{id}` - Delete conversation
Multi-tier memory system:
- **Tier 1**: Fast in-memory buffer (last 10 turns)
- **Tier 2/3**: Unified Qdrant storage (persistent + semantic search)
### Infrastructure Management
**Read Endpoints:**
- `GET /infrastructure/health` - Check Portainer & NPM connectivity
- `GET /infrastructure/services` - List all deployed services
- `GET /infrastructure/services/{name}` - Get service details
- `GET /infrastructure/ports` - List allocated ports
- `GET /infrastructure/domains` - List configured domains
**Write Endpoints (Admin Only):**
- `POST /infrastructure/services` - Deploy new service from compose YAML
- `PUT /infrastructure/services/{name}` - Update existing service
- `DELETE /infrastructure/services/{name}` - Remove service and stack
- `POST /infrastructure/proxy` - Create proxy host with optional SSL
Automates infrastructure operations via Portainer and Nginx Proxy Manager APIs.
### Home Automation (Housekeeping)
**Read Endpoints:**
- `GET /housekeeping/health` - Check Home Assistant connectivity
- `GET /housekeeping/devices` - List devices (filter by domain, area)
- `GET /housekeeping/devices/{entity_id}` - Get device details
- `GET /housekeeping/areas` - List areas/rooms
- `GET /housekeeping/scenes` - List scenes
- `GET /housekeeping/scripts` - List scripts
- `GET /housekeeping/automations` - List automations
- `GET /housekeeping/history` - Get state history
**Write Endpoints (Admin Only):**
- `POST /housekeeping/devices/{entity_id}/control` - Control device
- `POST /housekeeping/scenes/{scene_id}/activate` - Activate scene
- `POST /housekeeping/scripts/{script_id}/run` - Run script
- `POST /housekeeping/automations/{automation_id}/toggle` - Enable/disable automation
Abstracts Home Assistant for the Tatlock Housekeeper agent and other consumers.
### Web Scraper
Intelligent web scraping with main content extraction.
Perfect for extracting articles, documentation, and blog posts for LLM consumption.
## Authentication
When OIDC authentication is enabled (oidc_enabled=true in config):
- Infrastructure write endpoints require authentication
- Use OAuth2/OIDC bearer token from Authentik
- Admin group membership required for infrastructure operations
## Integration
This API is designed to integrate with:
- **Open WebUI**: Direct OpenAI API compatibility
- **Open WebUI Functions**: Import via OpenAPI spec
- **Open WebUI Pipelines**: Use as data source
- **LangChain**: Compatible with standard HTTP tools
## Documentation
- **OpenAPI Spec**: `/openapi.json`
- **Swagger UI**: `/docs`
- **ReDoc**: `/redoc`
""", """,
docs_url="/docs", docs_url="/docs",
redoc_url="/redoc", redoc_url=None,
openapi_url="/openapi.json", openapi_url="/openapi.json",
lifespan=lifespan, lifespan=lifespan,
debug=settings.debug, debug=settings.debug,
Regular → Executable
View File