Commit Graph
44 Commits
Author SHA1 Message Date
wizardchen 23db592c4a feat(api-keys): add platform-scoped API keys for control-plane automation
Introduce platform API keys with capability-based access to tenant management,
system settings, runtime queues, and audit logs, plus admin UI for key lifecycle
and system audit log viewing.
2026-07-21 17:21:35 +08:00
wizardchen 41975abcc5 refactor(terminology): rename user-facing tenant labels to workspace
Align product copy, API docs, Swagger descriptions, and i18n strings
with workspace terminology while keeping internal tenant identifiers
and headers unchanged for API compatibility.
2026-07-14 16:14:43 +08:00
wizardchen 97c36f634a refactor(api-keys): remove API key reset endpoint and update documentation
Eliminate the POST /tenants/{id}/api-key endpoint for resetting tenant API keys, transitioning to a more granular API key management approach. Update related documentation and API specifications to reflect the new structure, including changes to the tenant API key management paths. Adjust frontend code and internationalization files to remove references to the deprecated API key reset functionality, enhancing clarity and consistency across the application.
2026-07-07 12:00:13 +08:00
wizardchen d2ffc1b973 refactor(api-keys): simplify authorization to a single-role gate
Redesign tenant API key authorization around one dimension (role) plus a
central default-deny gate, replacing the previous role + KB-scoped flag model.

- Add APIKeyGate as the single authority for API-key authorization: routes
  declare one policy (MinRole) via apiKeyGroup/apiKeyRoute helpers; undeclared
  routes are denied by default. JWT principals short-circuit the gate and the
  JWT-centric RBAC guards short-circuit for API-key principals.
- Roles: viewer/contributor/admin are knowledge-base data-plane only (KB scope
  is a pure downstream data filter); owner is a full-access tenant tier that
  unlocks tenant-level infrastructure routes and is required for every method.
- Drop the KBScoped policy flag and the KB-restricted-vs-tenant branching.
- Security hardening: never disclose HMAC secret (return presence only), abort
  writes on API-key encryption failure, deny KB-restricted keys on /files, and
  backfill legacy key hashes at startup instead of O(N) plaintext scans.
- Frontend: two-level create dialog (access type -> permission level), rename
  role labels to reflect actual scope, sync en/zh/ko/ru locales.
- Fix startup self-check false-positive on trailing-slash routes and normalize
  gin paths before comparison; add regression tests.
2026-07-07 12:00:13 +08:00
wizardchen 1778c5ac7b refactor(tracing): remove Jaeger integration and related components
This commit removes Jaeger tracing support from the project, including the associated Docker configurations, Go modules, and middleware. The changes simplify the codebase by eliminating unused tracing functionality, which was previously integrated for observability. Documentation and scripts have also been updated to reflect the removal of Jaeger references.
2026-06-08 21:01:04 +08:00
wizardchen 226a37330c feat(system): add server startup time and uptime tracking
- Introduced `started_at` and `uptime_seconds` fields to the `SystemInfo` structure for tracking server boot time and uptime.
- Updated the `GetSystemInfo` handler to populate these new fields based on server runtime.
- Enhanced the frontend to display server startup time and uptime in the system information view, improving visibility for users.
- Added localization support for new labels and descriptions related to server uptime and startup time in multiple languages.
2026-06-04 15:48:04 +08:00
wizardchen d074dc067a feat(system-admin): implement revocation of system admin privileges with safeguards
- Added RevokeSystemAdmin functionality to the user service and repository, ensuring atomic checks for self-revoke and last admin scenarios.
- Updated the system handler to utilize the new revocation method, improving error handling for various edge cases.
- Enhanced the bootstrap process to prevent unintended promotions when system admins already exist.
- Refactored related comments and documentation for clarity on the new behavior and safeguards in place.
2026-05-26 21:13:56 +08:00
wizardchen 47a183aa65 feat(system-admin): implement bootstrap for system admin promotion and enhance system settings management
- Added WEKNORA_BOOTSTRAP_SYSTEM_ADMIN_EMAIL environment variable to promote a specified user to system admin on startup.
- Introduced a new bootstrap process in `bootstrap.go` to handle the promotion logic.
- Updated `.env.example` to document the new environment variable and its behavior.
- Created new views for managing system administrators and system settings, including listing, promoting, and revoking admin privileges.
- Enhanced the frontend to reflect the new system admin features, including UI elements for admin management and settings configuration.
- Updated API interfaces to support system admin functionalities, ensuring proper data handling and user management.
2026-05-26 21:13:56 +08:00
wizardchen 31d5566a50 chore(runtime): silence gin per-route logs and emit env config banner at startup
Two unrelated startup-noise fixes bundled because they share one file
(internal/runtime/startup.go) and one motivation (make the boot log
useful again).

