* feat(markdown): allow video and audio tags in markdown
- Add custom image renderer to convert video/audio URLs to media tags
- Use DOMPurify to sanitize raw HTML, allowing only video/audio/source
- Add comprehensive tests for media rendering and XSS prevention
* feat(mcp): increase tool timeout from 30s to 60s
* feat(mcp): update tool prompt to mention video/audio support
* test: update markdown test for DOMPurify behavior
fix(mcp): communicate tool errors to LLM to prevent hallucinated success (#2036)
When MCP tool calls fail (e.g., timeout), the error was shown in the UI
but not sent to the LLM. This caused the LLM to hallucinate success
because it never received feedback about the failure.
Now error messages are included in toolMessages so the LLM can
acknowledge failures and respond appropriately.
MCP Tool Progress Notifications and MCP SDK bump. (#2030)
* Add billing organization selection
Introduces support for selecting a billing organization for inference requests in HuggingChat. Adds a new billing section in application settings, updates user settings and API to store and validate the selected organization, and ensures requests are billed to the chosen organization by sending the X-HF-Bill-To header. Also updates environment and chart files to include the new OpenID scope required for billing.
* Update +page.svelte
* Remove billingOrganization from default settings
* Fix user settings creation and update test for findUser
The test for updateUser now passes a URL to findUser to match the updated function signature. Also, the updateUser function now inserts the full DEFAULT_SETTINGS object when creating default user settings, ensuring billingOrganization is included.
Guard MCP reasoning stream from whitespace <think> blocks
Moved message and file preparation logic to a shared utility (prepareFiles.ts) for OpenAI-compatible multimodal payloads. Updated endpointOai and runMcpFlow to use the new prepareMessagesWithFiles function, improving code reuse and maintainability.
Update image ref resolution to use conversation order
File reference resolver now maps image refs (e.g. image_1, image_2) to user-uploaded images in chronological order across the entire conversation, rather than only the latest user message. Updated tool prompt instructions to clarify this behavior for users.
* Add image reference support for MCP tool calls
Introduces image reference resolution and attachment for MCP tool arguments, allowing tools to accept lightweight image reference strings (e.g. 'latest', 'image_1') and receive resolved image payloads. Updates tool invocation and flow logic to use these references, and improves tool prompt instructions for image input handling.
* Enable multiple file uploads in ChatInput
* Refactor multimodal model selection logic
* Remove 'latest' image reference support
Eliminates handling of the 'latest' image reference in image resolver logic and updates related comments and prompts to only support 'image_1', 'image_2', etc. This simplifies image reference usage and clarifies instructions for tool input parameters.
* Refactor imageRefs to fileRefs for tool payloads
* Update ServerCard.svelte
feat(mcp): add Model Context Protocol integration with tool support
Improve MCP tools caching and server selection logic
Replaces single-entry MCP tools cache with a multi-keyed cache based on server configuration, improving cache accuracy for different server sets. Refactors server selection logic in runMcpFlow to better handle custom server lists and selected server names. Removes MCP flow from generate.ts, streamlining text generation logic.
* Add OAuth authentication for MCP servers
Introduces browser-based OAuth flow for MCP servers, including new auth helpers, localStorage management, and UI actions for authentication and sign-out. Server cards now support authentication, and enabled servers include persisted auth headers for API requests. Adds callback handler and route for OAuth completion.
* Add server authentication status and UI indicators
Introduces an 'authRequired' property to MCPServer and health check responses to indicate when authenti…
Add provider info to router metadata in chat messages
Extends router metadata to include a 'provider' field throughout the backend and frontend, allowing display of provider information alongside route and model in chat messages. Updates types, message update handling, and UI rendering to support and show provider details when available.
Refines the chat thread title generation by limiting titles to 2–4 words, reducing max tokens to 24, and setting temperature to 0 for more deterministic output. Also adds a link to the HuggingChat GitHub repository in the application settings page when HuggingChat is enabled.
* Add AbortRegistry for user-initiated generation cancellation
Introduces an AbortRegistry singleton to track and manage AbortControllers for active conversation generations, enabling user-initiated cancellation of ongoing requests. Updates text generation and endpoint logic to support abort signals, and ensures proper cleanup and partial response handling when a generation is aborted. The stop-generating endpoint now triggers aborts via the registry.
* Remove 'continue message' feature from chat flow
Eliminated the 'continue message' functionality and related code, including the ContinueBtn component, associated props, and logic in both frontend and backend. This simplifies the message handling flow and removes unused parameters and UI elements.
Updated the preprompt for title generation to provide clearer, stricter instructions and examples for generating concise, descriptive titles. Improved fallback handling by ensuring summary is always a string and clarified that no post-processing is performed.
Store oauth token in DB + use it when doing API calls (#1885)
Eliott C.
Unverified signature
c4f6eb3
* store oauth token in DB
* store user token/oauth token in session
* use token when making API call if USE_USER_TOKEN is true in env
* lint
fix CI (#1884)
Eliott C.
Unverified signature
2883086
* fix CI
* add playwright as dev dep
* lint
* clean up spaces-config with community tools
* try to make mongo run?
Refactor token parameters to standardize naming across models and generation settings
* refactor: remove tokenizer-related functionality and dependencies
- Removed tokenizer dependencies from package.json.
- Deleted TokensCounter component and its usages across the application.
- Updated model configurations to exclude tokenizer properties.
- Refactored model processing logic to support only OpenAI-compatible endpoints.
- Adjusted API responses to omit tokenizer information.
- Cleaned up related utility functions and imports.
* Remove web search functionality and related components
- Deleted endpoints for various web search APIs (serpApi, serpStack, serper, webLocal, youApi).
- Removed generateQuery function and its usage in search.
- Eliminated web search related types and interfaces from the codebase.
- Updated Assistant and Conversation types to remove references to web search and embedding models.
- Cleaned up related utility functions and message updates for web search.
- Adjusted API routes and components to reflect the removal of web search features.
- Updated…
feat(reasoning): support end token search across multiple chunks (#1838)
* work on hf inference endpoint
* working tools
* fix: debug tool
* feat: working tools with new endpoint type
* feat: move config to HfInference
* wip
* fix: hf inference endpoint
* refactor: rename endpoint
* fix: rendering
* feat: working tools on every supported model
* fix: multimodal
* refactor: rename endpoint type
* refactor: base URL
* fix: prevent simultaneous provider and baseURL usage
* fix: disable tools on qwen 2.5 vl
* feat: make sure json is correctly formatted
* feat(config): wip, make config controllable from DB, public side for now
* fix: build
* feat(config): add config manager env var toggle
* wip: make backend config use config manager
* fix: typechecks
* fix: circular import
* refactor: init hook sveltekit
* fix: disable config manager during tests
* refactor: use enum for semaphore, move delete from auto after 60s to separate `deleteAt` field
* feat: config manager checks for updates on requests
* fix: config script exit
* fix: remove top-level awaits
* fix: script await
* feat: filter config keys based on public environment variables for more security
* fix: change import to type for public environment variables
Enable/Disable reasoning summary using .env (#1760)
* feat: add a local endpoint type running llama.cpp from chat-ui
* fix: build image
* fix: lock file
* wip: try to make it more reliable
* feat: load chat template from .gguf file
* feat: load gguf models from `models/` folder
* fix: default config
* feat: make endpoint use chatSession instead of completion
* refactor: improve exit handling, exit immediately on second sinal
* fix: various fixes to improve reliability when calling multiple models at once
* docs: add instructions for adding .gguf files to the models directory
* feat(tasks): use tools for web search query if available
* feat(websearch): improve query generation with error handling and logging
* feat(tools): implement generic tool output extraction utility
This commit adds a new `getToolOutput` utility to standardize tool interaction across different tasks like title generation, reasoning summary, and web search query generation. The utility supports extracting tool outputs using a consistent approach, with fallback mechanisms and error handling.
fix: move FinalAnswer outside of reasoning processing blocks (#1717)
brians1196+1: bstieber
Unverified signature
21e1e7d
Co-authored-by: BRIAN M. STIEBER <bstieber@toyon.com>
fix: handle no beginToken for token based reasoning models (#1713)
* feat: add `deepseek-ai/DeepSeek-R1-Distill-Qwen-32B` to HuggingChat config
* feat: hide reasoning modal when its empty
* fix: put r1 model higher in list
Added currentDate variable to Dynamic Prompt (#1648)
evalstate+1: nsarrazin
Unverified signature
b1b3d86
* Added ability to include the current date in the assistant dynamic prompt
* feat: rename tag to {{today}}
---------
Co-authored-by: Nathan Sarrazin <sarrazin.nathan@gmail.com>
Anthropic Tool Support (#1594)
evalstate+1: nsarrazin
Unverified signature
1ac3a3c
* support anthropic PDF beta
* upstream merge, remove commented out console log line
* Fixing type errors.
the anthropic API does not yet include a "DocumentBlock" for
support PDFs, so an extended type has been added to the endpoint.
* changed document processor to async (matching image processor)
* use the beta api types rather than custom extension
* rudimentary tool testing
* interim commit (tool re-passing, file handling)
* remove merge error
* tidy up, isolate beta classes to utils
* anthropic tool calling support.
* improve handling of directlyAnswer tool
* fix streaming
* slight tidy up to tools flow handling
* fix: dont pass tools in final generation, instead deduce tools from tool results
---------
Co-authored-by: Nathan Sarrazin <sarrazin.nathan@gmail.com>
add option to send user message as part of request body in assistant … (#1322)
ethayu+2: Ethan Yu, nsarrazin
Unverified signature
2fb4284
* add option to send user message as part of request body in assistant invokations
* test
* finish
* fix linting problem
* fix: add support for legacy url param
* fix: remove code to send POST requests on the frontend
---------
Co-authored-by: Ethan Yu <etyu@tesla.com>
Co-authored-by: Nathan Sarrazin <sarrazin.nathan@gmail.com>