Mail schemes updated auto system
This commit is contained in:
@@ -21,6 +21,7 @@ import {
|
||||
FormControlLabel,
|
||||
Tabs,
|
||||
Tab,
|
||||
MenuItem,
|
||||
} from '@mui/material';
|
||||
import {
|
||||
Add,
|
||||
@@ -68,14 +69,38 @@ function Templates() {
|
||||
custom_prompt: '',
|
||||
template_name: '',
|
||||
template_type: '',
|
||||
generate_html: false, // Default: use template, generate text only
|
||||
template_theme: 'red', // Default theme
|
||||
});
|
||||
const [testMailDialogOpen, setTestMailDialogOpen] = useState(false);
|
||||
const [testMailAddress, setTestMailAddress] = useState('');
|
||||
const [availableThemes, setAvailableThemes] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
loadTemplates();
|
||||
loadThemes();
|
||||
}, []);
|
||||
|
||||
const loadThemes = async () => {
|
||||
try {
|
||||
const response = await axios.get(`${API_URL}/api/ollama/themes`, {
|
||||
withCredentials: true,
|
||||
});
|
||||
setAvailableThemes(response.data.data.themes);
|
||||
} catch (error) {
|
||||
console.error('Failed to load themes:', error);
|
||||
// Set default themes if API fails
|
||||
setAvailableThemes([
|
||||
{ value: 'red', label: '🔴 Kırmızı (Acil/Uyarı)', description: 'Acil durumlar, güvenlik uyarıları' },
|
||||
{ value: 'green', label: '🟢 Yeşil (Başarı/Onay)', description: 'Onay mailleri, başarı bildirimleri' },
|
||||
{ value: 'blue', label: '🔵 Mavi (Kurumsal)', description: 'Resmi kurumsal mailler' },
|
||||
{ value: 'purple', label: '🟣 Mor (Premium)', description: 'Özel teklifler, premium içerik' },
|
||||
{ value: 'orange', label: '🟠 Turuncu (Dikkat)', description: 'Bildirimler, hatırlatmalar' },
|
||||
{ value: 'dark', label: '⚫ Siyah (Ciddi)', description: 'Ciddi/resmi konular' },
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
||||
const loadTemplates = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
@@ -178,6 +203,8 @@ function Templates() {
|
||||
custom_prompt: '',
|
||||
template_name: '',
|
||||
template_type: '',
|
||||
generate_html: false,
|
||||
template_theme: 'red',
|
||||
});
|
||||
loadTemplates();
|
||||
} catch (error) {
|
||||
@@ -617,6 +644,47 @@ function Templates() {
|
||||
onChange={(e) => setAiForm({ ...aiForm, custom_prompt: e.target.value })}
|
||||
helperText="AI'ya özel talimatlar (örn: 'Resmi dil kullan', 'Aciliyet vurgusu yap')"
|
||||
/>
|
||||
|
||||
{!aiForm.generate_html && (
|
||||
<TextField
|
||||
fullWidth
|
||||
margin="normal"
|
||||
select
|
||||
label="HTML Şablon Teması"
|
||||
value={aiForm.template_theme}
|
||||
onChange={(e) => setAiForm({ ...aiForm, template_theme: e.target.value })}
|
||||
helperText="Mailin görsel teması (sadece Text modu için)"
|
||||
>
|
||||
{availableThemes.map((theme) => (
|
||||
<MenuItem key={theme.value} value={theme.value}>
|
||||
<Box>
|
||||
<Typography variant="body1">{theme.label}</Typography>
|
||||
<Typography variant="caption" color="text.secondary">
|
||||
{theme.description}
|
||||
</Typography>
|
||||
</Box>
|
||||
</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
)}
|
||||
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Switch
|
||||
checked={aiForm.generate_html}
|
||||
onChange={(e) => setAiForm({ ...aiForm, generate_html: e.target.checked })}
|
||||
color="primary"
|
||||
/>
|
||||
}
|
||||
label="AI ile Full HTML Oluştur (İleri Seviye)"
|
||||
sx={{ mt: 2 }}
|
||||
/>
|
||||
<Typography variant="caption" color="text.secondary" display="block" sx={{ ml: 4, mt: -1 }}>
|
||||
{aiForm.generate_html
|
||||
? '⚠️ AI hem içeriği hem HTML yapısını oluşturacak (bazen hatalı olabilir)'
|
||||
: '✅ Önerilen: AI sadece içerik oluşturur, HTML şablonu hazır kullanılır'
|
||||
}
|
||||
</Typography>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={() => setAiDialogOpen(false)} disabled={aiGenerating}>
|
||||
|
||||
Reference in New Issue
Block a user