feat: Improve Ollama settings UX

- Auto-save settings before testing connection
- Make model list clickable for easy selection
- Models auto-populate when clicked
- Better user experience for Ollama configuration

Now users can click on a model from the list to select it instantly.
This commit is contained in:
salvacybersec
2025-11-10 21:21:29 +03:00
parent 947d2b521b
commit 1107ce1af1

View File

@@ -148,6 +148,14 @@ function Settings() {
setAlerts({ ...alerts, ollama: null }); setAlerts({ ...alerts, ollama: null });
try { try {
// First save the settings if they are filled
if (settings.ollama_server_url && settings.ollama_model) {
await axios.put(`${API_URL}/api/ollama/settings`, {
ollama_server_url: settings.ollama_server_url,
ollama_model: settings.ollama_model,
}, { withCredentials: true });
}
const response = await axios.get( const response = await axios.get(
`${API_URL}/api/ollama/test`, `${API_URL}/api/ollama/test`,
{ withCredentials: true } { withCredentials: true }
@@ -425,10 +433,20 @@ function Settings() {
{ollamaModels.length > 0 && ( {ollamaModels.length > 0 && (
<Alert severity="info" sx={{ mt: 2 }}> <Alert severity="info" sx={{ mt: 2 }}>
<Typography variant="body2" fontWeight="bold"> <Typography variant="body2" fontWeight="bold">
Mevcut Modeller: Mevcut Modeller (tıklayarak seçin):
</Typography> </Typography>
{ollamaModels.map((model, idx) => ( {ollamaModels.map((model, idx) => (
<Typography key={idx} variant="body2"> <Typography
key={idx}
variant="body2"
sx={{
cursor: 'pointer',
'&:hover': { backgroundColor: 'action.hover' },
p: 0.5,
borderRadius: 1,
}}
onClick={() => setSettings({ ...settings, ollama_model: model.name })}
>
{model.name} ({(model.size / 1024 / 1024 / 1024).toFixed(1)} GB) {model.name} ({(model.size / 1024 / 1024 / 1024).toFixed(1)} GB)
</Typography> </Typography>
))} ))}