Editable analysis prompts on the admin page
The system prompts of the free summary and the paid detailed analysis can be edited per language under /admin/promptok. Every save is a new row in prompt_revisions (NULL = built-in text); new analyses record the revision in prompt_version (v2-r<id>) and the worker uses exactly that text. Existing analyses stay; the cross-user cache only copies results of the same revision. The prompt code moves to the shared analysis-prompt crate so the backend can show the built-in text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -101,10 +101,21 @@ impl Analyzer {
|
||||
compact::synastry(&chart1, &chart2, &result)
|
||||
}
|
||||
};
|
||||
if job.prompt_version != PROMPT_VERSION {
|
||||
let (base, revision) = prompt::split_version(&job.prompt_version);
|
||||
if base != PROMPT_VERSION {
|
||||
tracing::warn!(id = %job.id, requested = %job.prompt_version, current = PROMPT_VERSION, "prompt version differs");
|
||||
}
|
||||
Ok(prompt::build(kind, &job.language, &text))
|
||||
// An admin-edited system prompt; NULL (or a missing row) means the built-in one.
|
||||
let system: Option<String> = match revision {
|
||||
Some(id) => sqlx::query_scalar("SELECT system FROM prompt_revisions WHERE id = $1")
|
||||
.bind(id)
|
||||
.fetch_optional(&self.db)
|
||||
.await
|
||||
.map_err(db_err)?
|
||||
.flatten(),
|
||||
None => None,
|
||||
};
|
||||
Ok(prompt::build(kind, &job.language, &text, system.as_deref()))
|
||||
}
|
||||
|
||||
/// Writes one claimed analysis and records the outcome.
|
||||
|
||||
Reference in New Issue
Block a user