Ver código fonte

Fix progress calculation to start from 0% instead of jumping to 50%

- Remove the problematic first generation callback logic that was setting progress to 50%
- Use actual genProgress value directly for overall progress calculation
- This allows progress to start from 0% and go to 100% naturally
Fszontagh 3 meses atrás
pai
commit
6678698a45
1 arquivos alterados com 8 adições e 15 exclusões
  1. 8 15
      src/generation_queue.cpp

+ 8 - 15
src/generation_queue.cpp

@@ -289,20 +289,13 @@ public:
             it->second.totalSteps = totalSteps;
             it->second.timeElapsed = static_cast<int64_t>(timeElapsed);
 
-            // Handle first generation callback specially
+            // Use the actual genProgress value directly for overall progress
+            // This allows progress to start from 0% and go to 100% naturally
+            it->second.progress = genProgress;
+
+            // Mark that we've handled the first callback
             if (it->second.firstGenerationCallback) {
-                // This is the first callback, ignore the incoming genProgress value
-                // and set overall progress to exactly 50% (model loading complete)
-                it->second.generationProgress = 0.0f;
-                it->second.progress = 0.5f;
-                it->second.firstGenerationCallback = false; // Mark that we've handled the first callback
-
-                LOG_DEBUG("First generation callback for job " + jobId +
-                          " - Ignored genProgress (" + std::to_string(genProgress) +
-                          "), reset generation progress to 0.0 and overall progress to 50%");
-            } else {
-                // For subsequent callbacks, calculate overall progress normally: 50% for model loading + 50% for generation
-                it->second.progress = 0.5f + (genProgress * 0.5f);
+                it->second.firstGenerationCallback = false;
             }
 
             // Clamp overall progress to valid range [0.0, 1.0]
@@ -390,10 +383,10 @@ public:
                     if (bracketPos != std::string::npos) {
                         activeJobs[request.id].prompt = activeJobs[request.id].prompt.substr(0, bracketPos);
                     }
-                    // Set model loading to complete, overall progress to exactly 50% (halfway through)
+                    // Set model loading to complete, but don't set artificial progress
                     activeJobs[request.id].modelLoadProgress = 1.0f;
                     activeJobs[request.id].generationProgress = 0.0f;
-                    activeJobs[request.id].progress = 0.5f;
+                    activeJobs[request.id].progress = 0.0f; // Start from 0% for generation
                     activeJobs[request.id].firstGenerationCallback = true; // Initialize first callback flag
                     saveJobToFile(activeJobs[request.id]);
                 }