Feature: Add configurable LLM endpoint for Claude-compatible alternatives
This commit is contained in:
@@ -33,6 +33,7 @@ class AdminController {
|
||||
public function load(): JSONResponse {
|
||||
$clientId = $this->config->getAppValue('google_client_id', 'analyticshub', '');
|
||||
$apiKey = $this->config->getAppValue('anthropic_api_key', 'analyticshub', '');
|
||||
$llmEndpoint = $this->config->getAppValue('llm_api_endpoint', 'analyticshub', '');
|
||||
$refreshToken = $this->config->getAppValue('google_refresh_token', 'analyticshub', '');
|
||||
|
||||
// Check if configured
|
||||
@@ -54,6 +55,7 @@ class AdminController {
|
||||
'data' => [
|
||||
'google_client_id' => $clientId,
|
||||
'google_refresh_token' => $maskedRefreshToken,
|
||||
'llm_api_endpoint' => $llmEndpoint,
|
||||
'anthropic_api_key' => $maskedApiKey,
|
||||
'is_configured' => $isConfigured,
|
||||
],
|
||||
@@ -77,6 +79,7 @@ class AdminController {
|
||||
$clientSecret = $data['google_client_secret'] ?? '';
|
||||
$refreshToken = $data['google_refresh_token'] ?? '';
|
||||
$apiKey = $data['anthropic_api_key'] ?? '';
|
||||
$llmEndpoint = $data['llm_api_endpoint'] ?? '';
|
||||
|
||||
if (empty($clientId) || empty($clientSecret) || empty($apiKey)) {
|
||||
return new JSONResponse([
|
||||
@@ -93,6 +96,10 @@ class AdminController {
|
||||
$this->config->setAppValue('google_refresh_token', 'analyticshub', $refreshToken);
|
||||
}
|
||||
|
||||
if (!empty($llmEndpoint)) {
|
||||
$this->config->setAppValue('llm_api_endpoint', 'analyticshub', $llmEndpoint);
|
||||
}
|
||||
|
||||
$this->config->setAppValue('anthropic_api_key', 'analyticshub', $apiKey);
|
||||
|
||||
// Check if fully configured
|
||||
|
||||
@@ -61,6 +61,7 @@ class PageController extends \OCP\AppFramework\Controller {
|
||||
// Get configuration values (masked for secrets)
|
||||
$clientId = $this->config->getAppValue('google_client_id', 'analyticshub', '');
|
||||
$apiKey = $this->config->getAppValue('anthropic_api_key', 'analyticshub', '');
|
||||
$llmEndpoint = $this->config->getAppValue('llm_api_endpoint', 'analyticshub', '');
|
||||
|
||||
// Mask API key for display
|
||||
$maskedApiKey = '';
|
||||
@@ -76,6 +77,7 @@ class PageController extends \OCP\AppFramework\Controller {
|
||||
'is_ga_configured' => $isGAConfigured,
|
||||
'is_llm_configured' => $isLLMConfigured,
|
||||
'google_client_id' => $clientId,
|
||||
'llm_api_endpoint' => $llmEndpoint,
|
||||
'anthropic_api_key_masked' => $maskedApiKey,
|
||||
'request' => $this->request,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user