feat(astrolabe): add admin search settings and enhanced UI

Add comprehensive admin controls for the unified search provider and enhance the frontend UI with filtering and visualization improvements.

**Admin Settings:**
- Configure default search algorithm (hybrid, semantic, bm25)
- Set fusion method for hybrid search (rrf, dbsf)
- Adjust minimum score threshold (0-100%)
- Set result limit (1-100 results)

**Frontend Enhancements:**
- Add score-based result filtering with slider control
- Add expandable excerpts for search results
- Improve result visualization and formatting
- Add algorithm badge to show search method used

**API Changes:**
- Add `/api/admin/search-settings` POST endpoint
- Add `searchForUnifiedSearch()` method to McpServerClient
- Load and apply admin settings in SemanticSearchProvider

**Technical Details:**
- Settings stored in app config table
- Defaults: hybrid algorithm, rrf fusion, 0% threshold, 20 results
- SemanticSearchProvider respects admin-configured limits

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2025-12-18 00:01:19 +01:00
co-authored by Claude Sonnet 4.5
parent 24e63a967a
commit 4cce4f6392
10 changed files with 440 additions and 12 deletions
+37
View File
@@ -18,6 +18,17 @@ use OCP\Settings\ISettings;
* configuration, and provides administrative controls.
*/
class Admin implements ISettings {
// Search settings keys and defaults
public const SETTING_SEARCH_ALGORITHM = 'search_algorithm';
public const SETTING_SEARCH_FUSION = 'search_fusion';
public const SETTING_SEARCH_SCORE_THRESHOLD = 'search_score_threshold';
public const SETTING_SEARCH_LIMIT = 'search_limit';
public const DEFAULT_SEARCH_ALGORITHM = 'hybrid';
public const DEFAULT_SEARCH_FUSION = 'rrf';
public const DEFAULT_SEARCH_SCORE_THRESHOLD = 0;
public const DEFAULT_SEARCH_LIMIT = 20;
private $client;
private $config;
private $initialState;
@@ -59,6 +70,30 @@ class Admin implements ISettings {
);
}
// Load search settings from app config
$searchSettings = [
'algorithm' => $this->config->getAppValue(
Application::APP_ID,
self::SETTING_SEARCH_ALGORITHM,
self::DEFAULT_SEARCH_ALGORITHM
),
'fusion' => $this->config->getAppValue(
Application::APP_ID,
self::SETTING_SEARCH_FUSION,
self::DEFAULT_SEARCH_FUSION
),
'scoreThreshold' => (int)$this->config->getAppValue(
Application::APP_ID,
self::SETTING_SEARCH_SCORE_THRESHOLD,
(string)self::DEFAULT_SEARCH_SCORE_THRESHOLD
),
'limit' => (int)$this->config->getAppValue(
Application::APP_ID,
self::SETTING_SEARCH_LIMIT,
(string)self::DEFAULT_SEARCH_LIMIT
),
];
// Provide initial state for Vue.js frontend (if needed)
$this->initialState->provideInitialState('server-data', [
'serverStatus' => $serverStatus,
@@ -67,6 +102,7 @@ class Admin implements ISettings {
'serverUrl' => $serverUrl,
'apiKeyConfigured' => $apiKeyConfigured,
],
'searchSettings' => $searchSettings,
]);
$parameters = [
@@ -75,6 +111,7 @@ class Admin implements ISettings {
'serverUrl' => $serverUrl,
'apiKeyConfigured' => $apiKeyConfigured,
'vectorSyncEnabled' => $serverStatus['vector_sync_enabled'] ?? false,
'searchSettings' => $searchSettings,
];
return new TemplateResponse(