Commit Graph

180 Commits

Author SHA1 Message Date
Scarlet Moore
307c8fda6e Web audit scaffolding: add Playwright config, fix tsconfig types, harden error fallback check and baseURL handling in compliance suite; add audit scripts and devdep for @playwright/test. 2026-01-09 15:59:25 +11:00
Bingxi Zhao
8b5c45ddc7 docs: release ver0.4.1 v0.4.1 2026-01-09 09:57:00 +08:00
Bingxi Zhao
84509677f5 fix: docker deployment 2026-01-09 09:44:51 +08:00
Bingxi Zhao
df034d854b fix: llm providers, frontend 2026-01-09 09:29:17 +08:00
Bingxi Zhao (Frank)
6f9437b63d Merge pull request #81 from tusharkhatriofficial/fix/question-generation-json-parsing
fix: Add comprehensive error handling and JSON parsing for question g…
2026-01-09 08:54:16 +08:00
Tushar Khatri
4b5d55ae70 fix: Add comprehensive error handling and JSON parsing for question generation
- 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.
2026-01-09 02:44:02 +05:30
Bingxi Zhao
b6600ab32c fix & update docs v0.4.0 2026-01-09 01:34:36 +08:00
Pancake
42fb0ec8fd release ver0.4.0 2026-01-09 00:57:28 +08:00
Pancake
99ae39fcec Add new development files: RAG diagnostics, chat session detail, text parser 2026-01-09 00:47:24 +08:00
Pancake
efc2007911 Apply local configuration and UI enhancements after dev merge 2026-01-09 00:43:52 +08:00
Pancake
8765e58ab2 Merge dev: embedding providers enhancement (PR #79) 2026-01-09 00:40:16 +08:00
Pancake
6f3eea291a Merge branch 'main' of https://github.com/HKUDS/DeepTutor 2026-01-09 00:12:09 +08:00
Bingxi Zhao (Frank)
b1146458f8 Merge pull request #79 from FacundoMajda/dev-embeddings-providers
Dev embeddings providers
2026-01-08 23:37:41 +08:00
FacundoMajda
f34271d951 feat: Enhance embedding provider support with new models and validation features 2026-01-08 12:11:48 -03:00
Pancake
89fab8ace1 Merge dev into main: service refactoring with preserved main features 2026-01-08 21:11:11 +08:00
github-actions[bot]
d0f963ebe8 chore: update repo roster images [skip ci] 2026-01-08 12:54:34 +00:00
Bingxi Zhao (Frank)
c23d7c3677 Merge pull request #77 from kushalgarg101/feat/llm_models_support
provides more llm providers supports, fixed some ambiguities, ui updates,fixed discrepency between some elements of ui and backend were in sync.
2026-01-08 20:01:53 +08:00
Bingxi Zhao (Frank)
00dbb53f07 Merge branch 'main' into feat/llm_models_support 2026-01-08 19:58:15 +08:00
kushal garg
e61e2e9cf5 updates in files to use settings.py and llm_factory for new updated providers 2026-01-08 15:50:49 +05:30
kushal garg
f6e6b9fed3 a wrapper on top of lightrag for providing new llm providers 2026-01-08 15:49:17 +05:30
kushal garg
317ad41851 minor ui improvements and sync with backend, also addition of llm providers 2026-01-08 15:42:43 +05:30
kushal garg
e5fdf27adc better handling and management of .env variables 2026-01-08 15:41:16 +05:30
kushal garg
5143bff055 these werent made by me but have to commit them 2026-01-08 15:39:40 +05:30
FacundoMajda
2e48e5768b Add embedding providers, not just openAI. 2026-01-07 09:52:27 -03:00
Bingxi Zhao (Frank)
62b5e0de6e Merge pull request #67 from RinZ27/fix/cleanup-final
Cleanup: address reviewer feedback on PR #62 (Final)
2026-01-07 11:02:10 +08:00
Bingxi Zhao (Frank)
b58e235e57 Merge branch 'main' into fix/cleanup-final 2026-01-07 11:01:59 +08:00
Rin
340fd06d63 Cleanup: address reviewer feedback on PR #62 (Corrected) 2026-01-07 09:55:27 +07:00
github-actions[bot]
f7a01a63f8 chore: update repo roster images [skip ci] 2026-01-07 02:54:45 +00:00
Pancake
8d25d121ad fix: ui, security and web-search 2026-01-07 10:53:01 +08:00
Bingxi Zhao (Frank)
0622f04617 Merge pull request #55 from yugasun/feat/support-baidu-search
feat: support baidu ai search
2026-01-07 10:35:39 +08:00
Bingxi Zhao (Frank)
63f6d87bbe Merge pull request #51 from tusharkhatriofficial/ui/theme
UI/theme
2026-01-07 10:33:55 +08:00
Bingxi Zhao (Frank)
727ffc2629 Merge pull request #62 from RinZ27/fix/patch-security-vulnerabilities
Fix critical jspdf vuln and clean up pre-commit hooks
2026-01-07 10:25:55 +08:00
Bingxi Zhao (Frank)
c6698d56d5 Merge pull request #64 from Laksh-star/fix/openrouter-embedding-compatibility
fix: resolve double decoration in embedding functions for OpenRouter …
2026-01-07 10:21:19 +08:00
github-actions[bot]
67d787d5d4 chore: update repo roster images [skip ci] 2026-01-07 01:59:05 +00:00
github-actions[bot]
2746131cf1 chore: update repo roster images [skip ci] 2026-01-07 01:29:05 +00:00
Laksh-star
4494ffca1b fix: resolve double decoration in embedding functions for OpenRouter compatibility
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)
2026-01-07 06:40:00 +05:30
RinCodeForge927
233b4f76ca security: override esbuild version in docs to fix moderate CVE 2026-01-07 00:42:34 +07:00
RinCodeForge927
3b20344054 chore: fix ruff linting in tests and refine pre-commit config 2026-01-07 00:40:35 +07:00
RinCodeForge927
3d2e96b06e fix: resolve linting errors and stabilize pre-commit pipeline
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.
2026-01-07 00:24:15 +07:00
RinCodeForge927
e071c3755b security: patch path traversal in jspdf and tighten pre-commit hooks
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.
2026-01-06 23:52:01 +07:00
Pancake
cf595bf562 refactor: restructure project architecture with new services and logging modules 2026-01-06 23:49:33 +08:00
Bingxi Zhao (Frank)
047958cd47 Merge pull request #57 from tusharkhatriofficial/feature/rag-plugin-system
Feature/rag plugin system
2026-01-06 21:09:03 +08:00
Tushar Khatri
9b00eb3529 chore: Remove temporary documentation files
- Remove RAG_PLUGIN_INTEGRATION_COMPLETE.md (temporary marker file)
- Remove nohup.out (empty output file)
- Clean up before final push
2026-01-06 18:34:53 +05:30
github-actions[bot]
992fa2885b chore: update repo roster images [skip ci] 2026-01-06 12:52:44 +00:00
Tushar Khatri
1f51984912 fix: Add only_need_context parameter support to RAG plugins
- 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
2026-01-06 18:20:42 +05:30
Tushar Khatri
f771199381 Revert knowledge base plugin integration - keep original RAG-Anything flow
The plugin integration was adding complexity without benefit since:
1. RAG-Anything already handles LightRAG internally
2. Changed working_dir broke the normal document processing flow
3. Plugin system is only needed for queries, not document upload

