Skip to content

refactor: unify custom_prompt and remove Anweisungen frontend plumbing#427

Merged
Movm merged 4 commits intomasterfrom
refactor/unified-custom-prompt-cleanup
Jan 29, 2026
Merged

refactor: unify custom_prompt and remove Anweisungen frontend plumbing#427
Movm merged 4 commits intomasterfrom
refactor/unified-custom-prompt-cleanup

Conversation

@Movm
Copy link
Copy Markdown
Collaborator

@Movm Movm commented Jan 29, 2026

Summary

  • Unify per-generator Anweisungen into a single profile.custom_prompt — the backend now always injects the user's custom prompt via applyProfileDefaults(), eliminating the need for per-generator instruction columns and frontend toggle logic
  • Remove the Anweisungen toggle button and all frontend code that fetched/sent customPrompt — the backend is now the single source of truth
  • Remove dead code: useUserInstructions hook, useInstructionsStatus hook, knowledgeFormUtils, /instructions-status API endpoint, InstructionsGrid component, per-generator DB columns, and related store fields
  • Decouple document selection from source state — toggling source no longer clears selected documents/texts
  • Add migration script to move existing per-generator instructions into profile.custom_prompt

Test plan

  • Open a generator → confirm Anweisungen icon is gone
  • Generate text → confirm custom_prompt still appears in backend logs as <instructions> block
  • Confirm documents can still be selected/used without any toggle
  • Profile page → custom prompt textarea still works and saves
  • Run npx tsc --noEmit for web, api, mobile — no new type errors
  • Verify migration script applies cleanly on a test database

Movm added 4 commits January 29, 2026 23:03
- Inject profile.custom_prompt as fallback in PromptProcessor pipeline
- Remove old per-generator fields (antragPrompt, socialPrompt,
  antragGliederung) from API, web, and mobile
- Simplify instructions-status endpoint to check only custom_prompt
- Delete dead InstructionsGrid and GroupInstructionsSection components
- Keep presseabbinder and database columns unchanged
Remove the fallback guard so custom_prompt is always included when
set in the user profile, regardless of whether the frontend also
sends a customPrompt value.
Drop the 6 legacy per-generator custom prompt columns
(custom_antrag_prompt, custom_social_prompt, custom_universal_prompt,
custom_gruenejugend_prompt, custom_rede_prompt,
custom_buergeranfragen_prompt) from schema.sql and local_setup.sql.

Add SQL migration that merges existing per-type prompt data into the
unified custom_prompt field with section labels before dropping columns.

Add UI hint in profile view informing users their old Anweisungen were
migrated into the personal prompt field. Remove useUserInstructions hook
and all per-generator prompt references from form components.
…ontend plumbing

Backend now always injects profile.custom_prompt into every request,
making the frontend instructions-status check, store fields, and
knowledgeFormUtils all redundant. Also decouples source.type from
document clearing so documents remain independent of instruction state.
@Movm Movm merged commit 4266275 into master Jan 29, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant