- Add _extract_json_from_markdown() helper to strip markdown code blocks from LLM responses
- Update prompts to explicitly require raw JSON without markdown formatting
- Add error handling in coordinator._call_llm() with timeout, response validation, and detailed logging
- Add error handling in generation_agent for _action_generate_question() and _action_refine_question()
- Add JSON parsing validation in _generate_question_plan() and _generate_single_question_custom()
- Replace DEBUG logs with ERROR level for better visibility of LLM response issues
Fixes issue where LLM responses wrapped in markdown code blocks (e.g., ```json {...} ```)
caused 'Expecting value: line 1 column 1 (char 0)' JSON parsing errors during question generation.
Fixes embedding dimension validation errors when using OpenRouter or other
OpenAI-compatible providers with custom embedding dimensions.
Problem:
- The openai_embed function is decorated with @wrap_embedding_func_with_attrs
- Creating another EmbeddingFunc wrapper around it caused double decoration
- This resulted in 'Vector count mismatch' errors during RAG queries
- Citations failed to generate due to embedding validation failures
Solution:
- Use openai_embed.func to access the unwrapped function
- Prevents double decoration and dimension mismatch errors
- Follows LightRAG's documented pattern for composing decorated functions
Impact:
- Enables OpenRouter and other providers to work correctly
- Fixes citation generation in RAG queries
- Resolves 'expected X vectors but got Y vectors' errors
Tested with:
- OpenRouter (text-embedding-3-large, 3072 dimensions)
- Multiple test cases including comma-separated keywords
- Both knowledge base initialization and RAG queries
Related to issue #59 (embedding provider compatibility)
Squashing some bugs and cleaning up the linting mess:
- Fixed a bug in research.py where 'config' was referenced before it was loaded in the WebSocket handler.
- Cleaned up redundant and unused imports across several agent utility files.
- Re-disabled ESLint in the pre-commit config for now since the /web directory is missing a valid configuration file.
- Normalized end-of-file formatting across the repo.
Cleaning up some critical vulnerabilities found during the last audit. Specifically:
- Upgraded jspdf in web/ to fix a critical Path Traversal vulnerability.
- Removed --exit-zero from ruff pre-commit hooks so we actually block broken code instead of just auto-fixing and moving on.
- Re-enabled ESLint in the pre-commit pipeline to maintain frontend code standards.
- Updated vitepress in docs/ to clear out some moderate CVEs in the dev server dependencies.
- Added only_need_context parameter to both LightRAG and LlamaIndex plugins
- LlamaIndex now returns raw context when only_need_context=True
- Both plugins accept **kwargs for forward compatibility
- Fixes co-writer RAG integration error: 'search_rag() got an unexpected keyword argument'
- All agents (co-writer, research, question, solve) now compatible with both plugins