Reverted changes to:
- src/knowledge/initializer.py - Back to original RAG-Anything flow
- src/knowledge/add_documents.py - Back to original flow

Plugin system still works perfectly for queries via rag_tool.py.
Document upload now works as it did before.
2026-01-06 17:55:58 +05:30
Tushar Khatri
44acb1a844 Complete RAG plugin system integration with full knowledge base support
✅ Fixed RAG Provider Selection Persistence:
- get_current_provider() now reads from env directly (not cached)
- Settings save button now saves environment variables
- Backend persists changes to .env file
- RAG provider selection survives page refreshes and server restarts

✅ Integrated Plugin System into Knowledge Base Upload Flow:
- initializer.py: Use RAG-Anything for extraction + selected plugin for indexing
- add_documents.py: Same hybrid approach for adding new documents
- Both LightRAG and LlamaIndex work seamlessly end-to-end

✅ Plugin Storage Architecture:
- LightRAG: data/knowledge_bases/{kb}/rag_storage/
- LlamaIndex: data/knowledge_bases/{kb}/llamaindex_storage/
- Both auto-create directories, no conflicts

✅ Complete Upload Flow:
1. User uploads files → saved to raw/
2. System checks RAG_PROVIDER from .env
3. RAG-Anything extracts content (PDFs, images, tables)
4. Extracted text fed to selected RAG plugin
5. Plugin builds index in provider-specific directory

