Update notification service

This commit is contained in:
MacRimi
2026-03-20 23:40:17 +01:00
parent 40709b7480
commit e5e6c00100
3 changed files with 35 additions and 3 deletions

View File

@@ -110,6 +110,17 @@ else
echo "⚠️ ai_providers directory not found"
fi
# Copy config files (verified AI models, etc.)
echo "📋 Copying config files..."
CONFIG_DIR="$APPIMAGE_ROOT/config"
if [ -d "$CONFIG_DIR" ]; then
mkdir -p "$APP_DIR/usr/bin/config"
cp "$CONFIG_DIR/"*.json "$APP_DIR/usr/bin/config/" 2>/dev/null || true
echo "✅ Config files copied"
else
echo "⚠️ config directory not found"
fi
echo "📋 Adding translation support..."
cat > "$APP_DIR/usr/bin/translate_cli.py" << 'PYEOF'
#!/usr/bin/env python3

View File

@@ -104,12 +104,26 @@ def test_notification():
def load_verified_models():
"""Load verified models from config file."""
"""Load verified models from config file.
Checks multiple paths:
1. Same directory as script (AppImage: /usr/bin/config/)
2. Parent directory config folder (dev: AppImage/config/)
"""
try:
config_path = Path(__file__).parent.parent / 'config' / 'verified_ai_models.json'
# Try AppImage path first (scripts and config both in /usr/bin/)
script_dir = Path(__file__).parent
config_path = script_dir / 'config' / 'verified_ai_models.json'
if not config_path.exists():
# Try development path (AppImage/scripts/ -> AppImage/config/)
config_path = script_dir.parent / 'config' / 'verified_ai_models.json'
if config_path.exists():
with open(config_path, 'r') as f:
return json.load(f)
else:
print(f"[flask_notification_routes] Config not found at {config_path}")
except Exception as e:
print(f"[flask_notification_routes] Failed to load verified models: {e}")
return {}

View File

@@ -1692,7 +1692,14 @@ class NotificationManager:
verified_models = []
recommended_model = ''
try:
config_path = Path(__file__).parent.parent / 'config' / 'verified_ai_models.json'
# Try AppImage path first (scripts and config both in /usr/bin/)
script_dir = Path(__file__).parent
config_path = script_dir / 'config' / 'verified_ai_models.json'
if not config_path.exists():
# Try development path (AppImage/scripts/ -> AppImage/config/)
config_path = script_dir.parent / 'config' / 'verified_ai_models.json'
if config_path.exists():
with open(config_path, 'r') as f:
verified_config = json.load(f)