Commit 7ac9bb4
Kba draft review fixes (#20)
* kba-draft implementiert
* - test dateien entfernt
- struktur aufgeräumt
- README.md angepasst
- learning_mechanism.md plan erstellt
- desing fixes
* feat: add search questions generation with database migration and UI
Database & Backend:
- Add search_questions column migration in operations.py (ALTER TABLE for existing databases)
- Add /api/kba/drafts/{id}/replace endpoint in app.py
- Fix backward compatibility in kba_service.py (_table_to_draft, _draft_to_table)
- Add search questions generation to replace_draft workflow
- Fix NULL constraint errors by ensuring empty strings for required fields
- Update related_tickets validation: accept INC + 9-12 digits (was fixed at 12)
Frontend:
- Add Text component import to KBADrafterPage.jsx (fix TypeError)
- Add full-screen blur overlay with centered spinner during KBA generation
- Show overlay for both new draft creation and replacement operations
- Update styles: loadingOverlay with backdrop-filter blur effect
Documentation:
- Update kba_prompts.py: clarify related_tickets format with examples
- Update GENERAL.md: correct related_tickets format specification
Fixes #1 - KBA drafts not loading (missing DB column)
Fixes #2 - Replace endpoint not found (405 error)
Fixes #3 - Ticket ID validation too strict
* tickets in popup ansehen
* feat(kba-drafter): add ability to reset reviewed KBAs back to draft
- Add "Zurück zu Entwurf" button for reviewed status KBAs
- Add handleUnreview() handler to update status from "reviewed" to "draft"
- Import ArrowUndo24Regular icon for the unreview action
- Allow users to continue editing KBAs after review without deletion
This enables editing of reviewed KBAs that need changes before publishing.
* feat(kba-drafter): add ticket viewer, unreview, status filter, and UI improvements
- Add ticket viewer dialog to display original incident details
* New "Ticket" button in KBA header with DocumentSearch icon
* Modal dialog showing incident data (ID, summary, status, priority, assignee, notes, resolution)
* Backend endpoint /api/csv-tickets/by-incident/<incident_id> for incident ID lookup
* Frontend API function getCSVTicketByIncident()
- Add unreview functionality for reviewed KBAs
* "Zurück zu Entwurf" button with ArrowUndo icon
* Allows resetting reviewed KBAs back to draft status for further editing
- Redesign KBA overview list
* Replace corner delete button with professional overflow menu (⋮)
* Horizontal layout: content left, status badge right-aligned, menu button
* Menu component with delete option
- Add status filter dropdown to KBA overview
* Filter options: All, draft, reviewed, published
* Dropdown in card header for easy filtering
- Align EditableList "Add" button width with input fields
* Use invisible placeholder buttons for exact width matching
* Ensures consistent layout regardless of allowReorder setting
Files modified:
- frontend/src/features/kba-drafter/KBADrafterPage.jsx
- frontend/src/features/kba-drafter/components/EditableList.jsx
- frontend/src/services/api.js
- backend/app.py
* fix(kba): fix draft deletion bug and add collapsible AutoGenSettings
- Fix delete draft error: use response.items instead of response.drafts
- Make AutoGenSettings card collapsible with chevron icon
- Starts collapsed to reduce visual dominance
- Smooth slide-down animation when expanded
- Status badge visible in collapsed header
- Clickable header with keyboard support (Enter key)
* fix(kba): auto-scroll to top when opening draft
When clicking on a draft from the list after scrolling down,
the page now automatically scrolls to the top with a smooth animation.
This ensures users always start at the beginning of the draft content.
* feat: replace browser confirms with custom modal dialogs for unsaved changes
Replace native window.confirm() with ConfirmDialog component for better UX
consistency and modern appearance. Adds centered warning modal when user
attempts to discard unsaved changes (close draft, switch to preview, or
load different draft).
Changes:
- Add unsavedChangesDialogOpen and pendingAction states
- Update toggleEditMode, loadDraft, and handleClose to trigger modal
- Add handleDiscardChanges and handleCancelDiscard handlers
- Add ConfirmDialog with warning intent at end of component
* fix: address code review issues and add KBA drafter e2e tests
Fixes:
- Fix CSV folder case mismatch (CSV -> csv) in app.py and operations.py
- Remove duplicate get_ticket_by_incident_id method in csv_data.py
- Replace inefficient len(session.exec().all()) with SQL COUNT(*) in kba_service.py
- Replace hardcoded placeholder credentials with env var lookups in kba_service.py
- Fix scheduler swallowing exceptions (remove bare raise, return None)
- Add settings reload at start of each scheduler run to fix race condition
- Add generation_warnings field to surface search questions failures to users
- Add schema migration for generation_warnings column
Tests:
- Add 19 Playwright e2e tests for KBA Drafter feature covering:
page load, navigation, LLM health status, draft generation,
draft display, draft list, editing, review workflow,
duplicate handling, and backend API integration
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat: add LiteLLM fallback, Playwright tests, and remove OpenAI hard dependency
- LiteLLM is now the default LLM backend (no .env or API key needed)
- Multistage model fallback chain: claude-sonnet-4 → gpt-4o → gpt-4o-mini
- OpenAI SDK still used when OPENAI_API_KEY is explicitly set
- agents.py and workbench service use ChatLiteLLM when no OpenAI key
- Added csv_ticket_stats and csv_sla_breach_tickets to agent tools
- Added KBA Drafter to Playwright nav tests and menu screenshots
- Added e2e tests: publish, delete, status filter, ticket viewer
- 32 unit tests + 5 live integration tests for LLM service
- Updated .env.example with LiteLLM-first documentation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: SubSonic731 <alessandro.roschi@bit.admin.ch>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent eb824e6 commit 7ac9bb4
72 files changed
Lines changed: 18705 additions & 136 deletions
File tree
- CSV
- backend
- agent_workbench
- kb_published
- tests
- docs
- kba_guidelines
- categories
- system
- frontend/src
- features
- kba-drafter
- components
- tickets
- services
- tests/e2e
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
2 | 13 | | |
| 14 | + | |
3 | 15 | | |
4 | | - | |
5 | | - | |
6 | | - | |
| 16 | + | |
| 17 | + | |
7 | 18 | | |
8 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
9 | 35 | | |
10 | 36 | | |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
36 | 45 | | |
37 | 46 | | |
38 | 47 | | |
39 | 48 | | |
40 | 49 | | |
41 | 50 | | |
42 | 51 | | |
43 | | - | |
44 | | - | |
| 52 | + | |
| 53 | + | |
45 | 54 | | |
46 | 55 | | |
47 | | - | |
| 56 | + | |
48 | 57 | | |
49 | 58 | | |
50 | 59 | | |
| |||
66 | 75 | | |
67 | 76 | | |
68 | 77 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 78 | + | |
73 | 79 | | |
74 | | - | |
75 | | - | |
| 80 | + | |
76 | 81 | | |
77 | | - | |
78 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
79 | 85 | | |
80 | 86 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
| 87 | + | |
85 | 88 | | |
86 | | - | |
| 89 | + | |
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
93 | | - | |
| 96 | + | |
94 | 97 | | |
95 | 98 | | |
96 | | - | |
| 99 | + | |
97 | 100 | | |
98 | 101 | | |
99 | 102 | | |
| |||
122 | 125 | | |
123 | 126 | | |
124 | 127 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | 165 | | |
217 | 166 | | |
218 | 167 | | |
| |||
234 | 183 | | |
235 | 184 | | |
236 | 185 | | |
237 | | - | |
238 | 186 | | |
239 | 187 | | |
240 | 188 | | |
241 | 189 | | |
242 | 190 | | |
243 | | - | |
244 | 191 | | |
245 | 192 | | |
246 | 193 | | |
| |||
253 | 200 | | |
254 | 201 | | |
255 | 202 | | |
256 | | - | |
257 | | - | |
258 | | - | |
| 203 | + | |
259 | 204 | | |
260 | 205 | | |
261 | 206 | | |
| |||
264 | 209 | | |
265 | 210 | | |
266 | 211 | | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
271 | 215 | | |
272 | 216 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
85 | 93 | | |
86 | 94 | | |
87 | 95 | | |
| |||
147 | 155 | | |
148 | 156 | | |
149 | 157 | | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | 158 | | |
156 | 159 | | |
157 | 160 | | |
| |||
0 commit comments