✅ Files Modified:
- src/tools/rag_tool.py - Fixed get_current_provider()
- web/app/settings/page.tsx - Save env vars in handleSave()
- src/api/routers/settings.py - Persist to .env file
- src/knowledge/initializer.py - Plugin integration
- src/knowledge/add_documents.py - Plugin integration
- src/rag/plugins/lightrag.py - Auto-create directories
- src/rag/plugins/llamaindex.py - New plugin + auto-create dirs
- requirements.txt - Added llama-index dependencies

Result: Users can now seamlessly switch between LightRAG and LlamaIndex,
upload documents via dashboard, and everything works perfectly from start to end.
2026-01-06 17:47:20 +05:30
Tushar Khatri
bf21580e6c feat: implement flexible RAG plugin system with UI
Implement a modular plugin system for RAG providers that allows users to easily switch between different RAG implementations without code changes.

Core Features:
• Plugin-based architecture with automatic discovery
• Drop-in plugin support (no inheritance or factory patterns)
• Beautiful settings UI with dropdown selector
• Zero vendor lock-in - switch RAG systems instantly

Architecture:
• Created src/rag/ module with plugin infrastructure
• Auto-discovery plugin loader scans plugins directory
• Simple 3-function interface (initialize, search, delete)
• Plugin metadata with version, modes, and requirements

Backend Changes:
• Refactored src/tools/rag_tool.py to use plugin system
• Added RAG_PROVIDER environment variable to .env
• Created /api/v1/settings/rag/providers endpoint
• Updated settings API with RAG category configuration
• Migrated existing LightRAG implementation to plugin

Frontend Changes:
• Added RAG Provider section to settings page UI
• Beautiful dropdown with real-time provider descriptions
• Shows supported modes for each provider
• Auto-updates when new plugins are added

Plugin System Benefits:
✅ No code changes needed to add new RAG systems
✅ Community-friendly - anyone can contribute plugins
✅ Each knowledge base can use different RAG providers
✅ 50% less boilerplate than traditional patterns
✅ Production-ready with comprehensive documentation

Files Added:
- src/rag/__init__.py - Module initialization
- src/rag/plugin_loader.py - Auto-discovery engine
- src/rag/plugins/__init__.py - Plugins package
- src/rag/plugins/_template.py - Template for new plugins
- src/rag/plugins/lightrag.py - LightRAG plugin (default)
- src/rag/README.md - Complete documentation

Files Modified:
- src/tools/rag_tool.py - Refactored to use plugins
- src/api/routers/settings.py - Added RAG endpoints
- web/app/settings/page.tsx - Added RAG UI section
- .env - Added RAG_PROVIDER configuration

Usage:
# Switch RAG via .env
RAG_PROVIDER=lightrag

# Or via settings UI
Settings → General → RAG Provider dropdown

# Add new RAG (3 steps):
1. cp src/rag/plugins/_template.py src/rag/plugins/my_rag.py
2. Implement 3 functions (initialize, search, delete)
3. Done! Auto-discovered and available in UI

Technical Details:
- Plugin loader uses importlib for dynamic loading
- Validates required functions at load time
- Caches plugin instances for performance
- Supports multiple concurrent RAG providers
- Thread-safe plugin management

Documentation:
Comprehensive README.md with:
- Quick start guide
- API reference
- Plugin creation tutorial
- Usage examples
- Architecture diagrams

This implementation provides maximum flexibility while maintaining simplicity, enabling easy experimentation with different RAG systems and community contributions.
2026-01-06 17:16:20 +05:30
Pancake
7cb4696e42 Refactor: Consolidate base agent classes and update imports 2026-01-06 19:33:58 +08:00
yugasun
6b18b205e9 feat: support baidu ai search 2026-01-06 19:23:39 +08:00