Gin per-route spam
------------------
With ~150 registered routes, DebugMode prints one "[GIN-debug] METHOD
path --> handler" line per route, drowning out everything else. Override
gin.DebugPrintRouteFunc to a counter and gin.DebugPrintFunc to route
through the structured logger. A single "[gin] registered N routes"
summary prints once router build is complete. DebugMode behaviour
otherwise (panic recovery, runtime warnings) is preserved.

Env config banner
-----------------
Operators had no easy way to confirm SYSTEM_AES_KEY (or any other
critical env) was actually loaded — getting the byte length wrong is
particularly silent: utils.GetAESKey() returns nil for anything other
than exactly 32 bytes, which simply disables encryption.

LogStartupEnv prints one line per curated env var (security + DB +
storage + redis), with sensitive values redacted as "set (N chars)"
and unset values as "<unset>". Followed by targeted footgun warnings —
the AES-256 length check fires loudly when SYSTEM_AES_KEY is set but
wrong-length.

Both helpers are called from cmd/server and cmd/desktop. The env banner
runs before container.BuildContainer so it prints even if DB / storage
init fails.
2026-05-17 15:27:52 +08:00
wizardchen 11811f9bf8 fix(agent): load all sheets from Excel files in data analysis (#1007)
DuckDB's st_read (spatial) only reads the first layer/sheet of a .xlsx
workbook, so every sheet beyond Sheet1 was silently dropped from the
DuckDB table the Data Analysis tool builds. Users trying to analyse
multi-sheet workbooks could only see the first sheet.

Switch to DuckDB's dedicated 'excel' extension (read_xlsx) for the
actual data load, enumerate sheets via the spatial extension's
st_read_meta, and UNION ALL BY NAME the rows of every sheet into one
table. A synthetic __sheet_name column records the source so the LLM
can still filter/aggregate per sheet; schema drift between sheets is
tolerated via UNION BY NAME. If enumeration fails (older DuckDB, local
filesystem errors, …) we fall back to reading the first sheet so the
tool stays usable.

- Install & LOAD the 'excel' extension alongside 'spatial' both at
  startup (internal/container) and in the offline prefetch binary
  (cmd/download/duckdb).
- Harden sheet/path handling against single quotes.
- Update the tool description so the agent knows about __sheet_name.
- Add unit tests for the CREATE TABLE SQL builder covering 0 / 1 / N
  sheets and quote escaping.

Refs: https://github.com/Tencent/WeKnora/issues/1007
2026-04-24 19:57:56 +08:00
wizardchen ae95cb1a7a feat: add server listening functionality with retry mechanism and platform-specific shutdown signal handling for improved robustness 2026-04-11 19:09:25 +08:00
wizardchen 9874fcee7c feat: implement automatic update checking and downloading functionality in the desktop app, enhancing user experience with seamless updates and corresponding UI settings 2026-04-11 18:51:16 +08:00
wizardchen e49ff986eb feat: implement app reload functionality via global key event and menu action, enhancing user experience with dynamic content updates 2026-04-11 18:51:16 +08:00
wizardchen dfaaa62f14 feat: add LAN access configuration for desktop app, allowing users to enable public API access with corresponding UI updates and translations 2026-04-11 18:51:16 +08:00
wizardchen d99e2cbac3 feat: implement fixed local API port settings for desktop app, allowing users to specify a port for consistent access, with corresponding UI and translations 2026-04-11 18:51:16 +08:00
wizardchen 4e9769bbab feat: add About dialog with version info and GitHub link, enhancing user accessibility to project resources 2026-04-11 18:51:16 +08:00
wizardchen 6d8b47e57c feat: implement theme synchronization and loading skeletons across various components, enhancing user experience during content loading 2026-04-11 18:51:16 +08:00
wizardchen 92bf52721c feat: implement auto-setup for Lite edition, enhancing user experience by automating user and tenant creation on first launch 2026-04-11 18:51:16 +08:00
wizardchen 52bdfd388a feat: implement desktop app structure with API base URL handling and bindings for Wails integration 2026-04-11 18:51:16 +08:00
wizardchen 5c4229745d fix: restore indirect dependency for golang.org/x/sys and refine drag selection logic in desktop app 2026-04-11 18:51:16 +08:00
wizardchen 997bf582ad feat: enhance GitHub Actions workflow to build and package desktop app for multiple platforms, including macOS, Linux, and Windows 2026-04-11 18:51:16 +08:00
wizardchen 9a2b54536d fix: update environment configuration for debugging and logging, enhance SQLite FTS5 table management, and improve API base URL handling 2026-04-11 18:51:16 +08:00
wizardchen a056d3fe1d fix: stabilize desktop dragging with inline drag markers and disable resize 2026-04-11 18:51:16 +08:00
wizardchen 3e029b3a5c fix: handle desktop window dragging via delegated mousedown for SPA headers 2026-04-11 18:51:16 +08:00
wizardchen 81df357b63 fix: refine macOS titlebar draggable CSS to fix child element blocking 2026-04-11 18:51:16 +08:00
wizardchen c63c3fa875 feat: expand draggable areas for macOS hiddenInset titlebar in desktop app 2026-04-11 18:51:16 +08:00
wizardchen a6b9914254 fix: inject CSS to make macOS window draggable via Wails OnDomReady 2026-04-11 18:51:16 +08:00
wizardchen 0a964ac0b7 fix: resolve desktop app crash on launch by fixing working directory and loading resources 2026-04-11 18:51:16 +08:00
wizardchen 026c4c7662 fix: resolve neo4j parsing issue during macOS desktop app build by skipping bindings and fixing paths 2026-04-11 18:51:16 +08:00
wizardchen c2b0d81a81 fix: use random port instead of fixed port for desktop app backend to avoid conflicts 2026-04-11 18:51:16 +08:00
wizardchen 96fb36ebb3 feat: introduce macOS desktop app using Wails wrapper 2026-04-11 18:51:16 +08:00
wizardchen 0e01a8ca64 feat(server): enhance server startup and shutdown process
- Added support for SO_REUSEPORT in the listenWithRetry function to improve port binding during hot-reloads.
- Implemented graceful shutdown by closing the listener immediately upon receiving a shutdown signal, allowing for quicker port release.
- Updated logging to provide clearer feedback during server shutdown and error handling.
2026-03-25 22:08:29 +08:00
wizardchen 109393dd16 fix(server): reduce kill delay and implement port retry mechanism
- Changed the kill delay from 30 seconds to 2 seconds in the configuration.
- Refactored the server startup process to include a retry mechanism for binding to the port, addressing potential issues during hot-reload scenarios.
- Added a new function, listenWithRetry, to handle port binding with exponential backoff, improving server reliability during restarts.
2026-03-25 22:08:29 +08:00
hylaz 8399527022 fix: cleanupCtx 在启动时创建,可能在 shutdown 前过期 2026-03-05 11:17:51 +08:00
wizardchen 2a5cf57589 fix: improve Makefile and duckdb.go for better environment handling
- Updated the Makefile to export the EDITION variable for the lite build process, ensuring proper environment setup.
- Added a defer statement in duckdb.go to ensure the SQL database connection is closed after use, improving resource management.

These changes enhance the build process and resource handling in the application.
2026-03-02 21:21:49 +08:00
hobostayandClaude Sonnet 4.5 a39c9dab9b fix: replace standard log with structured logger in main and recovery middleware
This PR continues the migration to structured logging by replacing the
standard Go log package usage with the project's structured logger.

Changes:
- cmd/server/main.go: Replace all log.Printf, log.Println, log.Fatalf
  with logger.Infof, logger.Info, logger.Fatalf
- internal/middleware/recovery.go: Replace log.Printf with
  logger.ErrorWithFields for better panic logging with structured data
- Remove log.SetFlags and log.SetOutput from main.go as they're no
  longer needed with the structured logger

Benefits:
- Consistent logging format across the entire application
- Better log parsing and analysis with structured fields
- Request ID tracking in recovery middleware for easier debugging
- Proper integration with the project's logging configuration

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-06 17:59:15 +08:00
nullkey 3f21345546 feat: adapt preloaded skills to smart-reasoning agent 2026-02-04 20:08:49 +08:00
nullkey 33f7e7da66 feat: support agent skills
feat:support agent skills
2026-02-04 20:08:49 +08:00
begoniezhao 1b0edccfc4 feat: add download_spatial target and DuckDB spatial extension handling 2026-01-05 15:01:50 +08:00
wizardchen 5e16af8cf9 docs: 更新API文档链接至新路径;新增知识搜索API文档;增强FAQ和标签删除接口说明;移除Swagger文档中的硬编码主机配置 2025-12-24 20:47:08 +08:00
wizardchen ac21f81dda feat: 新增API Key认证支持,优化Swagger文档安全配置 2025-12-22 15:01:09 +08:00
wizardchen a7df6900eb feat: 完善Swagger API文档生成功能 2025-12-17 22:04:18 +08:00
wizardchen bdabed6bfa feat: Added web page for configuring model information 2025-08-10 17:11:07 +08:00
wizardchen 56eb2bce33 init commit 2025-08-05 15:08:07 +08:00