Show AI tools only in edit mode; open existing summary without regenerating

- Hide AI tools panel when entry is not in edit mode
- Clicking AI button when a summary already exists opens it directly
  instead of triggering a new API call; Re-run still available in modal

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-05-08 17:22:16 -04:00
parent bdba092de0
commit 66c0be65c4
2 changed files with 19 additions and 9 deletions

View File

@@ -157,9 +157,17 @@ function handle_save() {
<!-- Trigger Button -->
<button
type="button"
onclick={generate_ai_result}
onclick={() => {
if (summary) {
tmp_summary = summary;
active_tab = 'result';
show_modal = true;
} else {
generate_ai_result();
}
}}
class={buttonClass}
title="Generate AI summary/analysis">
title={summary ? 'View existing AI summary' : 'Generate AI summary/analysis'}>
{#await ae_promises}
<Loader class="mr-1 inline-block animate-spin" size="1.2em" />
<span class="text-sm">Processing...</span>