Enhance AICore model validation and logging

- Improved model configuration handling in AICore to ensure only supported models are set as default.
- Added error logging for invalid model configurations and warnings for missing models.
- Implemented validation checks for the active model to provide clear error messages when no valid model is configured.
- Enhanced user feedback during AI model selection to improve debugging and configuration clarity.
This commit is contained in:
Desktop
2025-11-10 20:18:19 +05:00
parent d17d87a375
commit 4277c93e44
2 changed files with 94 additions and 53 deletions

View File

@@ -232,6 +232,57 @@ export function useProgressModal(): UseProgressModalReturn {
`/v1/system/settings/task_progress/${taskId}/`
);
// Helper function to start auto-increment progress (1% every 300ms until 80%)
const startAutoIncrement = () => {
// Clear any existing auto-increment interval
if (autoIncrementIntervalRef.current) {
clearInterval(autoIncrementIntervalRef.current);
autoIncrementIntervalRef.current = null;
}
// Only start if we're below 80%
if (displayedPercentageRef.current < 80) {
autoIncrementIntervalRef.current = setInterval(() => {
setProgress(prev => {
// Check current status - stop if not processing
if (prev.status !== 'processing') {
if (autoIncrementIntervalRef.current) {
clearInterval(autoIncrementIntervalRef.current);
autoIncrementIntervalRef.current = null;
}
return prev;
}
const current = displayedPercentageRef.current;
if (current < 80) {
const newPercentage = Math.min(current + 1, 80);
displayedPercentageRef.current = newPercentage;
// Stop if we've reached 80%
if (newPercentage >= 80) {
if (autoIncrementIntervalRef.current) {
clearInterval(autoIncrementIntervalRef.current);
autoIncrementIntervalRef.current = null;
}
}
return {
...prev,
percentage: newPercentage,
};
} else {
// Stop if we've reached 80%
if (autoIncrementIntervalRef.current) {
clearInterval(autoIncrementIntervalRef.current);
autoIncrementIntervalRef.current = null;
}
return prev;
}
});
}, 300);
}
};
if (response.state === 'PROGRESS') {
const meta = response.meta || {};
@@ -404,57 +455,6 @@ export function useProgressModal(): UseProgressModalReturn {
startAutoIncrement();
}
// Helper function to start auto-increment progress (1% every 300ms until 80%)
const startAutoIncrement = () => {
// Clear any existing auto-increment interval
if (autoIncrementIntervalRef.current) {
clearInterval(autoIncrementIntervalRef.current);
autoIncrementIntervalRef.current = null;
}
// Only start if we're below 80%
if (displayedPercentageRef.current < 80) {
autoIncrementIntervalRef.current = setInterval(() => {
setProgress(prev => {
// Check current status - stop if not processing
if (prev.status !== 'processing') {
if (autoIncrementIntervalRef.current) {
clearInterval(autoIncrementIntervalRef.current);
autoIncrementIntervalRef.current = null;
}
return prev;
}
const current = displayedPercentageRef.current;
if (current < 80) {
const newPercentage = Math.min(current + 1, 80);
displayedPercentageRef.current = newPercentage;
// Stop if we've reached 80%
if (newPercentage >= 80) {
if (autoIncrementIntervalRef.current) {
clearInterval(autoIncrementIntervalRef.current);
autoIncrementIntervalRef.current = null;
}
}
return {
...prev,
percentage: newPercentage,
};
} else {
// Stop if we've reached 80%
if (autoIncrementIntervalRef.current) {
clearInterval(autoIncrementIntervalRef.current);
autoIncrementIntervalRef.current = null;
}
return prev;
}
});
}, 300);
}
};
// Update step logs if available
if (meta.request_steps || meta.response_steps) {
// Collect all steps for display in modal