14 Commits

Author SHA1 Message Date
Nikhil Kothari
d602c28f1f fix(notifications): evaluate document notifications with read-only globals
Raven Document Notification conditions, message templates and Jinja
recipients were evaluated with the full server-script frappe object.
Raven Admins can edit these but aren't System Managers, so a Raven
Admin could write any record, for example create a System Manager user,
or make outbound requests.

Use render_safe_globals instead, the read-only set Frappe gives Jinja
templates. On Frappe versions without it (before v15.111 and v16.21),
fall back to frappe.utils only. Simple conditions like
doc.status == "Open" keep working.

Raise the minimum Frappe version to 15.111.0.
2026-10-16 00:25:33 +05:30
Nikhil Kothari
34e6327ff2 chore: delete v2 configs 2026-09-18 23:48:49 +05:30
Nikhil Kothari
779aa78721 chore: replace TCC with Frappe 2026-09-01 14:19:03 +05:30
Aditya Patil
fead1e3fb2 chore: bump openai minimum version to 2.30.0 2026-05-12 15:26:07 +05:30
Ankush Menat
51b006c988
Merge pull request #2042 from The-Commit-Company/ankush-patch-1
chore: add project URLs
2026-02-17 15:56:56 +05:30
Nikhil Kothari
f466b40ed3 chore(setup): add frappe dependency and build utils 2026-02-04 22:25:48 +05:30
Nikhil Kothari
987f61af71 chore: bump openai 2025-08-20 09:48:34 -04:00
Nikhil Kothari
df4a560cb3 feat(ai): add google vision 2025-06-16 18:19:02 -05:00
Jérémy Christillin
c4d129d61a
feat: Implement OpenAI Agents SDK with Local LLM Support (#1717)
* feat: implement OpenAI Agents SDK with local LLM support

## Major Changes

  ### OpenAI Agents SDK Integration
  - Migrate from OpenAI Assistants API to Agents SDK (v0.0.16+)
  - Add support for local LLMs (LM Studio, Ollama, LocalAI)
  - Implement hybrid architecture supporting both legacy Assistants and new Agents
  - Add model provider selection in bot configuration

  ### File Analysis Enhancement
  - Implement Excel/CSV file analysis without Code Interpreter requirement
  - Add MarkItDown library integration for document-to-markdown conversion
  - Fallback to pandas for spreadsheet conversion when MarkItDown unavailable
  - Enable direct LLM analysis of uploaded files

  ### Function Calling Implementation
  - Full support for Raven AI Functions with SDK
  - Auto-load bot-specific functions from Raven Bot Functions
  - Fix JSON serialization for datetime objects
  - Improve function descriptions for better LLM understanding

  ### Code Cleanup
  - Remove debug logging and unnecessary frappe.log_error calls
  - Clean up unused SDK implementation files (handler_agents.py, sdk_agents.py, sdk_handler.py)
  - Remove debug files (debug_agents.py, debug_thread.py)
  - Remove private URL references

  ### Frontend Updates
  - Create unified AI Settings page for OpenAI and Local LLM configuration
  - Add model provider selection in bot form
  - Hide OpenAI-specific features for Local LLM bots
  - Add connection testing for Local LLM endpoints

  ## Technical Details
  - Direct import from `agents` module (not `openai_agents`)
  - Maintain conversation context across messages
  - Support file search with OpenAI vector stores
  - Async/sync pattern for Frappe compatibility

  ## Files Modified
  - Backend: ai.py, agents_integration.py, conversation_file_handler.py, response_formatter.py
  - Frontend: AISettings.tsx, AIFeaturesBotFormEnhanced.tsx, App.tsx
  - DocTypes: Raven Settings, Raven Bot
  - Removed: 5 unused files, 2 debug files

* Remove frappe.log_error

* Update requirements.txt

* remove frappe.log_error and fix bug description tools

* fix vector store IDs

* fix: apply pre-commit hooks and fix code quality issues

- Fixed flake8 errors:
  - Removed unnecessary f-string prefixes (F541)
  - Replaced bare except with specific exceptions (E722)
- Applied black formatting to Python files
- Fixed import ordering with isort
- Modernized Python syntax with pyupgrade
- Removed trailing whitespace from shell scripts

All pre-commit hooks now pass successfully.

* fix: add translation wrapper for user-facing error messages

- Wrapped all frappe.throw() messages with _() for internationalization
- Fixes frappe-semgrep-rules.rules.frappe-missing-translate-function-python violations
- All user-facing text is now translatable as per Frappe standards

* fix: add missing dependencies to pyproject.toml

- Added openai-agents>=0.0.16
- Added markitdown
- Added pandas

These dependencies are required for the AI features and were missing from pyproject.toml,
causing import errors during Frappe app installation.

* feat: add migration patch for AI bots model provider

- Sets model_provider to 'OpenAI' for all existing AI bots
- Enables enable_openai_services if AI integration is already enabled
- Handles cases where fields might not exist (backward compatibility)
- Only updates bots where model_provider is not already set
- Provides detailed migration logs

This ensures smooth upgrade for existing Raven installations using AI features.

* fix: use set_single_value for Raven Settings in migration patch

- Changed frappe.db.set_value to frappe.db.set_single_value for Raven Settings
- Fixes frappe-semgrep-rules.rules.frappe-set-value-semantics violation
- Single DocTypes require set_single_value method

* fix: add nosemgrep comment for manual commit

- Added explanation for why manual commit is required in AI processing
- The commit is necessary because AI response is processed asynchronously
- Background job needs the message to exist in DB before processing
- Fixes frappe-semgrep-rules.rules.frappe-manual-commit violation

* chore: simplify patch

* chore: remove unused file

* fix: only navigate to thread if on the same channel

* fix: remove unneccessary props

* fix: label in command menu

* chore: delete unused code

* chore: merge bot form enhanced

* fix: colors on sliders

* chore: remove unneccesary checks

* chore: remove unused imports

* fix: check for openai assistant ID for routing

* feat: add support for INR

* chore: remove unused imports

* chore: linting

* fix: apply document permissions when fetching docs using agents

---------

Co-authored-by: Nikhil Kothari <nik.kothari22@live.com>
2025-06-16 11:46:22 -05:00
Nikhil Kothari
e7f3094b95
feat: use blurhash for image placeholders (#1655) 2025-05-01 21:54:29 +05:30
Nikhil Kothari
c0b23bf8f9 wip: AI integration 2024-08-28 20:23:49 +05:30
Nikhil Kothari
15b5cc2071 bumped linkpreview version to 0.9.0 2024-04-12 20:28:56 +05:30
Nikhil Kothari
7d3966d23e chore: applied pre-commit 2024-03-16 21:19:03 +05:30
Nikhil Kothari
6e2b7d7eb8 chore: bumped to version 1.2.0 2023-09-07 16:38:29 +05:30