refactor(llm-api): implement clean architecture following scraper pattern
Split monolithic 1012-line main.rs into layered hexagonal architecture: - Domain: entity types and LlmError enum - Application: prompt building, sampler construction, tool call parsing - Infrastructure: LlamaEngine wrapping llama-cpp-2 with isolated unsafe transmute - Presentation: Axum handlers, middleware (auth), error chain, router - Config: type-safe AppConfig with LazyLock - Bootstrap: Application struct with build() + run() Resolves build_sampler/build_sampler_params duplication. Adds simple web chat UI at GET /. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Code
parent
dfd6fa66a7
commit
e351d74fa4
+27
@@ -0,0 +1,27 @@
|
||||
// Library root — clean architecture module structure
|
||||
|
||||
// ============================================================================
|
||||
// Domain Layer — pure business logic, no framework dependencies
|
||||
// ============================================================================
|
||||
pub mod domain;
|
||||
|
||||
// ============================================================================
|
||||
// Application Layer — use cases / business orchestration
|
||||
// ============================================================================
|
||||
pub mod application;
|
||||
|
||||
// ============================================================================
|
||||
// Infrastructure Layer — implements domain ports
|
||||
// ============================================================================
|
||||
pub mod infrastructure;
|
||||
|
||||
// ============================================================================
|
||||
// Presentation Layer — Axum handlers, middleware, state, error
|
||||
// ============================================================================
|
||||
pub mod presentation;
|
||||
|
||||
// ============================================================================
|
||||
// Core Framework & Bootstrap
|
||||
// ============================================================================
|
||||
pub mod bootstrap;
|
||||
pub mod config;
|
||||
Reference in New Issue
Block a user