feat: Give LLM date context for security reviews - #143
Conversation
📝 WalkthroughWalkthroughOllamaService's prompt-sending methods (SendPrompt, SendPromptWithChunking) now accept an optional systemPrompt parameter, forwarded into the Ollama request payload and through chunked calls. AnalyzeDiff computes today's UTC date and appends a date-aware system prompt when invoking SendPromptWithChunking. ChangesSystem Prompt Support in OllamaService
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant OllamaService
participant OllamaAPI
Caller->>OllamaService: AnalyzeDiff(diff)
OllamaService->>OllamaService: compute today (UTC)
OllamaService->>OllamaService: build systemPrompt with today
OllamaService->>OllamaService: SendPromptWithChunking(prompt, systemPrompt)
loop each chunk
OllamaService->>OllamaAPI: SendPrompt(chunkPrompt, systemPrompt)
OllamaAPI-->>OllamaService: chunk result
end
OllamaService->>OllamaAPI: SendPrompt(finalPrompt, systemPrompt)
OllamaAPI-->>OllamaService: consolidated result
OllamaService-->>Caller: analysis result
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@PatchPanda.Web/Services/OllamaService.cs`:
- Line 199: The date formatting in OllamaService should use an invariant culture
so the prompt always gets a consistent ISO date string regardless of host locale
settings. Update the DateTime.UtcNow.ToString call in the relevant method of
OllamaService to use the CultureInfo.InvariantCulture overload, keeping the
existing yyyy-MM-dd format.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 8398c3af-28c4-44bf-b03b-38c048591bfa
📒 Files selected for processing (1)
PatchPanda.Web/Services/OllamaService.cs
Summary by CodeRabbit