/** * Component: BookDate Settings Tab * Documentation: documentation/settings-pages.md */ 'use client'; import React from 'react'; import { Button } from '@/components/ui/Button'; import { Input } from '@/components/ui/Input'; import { useBookDateSettings } from './useBookDateSettings'; interface BookDateTabProps { onSuccess: (message: string) => void; onError: (message: string) => void; } export function BookDateTab({ onSuccess, onError }: BookDateTabProps) { const { provider, apiKey, model, baseUrl, enabled, configured, models, testing, saving, clearingSwipes, setProvider, setApiKey, setModel, setBaseUrl, setEnabled, setModels, testConnection, saveConfig, clearSwipes, } = useBookDateSettings(); return (

BookDate Configuration

Configure global AI-powered audiobook recommendations. All users share this API key, but receive personalized recommendations based on their individual library and ratings.

{/* Enable/Disable Toggle */} {configured && (

BookDate Feature

{enabled ? 'Feature is currently enabled' : 'Feature is currently disabled'}

)} {/* AI Provider */}
{/* Base URL Input - Show for Custom Provider */} {provider === 'custom' && (
{ setBaseUrl(e.target.value); setModels([]); }} placeholder="http://localhost:11434/v1" />

Examples:
• Ollama: http://localhost:11434/v1
• LM Studio: http://localhost:1234/v1
• vLLM: http://localhost:8000/v1

)} {/* API Key */}
{ setApiKey(e.target.value); setModels([]); }} placeholder={ provider === 'custom' ? 'Leave blank for local models' : configured ? '••••••••••••••••' : (provider === 'openai' ? 'sk-...' : provider === 'gemini' ? 'AIza...' : 'sk-ant-...') } />

{provider === 'custom' ? 'Optional: Leave blank if your endpoint does not require authentication (e.g., Ollama, LM Studio)' : 'The API key is stored securely and encrypted. Leave blank to keep existing key.'}

{/* Test Connection Button */} {/* Model Selection */} {models.length > 0 && (
)} {/* Note about per-user settings */} {(models.length > 0 || configured) && model && (

Note: Library scope and custom prompt preferences are now configured per-user. Users can adjust these settings in their BookDate preferences (settings icon on the BookDate page).

)} {/* Save Button */} {model && (
)} {/* Clear Swipe History */} {configured && (

Clear All Swipe History

Remove all swipe history and cached recommendations for ALL users. This will reset everyone's BookDate recommendations.

)}
); }