Add GET /enhance/prompts: recent distinct Enhance prompts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cameron CordesandClaude Opus 5.5 committed 2026-10-31 12:43:27 -04:00
1 parent c6d04589d1
commit cdc339021b
7 files changed
+243 -3

No files matched your search

+15 -2
View File
@@ -18,8 +18,8 @@ use super::config::{EnhanceConfig, Loaded, PromptMode};
use super::path_map::PathMap;
use super::template::Template;
use crate::database::enhance_dao::{
EnhanceJobDao, EnhanceJobRow, JobUpdate, STATUS_APPROVED, STATUS_EXPIRED, STATUS_FAILED,
STATUS_QUEUED, STATUS_READY, STATUS_RUNNING, STATUS_UNAVAILABLE,
EnhanceJobDao, EnhanceJobRow, JobUpdate, RecentPrompt, STATUS_APPROVED, STATUS_EXPIRED,
STATUS_FAILED, STATUS_QUEUED, STATUS_READY, STATUS_RUNNING, STATUS_UNAVAILABLE,
};
/// Short timeout for the `available` probe, so the templates call stays snappy
@@ -392,6 +392,19 @@ impl EnhanceService {
.map_err(|e| EnhanceError::Internal(e.to_string()))
}
/// Distinct recent prompts; DB only, so it works with ComfyUI down.
pub fn recent_prompts(
&self,
templates: Option<&[String]>,
limit: i64,
) -> Result<Vec<RecentPrompt>, EnhanceError> {
self.dao
.lock()
.unwrap()
.recent_prompts(templates, limit)
.map_err(|e| EnhanceError::Internal(e.to_string()))
}
/// Hide a job from the per-photo list. Nothing is deleted on ComfyUI:
/// staged results vanish on its restart anyway.
pub fn discard(&self, id: &str) -> Result<EnhanceJobRow, EnhanceError> {