Commit 9e15253
feat: network diagram improvements — node limit, filter persistence, report accuracy (#195)
* feat: story improvements — pre-gen screen, context-length error UX, prompt caps, timeline z-index, report filters
- Remove auto-generation on Story tab visit; show a pre-generation screen
with StoryInfoCard so users can configure settings before generating
- Detect LLM context-length exceeded errors (HTTP 422 / errorCode
CONTEXT_LENGTH_EXCEEDED) and surface the full prompt in an editable
textarea so the user can trim it and retry with a custom prompt
- Add prompt-cap controls (Max findings / Max risk matrix rows) to
StoryInfoCard: preset buttons, custom number input, and an "All" button
that shows the total count once a story has been generated
- Backend: new ContextLengthExceededException, LlmClient parses token
counts from 400 body; GenerateStoryRequest accepts customPrompt,
maxFindings, maxRiskMatrix; StoryService caps findings/risk-matrix rows
and short-circuits to custom-prompt path on retry
- Fix Recharts Tooltip z-index in TrafficTimeline so modal renders on top
- Pass user session filters to captureNetworkDiagrams in report generation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: add LLM_CONTEXT_LENGTH env var and clarify LLM_MAX_TOKENS
- Add LLM_CONTEXT_LENGTH config property so operators can explicitly set
the model's context window size instead of relying on /v1/models
auto-detection
- LlmClient now prefers the configured context length over auto-detect,
with auto-detect as fallback and a clearer log message for each path
- Clarify the 80% guard comment: it caps effectiveMaxTokens as a safety
measure, not the primary purpose of LLM_MAX_TOKENS
- LLM_MAX_TOKENS comment in .env rewritten to make clear it controls
response length only (not context window size)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: update .env.example with LLM_CONTEXT_LENGTH and corrected LLM_MAX_TOKENS comment
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: wire LLM_CONTEXT_LENGTH into docker-compose and add pre-flight token check
- Add LLM_CONTEXT_LENGTH to docker-compose.yml so operators can set it
without rebuilding the image
- LlmClient now performs a pre-flight estimate (chars/4 heuristic) before
calling the LLM server; if estimated prompt + response reserve exceeds
the known context length, throws ContextLengthExceededException
immediately — no LLM call is made
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: keep suggested question buttons visible until send is clicked
Previously clicking a suggestion immediately cleared the buttons.
Now they persist until the question is actually submitted (they
still disappear during loading as before).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: address gemini review — transaction scope, pattern precompile, dead code, timeout check
- Remove @transactional from generateStory to avoid holding a DB
connection open during multi-minute LLM calls
- Pre-compile regex Patterns as static constants in LlmClient
- Delete unused StoryCountsResponse DTO and STORY_COUNTS endpoint key
- Remove unused loadingLimits state from StoryPage
- Narrow isTimeout check: drop includes('exceeded') to avoid masking
CONTEXT_LENGTH_EXCEEDED errors as timeout messages
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: network diagram improvements — node limit banner, filter persistence, report accuracy
- Add node-limit banner to compare topology view (mirrors single-file view),
showing "Top N / All N" controls with presets and custom input; banner stays
visible even when all nodes are shown
- Per-file buildNetworkGraph in compare mode now passes maxNodes=0 so
significance filtering is applied post-merge rather than per-file
- Lift network diagram filter state into AnalysisPage so filters survive
tab navigation (session-level cache)
- Report diagram capture now uses the already-filtered nodes/edges visible
on screen instead of re-fetching, so the PDF matches exactly what the user sees
- Active filter labels are sent to the backend and rendered as a dedicated
PDF section before the topology diagrams
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: address gemini review — empty diagrams fallback, null filter guard, token heuristic, context error handling, investigation steps in retry
- AnalysisPage: fall back to a fresh conversation fetch when networkGraphStateRef
is empty (user never visited Network Diagram tab), so PDF always has diagrams
- ReportService: skip null filter strings in addNetworkDiagramFilters to prevent NPE
- LlmClient: tighten pre-flight token estimate from chars/4 to chars/2 for denser
technical content; broaden context-length error detection to catch provider variants
(Ollama, LM Studio); use estimated counts as fallback when regex finds no match
- StoryService: re-run Phase 1 investigation during custom prompt retry so
investigationSteps are preserved in the response instead of being silently dropped
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 6f42bbe commit 9e15253
10 files changed
Lines changed: 404 additions & 102 deletions
File tree
- backend/src/main/java/com/tracepcap
- report
- story/service
- frontend/src
- features
- network
- hooks
- services
- report
- pages
- Analysis
- Compare
- NetworkDiagram
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | | - | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| 13 | + | |
| 14 | + | |
12 | 15 | | |
Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
205 | 209 | | |
206 | 210 | | |
207 | 211 | | |
| |||
775 | 779 | | |
776 | 780 | | |
777 | 781 | | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
778 | 826 | | |
779 | 827 | | |
780 | 828 | | |
| |||
Lines changed: 28 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
161 | 163 | | |
162 | 164 | | |
163 | | - | |
| 165 | + | |
164 | 166 | | |
165 | 167 | | |
166 | 168 | | |
| |||
214 | 216 | | |
215 | 217 | | |
216 | 218 | | |
217 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
218 | 223 | | |
219 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
220 | 230 | | |
221 | 231 | | |
222 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
223 | 241 | | |
224 | 242 | | |
225 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
226 | 249 | | |
227 | 250 | | |
228 | 251 | | |
| |||
Lines changed: 28 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
89 | 90 | | |
90 | | - | |
| 91 | + | |
91 | 92 | | |
92 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
93 | 118 | | |
94 | 119 | | |
95 | 120 | | |
96 | 121 | | |
| 122 | + | |
97 | 123 | | |
98 | 124 | | |
99 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
58 | | - | |
| 60 | + | |
| 61 | + | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
62 | | - | |
63 | | - | |
64 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
65 | 72 | | |
66 | 73 | | |
67 | 74 | | |
| |||
87 | 94 | | |
88 | 95 | | |
89 | 96 | | |
90 | | - | |
91 | | - | |
| 97 | + | |
| 98 | + | |
92 | 99 | | |
93 | 100 | | |
94 | 101 | | |
| |||
115 | 122 | | |
116 | 123 | | |
117 | 124 | | |
118 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
119 | 148 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
| 246 | + | |
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | 29 | | |
32 | | - | |
33 | 30 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | 31 | | |
41 | 32 | | |
42 | 33 | | |
| |||
161 | 152 | | |
162 | 153 | | |
163 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
164 | 160 | | |
165 | | - | |
166 | | - | |
167 | | - | |
| 161 | + | |
| 162 | + | |
168 | 163 | | |
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 | 164 | | |
205 | 165 | | |
206 | 166 | | |
| |||
0 commit comments