ModelConfig.php
- Pfad:
src/Infrastructure/AI/ModelConfig.php - Namespace: Infrastructure\AI
- Zeilen: 111 | Größe: 2,713 Bytes
- Geändert: 2025-12-28 23:21:31 | Gescannt: 2025-12-31 10:22:15
Code Hygiene Score: 100
- Dependencies: 100 (25%)
- LOC: 100 (20%)
- Methods: 100 (20%)
- Secrets: 100 (15%)
- Classes: 100 (10%)
- Magic Numbers: 100 (10%)
Keine Issues gefunden.
Klassen 1
-
ModelConfigclass Zeile 14
Funktionen 10
-
getAll()public Zeile 21 -
getVisionModels()public Zeile 31 -
getLabel()public Zeile 39 -
isValid()public Zeile 47 -
validate()public Zeile 64 -
isLocal()public Zeile 72 -
getDefaultModel()public Zeile 80 -
getDefaultVisionModel()public Zeile 88 -
clearCache()public Zeile 96 -
syncFromOllama()public Zeile 106
Verwendet von 1
- model-select.php use
Versionen 7
-
v7
2025-12-28 23:21 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v6
2025-12-25 13:29 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v5
2025-12-23 08:06 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v4
2025-12-23 07:39 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Write-Operation -
v3
2025-12-22 10:14 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v2
2025-12-22 10:11 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v1
2025-12-22 10:00 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation
Code
<?php
declare(strict_types=1);
namespace Infrastructure\AI;
// @responsibility: Legacy-Interface für Modell-Konfiguration (delegiert an ModelRegistry)
/**
* @deprecated Use ModelRegistry via DI instead. This class will be removed in a future version.
* Views still use this temporarily until they are refactored.
* @see ModelRegistry
*/
final class ModelConfig
{
/**
* Get all available chat models.
*
* @return array<string, string> [model_key => display_name]
*/
public static function getAll(): array
{
return ModelRegistry::getInstance()->getChatModels();
}
/**
* Get vision-capable models.
*
* @return array<string, string> [model_key => display_name]
*/
public static function getVisionModels(): array
{
return ModelRegistry::getInstance()->getVisionModels();
}
/**
* Get display label for a model ID.
*/
public static function getLabel(string $modelId): string
{
return ModelRegistry::getInstance()->getLabel($modelId);
}
/**
* Check if a model ID is valid.
*/
public static function isValid(string $modelId): bool
{
$registry = ModelRegistry::getInstance();
// Check in registry first
if ($registry->isValid($modelId)) {
return true;
}
// Fallback: accept any claude- or ollama: prefixed model
return str_starts_with($modelId, 'claude-')
|| str_starts_with($modelId, 'ollama:');
}
/**
* Validate and return model, or default if invalid.
*/
public static function validate(string $modelId): string
{
return self::isValid($modelId) ? $modelId : self::getDefaultModel();
}
/**
* Check if model is a local (Ollama) model.
*/
public static function isLocal(string $modelId): bool
{
return str_starts_with($modelId, 'ollama:');
}
/**
* Get default chat model.
*/
public static function getDefaultModel(): string
{
return ModelRegistry::getInstance()->getDefaultChatModel();
}
/**
* Get default vision model.
*/
public static function getDefaultVisionModel(): string
{
return ModelRegistry::getInstance()->getDefaultVisionModel();
}
/**
* Force refresh of model cache (e.g., after Ollama sync).
*/
public static function clearCache(): void
{
ModelRegistry::clearCache();
}
/**
* Sync models from Ollama.
*
* @return array Sync results
*/
public static function syncFromOllama(): array
{
return ModelRegistry::getInstance()->syncFromOllama();
}
}