feat: added llm based context specific for issues in post/debugging#235
Open
vedanshkap2692 wants to merge 2 commits into
Open
feat: added llm based context specific for issues in post/debugging#235vedanshkap2692 wants to merge 2 commits into
vedanshkap2692 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements optional LLM-powered, context-aware fix suggestions with caching, UI indicators, and graceful fallback to the existing rule-based engine.
Key behavior
LLM_ENABLED=trueand a validLLM_API_KEYis available, the engine calls the LLM to generate concise, context-aware fixes for detected issues and replaces the generic rule-based suggestion.ai_generatedandai_cachedflags so clients can surface an “AI” badge and tooltip when appropriate.Related Issue
Fixes #
Type of change
.envloading visibility)Files changed (high level)
Backend
backend/app/services/ai_provider.pycall_llm_sync()get_fix_for_issue()_LLM_FIX_CACHEwith TTL-based cachingbackend/app/services/code_assistant.pyrun_bug_detection()now integrates withai_provider.get_fix_for_issue()ai_generatedandai_cachedmetadatabackend/app/schemas.pyIssuemodel with:code_contextai_generatedai_cachedHealthResponsewith:llm_enabledllm_modelbackend/app/main.py.envearly during startup/importFrontend
frontend/index.htmlfrontend/script.js.ai-badgeUI support8010Tests
backend/tests/test_endpoints.pyChecklist
CONTRIBUTING.mdmainpytest -vand all tests passfeat/fix/docs/test: short descriptionHow to test locally
1. Configure environment variables
Create a
.envfile in the project root:Test
POST /debugging/with:{ "code": "eval('2+2')" }Expected:
"ai_generated": true"ai_cached": falseon first request"ai_cached": trueon repeated requestExpected: