10 Commits
Author SHA1 Message Date
asepharyana 5f7ead5503 docs: README /metrics + MAX_TOKENS, smoke-test health/metrics/timing checks 2026-08-03 11:44:27 +07:00
asepharyana e8f90fc9b1 feat(metrics): prometheus /metrics + generation timing in usage
- /metrics endpoint: request/token/latency counters, tok/s gauge, build info (std-only, no deps)
- usage.duration_ms + usage.tokens_per_second in non-streaming and streaming responses
- /health now reports uptime_s, n_ctx, version
- MAX_TOKENS env config (hard cap, default 2048; 0 = unlimited)
- metrics unit tests (counters, prometheus shape, uptime monotonic)
2026-08-03 11:44:21 +07:00
asepharyanaandClaude Opus 5 7cec411cba fix(stream): robust reasoning/content split + flush un-tagged output
The incremental </think> search missed tags split across tokens, inverting
reasoning/content classification. Detect the first </think> on the full
buffer and track the content boundary as a byte offset. If the model never
closes </think>, flush the buffered text as content so clients always
receive the response. Chat UI now renders reasoning_content too.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 11:03:26 +07:00
asepharyanaandClaude Opus 5 b636496497 refactor(chat): unify generation flow and fix tool/streaming bugs
- Unified synchronous generate() core with callback; both streaming and
  non-streaming paths run it via spawn_blocking (context: std Mutex).
- build_prompt now passes tool definitions to the template (was dead) and
  embeds assistant tool-call history as XML matching the parser format;
  fixes double <tool_response> wrap and template set-scoping bug.
- Tokenize with AddBos::Never (template owns <s>) to remove double BOS.
- Streaming: preserve inter-word spaces (per-chunk trim removed), add
  [DONE] + usage chunk, emit error events, single-shot tool_calls delta.
- Strict model validation (400 on unknown model); health/UI/README aligned
  to minicpm5-1b-fable5-v2-thinking; auth returns JSON errors; n_ctx/
  n_batch/n_threads env-configurable.
- Added 18 unit tests; cargo check/clippy/fmt clean.
- scripts/smoke-test.sh for post-deploy verification on the VPS.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 08:58:13 +07:00
asepharyana 344bc195fa docs: README Nix+Caddy deploy 2026-08-02 16:44:43 +07:00
asepharyana 81c5177249 chore: port 8080 to 4010 2026-08-02 16:18:17 +07:00
asepharyana 14032db705 ci: add workflow_dispatch to notify-parent for manual triggering 2026-07-25 18:13:35 +07:00
asepharyanaandClaude Code 2a5ab8b6d5 ci(llm-api): add notify-parent workflow
Trigger repository_dispatch to parent hub repo on push to master.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-07-25 15:11:38 +07:00
asepharyanaandClaude Code e351d74fa4 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>
2026-07-25 15:07:19 +07:00
asepharyana dfd6fa66a7 chore: remove infra files managed by hub monorepo
Dockerfile, docker-compose.yml, llm-api.yml, and traefik-router.yaml
are now managed centrally in asepharyana-hub's infra/ directory.
2026-07-25 12:58:12 +07:00