Commit Graph

35 Commits

Author SHA1 Message Date
8d50ce7c22 perf: eliminate per-request SQLite queries and optimize proxy latency
Some checks failed
CI / Check (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Formatting (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Release Build (push) Has been cancelled
- Add in-memory ModelConfigCache (30s refresh, explicit invalidation)
  replacing 2 SQLite queries per request (model lookup + cost override)
- Configure all 5 provider HTTP clients with proper timeouts (300s),
  connection pooling (4 idle/host, 90s idle timeout), and TCP keepalive
- Move client_usage update to tokio::spawn in non-streaming path
- Use fast chars/4 heuristic for token estimation on large inputs (>1KB)
- Generate single UUID/timestamp per SSE stream instead of per chunk
- Add shared LazyLock<Client> for image fetching in multimodal module
- Add proxy overhead timing instrumentation for both request paths
- Fix test helper to include new model_config_cache field
2026-03-02 12:53:22 -05:00
e4cf088071 fix(dashboard): add COALESCE to SQL aggregations and empty-state handling for charts
Some checks failed
CI / Check (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Formatting (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Release Build (push) Has been cancelled
Backend: wrap SUM() queries with COALESCE in handle_time_series,
handle_clients_usage, and handle_detailed_usage to prevent NULL-induced
panics when no data exists for a time window.

Frontend: add showEmptyChart() empty-state messages and error feedback
across overview, analytics, costs, and clients pages. Rewrite analytics
loadCharts() to use Promise.allSettled() so each chart renders
independently on partial API failures.
2026-03-02 11:48:17 -05:00
9c01b97f82 fix(providers): handle tool messages in text_only message converter
Some checks failed
CI / Check (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Formatting (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Release Build (push) Has been cancelled
messages_to_openai_json_text_only() was missing tool-calling support,
causing DeepSeek 400 errors when conversations included tool turns.
Now mirrors messages_to_openai_json() logic for tool-role messages
(tool_call_id, name) and assistant tool_calls, with images replaced
by "[Image]" text.
2026-03-02 11:30:38 -05:00
d386820d16 feat(dashboard): add real system metrics endpoint and fix UI dark-theme issues
Some checks failed
CI / Check (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Formatting (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Release Build (push) Has been cancelled
- Add /api/system/metrics endpoint reading real data from /proc (CPU, memory, disk, network, load avg, uptime, connections)
- Replace hardcoded fake monitoring metrics with live API data
- Replace random chart data with real latency/error-rate/client-request charts from DB logs
- Fix light-mode colors leaking into dark theme (monitoring stream bg, settings tokens, warning card)
- Add 'models' to page title map, fix System Health card structure
- Move inline styles to CSS classes (monitoring-layout, monitoring-stream, token-item, warning-card)
- Prevent duplicate style injection in monitoring page
2026-03-02 10:52:15 -05:00
8613f30c7b fix(logging): auto-create client row to prevent FK constraint failure
Some checks failed
CI / Check (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Formatting (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Release Build (push) Has been cancelled
INSERT into llm_requests was failing with FOREIGN KEY constraint (code 787)
because client_id (e.g. 'client_sk-hobok') didn't exist in the clients table.
Add INSERT OR IGNORE for the client row within the same transaction.
2026-03-02 10:32:56 -05:00
d5d869dcc6 fix(dashboard): fix chart crash, field name mismatches, and demo data injection
Some checks failed
CI / Check (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Formatting (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Release Build (push) Has been cancelled
- overview.js: fix time-series chart crash (data is {series:[...]}, not array; field is 'time' not 'hour')
- monitoring.js: use fallback field names (total_tokens/tokens, duration_ms/duration) for WebSocket vs API compat
- monitoring.js: disable localhost demo data injection that mixed fake data with real
- websocket.js: fix duplicate condition and field name mismatches in dead-code handlers
- logging/mod.rs: add info! logs for successful DB insert and broadcast count for diagnostics
2026-03-02 10:14:20 -05:00
9318336f62 feat: add tool-calling passthrough for all providers
Some checks failed
CI / Check (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Formatting (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Release Build (push) Has been cancelled
Implement full OpenAI-compatible tool-calling support across the proxy,
enabling OpenCode to use llm-proxy as its sole LLM backend.

- Add 9 tool-calling types (Tool, FunctionDef, ToolChoice, ToolCall, etc.)
- Update ChatCompletionRequest/ChatMessage/ChatStreamDelta with tool fields
- Update UnifiedRequest/UnifiedMessage to carry tool data through the pipeline
- Shared helpers: messages_to_openai_json handles tool messages, build_openai_body
  includes tools/tool_choice, parse/stream extract tool_calls from responses
- Gemini: full OpenAI<->Gemini format translation (functionDeclarations,
  functionCall/functionResponse, synthetic call IDs, tool_config mapping)
- Gemini: extract duplicated message-conversion into shared convert_messages()
- Server: SSE streams include tool_calls deltas, finish_reason='tool_calls'
- AggregatingStream: accumulate tool call deltas across stream chunks
- OpenAI provider: add o4- prefix to supports_model()
2026-03-02 09:40:57 -05:00
942aa23f88 feat(models): add filtering and sorting to model registry and GET /api/models
Some checks failed
CI / Check (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Formatting (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Release Build (push) Has been cancelled
Add ModelFilter, ModelSortBy, SortOrder structs and list_models() method
to ModelRegistry. The /api/models endpoint now accepts query params:
provider, search, modality, tool_call, reasoning, has_cost, sort_by,
sort_order. Response also enriched with provider_name, output_limit,
modalities, tool_call, and reasoning fields.
2026-03-02 08:51:33 -05:00
2aad813ccd fix: restore let-chains and add rust-version = 1.87 to Cargo.toml
Some checks failed
CI / Check (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Formatting (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Release Build (push) Has been cancelled
Let-chains require Rust 1.87+ (stabilized May 2025). Added rust-version
field to document the MSRV so cargo warns on older toolchains.
2026-03-02 08:31:37 -05:00
2cdc49d7f2 refactor: comprehensive audit — fix bugs, harden security, deduplicate providers, add CI/Docker
Some checks failed
CI / Check (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Formatting (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Release Build (push) Has been cancelled
Phase 1: Fix compilation (config_path Option<PathBuf>, streaming test, stale test cleanup)
Phase 2: Fix critical bugs (remove block_on deadlocks in 4 providers, fix broken SQL query builder)
Phase 3: Security hardening (session manager, real auth, token masking, Gemini key to header, password policy)
Phase 4: Implement stubs (real provider test, /proc health metrics, client/provider/backup endpoints, has_images)
Phase 5: Code quality (shared provider helpers, explicit re-exports, all Clippy warnings fixed, unwrap removal, 6 unused deps removed, dashboard split into 7 sub-modules)
Phase 6: Infrastructure (GitHub Actions CI, multi-stage Dockerfile, rustfmt.toml, clippy.toml, script fixes)
2026-03-02 00:35:45 -05:00
ba643dd2b0 fix(ui): remove duplicate password field in login 2026-03-01 03:50:14 -05:00
ae004473d8 fix(ui): complete floating labels on login with proper text 2026-03-01 03:49:17 -05:00
a899df96c8 fixed login page again 2026-03-01 03:47:27 -05:00
6f8f490edb fixed login page 2026-03-01 03:45:34 -05:00
635081612e fixed logo 2026-03-01 03:43:26 -05:00
dd2a436f0e feat(ui): integrate LLMProxyLogo.png in login/sidebar/favicon + fix login alignment 2026-03-01 03:38:44 -05:00
c208ebe59b feat: implement real admin authentication and password management
- Added 'users' table to database with bcrypt hashing.
- Refactored login to verify against the database.
- Implemented 'Security' section in settings to allow changing the admin password.
- Initialized system with default user 'admin' and password 'admin'.
2026-02-26 18:47:20 -05:00
519436eb4a feat: implement analytics and cost management dashboard pages 2026-02-26 18:37:37 -05:00
25986dd255 ui: final Gruvbox theme and alignment restore 2026-02-26 18:34:50 -05:00
efb50737bf feat: implement provider credit tracking and balance management
- Added 'credit_balance' and 'low_credit_threshold' to 'provider_configs' table.
- Updated dashboard backend to support reading and updating provider credits.
- Implemented real-time credit deduction from provider balances on successful requests.
- Added visual balance indicators and configuration modal to the 'Providers' dashboard tab.
2026-02-26 18:25:39 -05:00
9b254d50ea ui: apply Gruvbox Dark theme to dashboard and charts 2026-02-26 18:22:19 -05:00
3165aa1859 feat: implement web UI for provider and model configuration
- Added 'provider_configs' and 'model_configs' tables to database.
- Refactored ProviderManager to support thread-safe dynamic updates and database overrides.
- Implemented 'Models' tab in dashboard to manage model visibility, mapping, and pricing.
- Added provider configuration modal to 'Providers' tab.
- Integrated database overrides into chat completion logic (enabled state, mapping, and cost).
2026-02-26 18:13:04 -05:00
c5fb2357ff fix: enable xAI (Grok) by default and improve provider visibility in dashboard
- Set Grok to enabled: true by default.
- Updated AppState to include raw AppConfig.
- Refactored dashboard to show all supported providers, including their configuration and initialization status (online, disabled, or error).
2026-02-26 15:56:29 -05:00
c884abe57d ui: consolidate and fix dashboard CSS alignment and sidebar issues 2026-02-26 15:54:36 -05:00
12008d5d3c feat: implement system settings page in dashboard 2026-02-26 15:52:26 -05:00
e8bcfcf8ab ui: fix alignment issues and improve responsive layout 2026-02-26 15:51:01 -05:00
2c5a6a596b ui: major UX polish and bug fixes for dashboard
- Added global loading spinner and page transitions.
- Improved sidebar with tooltips and persistent collapsed state.
- Fixed chart memory leaks by properly destroying instances on page change.
- Unified WebSocket event handling and status indicators.
- Refined stat cards, tables, and modal interactions.
- Added real backend integration for logout and session management.
2026-02-26 15:48:01 -05:00
b52e0e3af0 fix: include auth.js in dashboard overhaul 2026-02-26 15:40:17 -05:00
686163780c feat: major dashboard overhaul and polish
- Switched from mock data to real backend APIs.
- Implemented unified ApiClient for consistent frontend data fetching.
- Refactored dashboard structure and styles for a modern SaaS aesthetic.
- Fixed Axum 0.8+ routing and parameter syntax issues.
- Implemented real client creation/deletion and provider health monitoring.
- Synchronized WebSocket event structures between backend and frontend.
2026-02-26 15:40:12 -05:00
888b0e71c4 fix: update Axum route parameters to use {id} syntax for Axum 0.8 compatibility 2026-02-26 15:25:03 -05:00
f0435e4575 fix: resolve Axum 0.8 panic by removing root nesting and using fallback_service 2026-02-26 15:19:38 -05:00
99304b681c fix: use explicit SqliteConnectOptions with create_if_missing(true) to fix database connection issues in some environments 2026-02-26 15:13:45 -05:00
242c670855 fix: allow comma-separated strings for list config fields in environment variables 2026-02-26 15:07:00 -05:00
3aaa309d38 feat: enforce master token authentication and reasoning support
- Added strict token validation against LLM_PROXY__SERVER__AUTH_TOKENS.
- Integrated 'reasoning_content' support into providers and server responses.
- Updated AppState to carry valid auth tokens for request-time validation.
2026-02-26 14:12:51 -05:00
1755075657 chore: initial clean commit 2026-02-26 13:56:21 -05:00