[PR #717] [MERGED] Refactor LLM chat backend #3466

Closed
opened 2026-02-22 18:33:50 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/717
Author: @timothycarambat
Created: 2/13/2024
Status: Merged
Merged: 2/14/2024
Merged by: @timothycarambat

Base: masterHead: chat-backend-refactor


📝 Commits (2)

  • 25a7501 refactor stream/chat/embed-stram to be a single execution logic path so that it is easier to maintain and build upon
  • 9d3045c no thread in sync chat since only api uses it

📊 Changes

20 files changed (+287 additions, -468 deletions)

View changed files

📝 server/endpoints/api/workspace/index.js (+5 -5)
📝 server/endpoints/chat.js (+1 -1)
📝 server/endpoints/embed/index.js (+4 -2)
📝 server/endpoints/workspaceThreads.js (+1 -1)
📝 server/endpoints/workspaces.js (+1 -1)
📝 server/utils/AiProviders/azureOpenAi/index.js (+1 -1)
📝 server/utils/AiProviders/gemini/index.js (+1 -1)
📝 server/utils/AiProviders/huggingface/index.js (+1 -1)
📝 server/utils/AiProviders/lmStudio/index.js (+1 -1)
📝 server/utils/AiProviders/localAi/index.js (+1 -1)
📝 server/utils/AiProviders/mistral/index.js (+1 -1)
📝 server/utils/AiProviders/native/index.js (+1 -1)
📝 server/utils/AiProviders/ollama/index.js (+1 -1)
📝 server/utils/AiProviders/openAi/index.js (+1 -1)
📝 server/utils/AiProviders/togetherAi/index.js (+1 -1)
📝 server/utils/chats/embed.js (+32 -91)
📝 server/utils/chats/index.js (+46 -145)
📝 server/utils/chats/stream.js (+42 -211)
📝 server/utils/helpers/chat/index.js (+1 -1)
server/utils/helpers/chat/responses.js (+144 -0)

📄 Description

Pull Request Type

  • feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 🔨 chore
  • 📝 docs

What is in this change?

The Chat backend for chat/stream/embed was getting messy and have multiple execution paths, now they are normalized across all interfaces for easier readability and maintainability.

Additional Information

This PR needs to be heavily QA'd

  • stream chat empty workspace
  • stream chat empty history recall test
  • query chat empty
  • query chat with embedding test
  • query chat ensure no history recall
  • Do all of the above on default and threaded
  • Embed chat
  • Embed query
  • Async chat response test for empty workpsace
  • Aysnc chat response test empty history recall
  • Async query empty
  • Async query embedding
  • API chat
  • API stream

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated
  • I have tested my code functionality
  • Docker build succeeds locally

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Mintplex-Labs/anything-llm/pull/717 **Author:** [@timothycarambat](https://github.com/timothycarambat) **Created:** 2/13/2024 **Status:** ✅ Merged **Merged:** 2/14/2024 **Merged by:** [@timothycarambat](https://github.com/timothycarambat) **Base:** `master` ← **Head:** `chat-backend-refactor` --- ### 📝 Commits (2) - [`25a7501`](https://github.com/Mintplex-Labs/anything-llm/commit/25a750138af07c5f5e52f8ad61b7650054f33c93) refactor stream/chat/embed-stram to be a single execution logic path so that it is easier to maintain and build upon - [`9d3045c`](https://github.com/Mintplex-Labs/anything-llm/commit/9d3045c2cdd47f1909bbee97a740179642ce9664) no thread in sync chat since only api uses it ### 📊 Changes **20 files changed** (+287 additions, -468 deletions) <details> <summary>View changed files</summary> 📝 `server/endpoints/api/workspace/index.js` (+5 -5) 📝 `server/endpoints/chat.js` (+1 -1) 📝 `server/endpoints/embed/index.js` (+4 -2) 📝 `server/endpoints/workspaceThreads.js` (+1 -1) 📝 `server/endpoints/workspaces.js` (+1 -1) 📝 `server/utils/AiProviders/azureOpenAi/index.js` (+1 -1) 📝 `server/utils/AiProviders/gemini/index.js` (+1 -1) 📝 `server/utils/AiProviders/huggingface/index.js` (+1 -1) 📝 `server/utils/AiProviders/lmStudio/index.js` (+1 -1) 📝 `server/utils/AiProviders/localAi/index.js` (+1 -1) 📝 `server/utils/AiProviders/mistral/index.js` (+1 -1) 📝 `server/utils/AiProviders/native/index.js` (+1 -1) 📝 `server/utils/AiProviders/ollama/index.js` (+1 -1) 📝 `server/utils/AiProviders/openAi/index.js` (+1 -1) 📝 `server/utils/AiProviders/togetherAi/index.js` (+1 -1) 📝 `server/utils/chats/embed.js` (+32 -91) 📝 `server/utils/chats/index.js` (+46 -145) 📝 `server/utils/chats/stream.js` (+42 -211) 📝 `server/utils/helpers/chat/index.js` (+1 -1) ➕ `server/utils/helpers/chat/responses.js` (+144 -0) </details> ### 📄 Description ### Pull Request Type <!-- For change type, change [ ] to [x]. --> - [ ] ✨ feat - [ ] 🐛 fix - [x] ♻️ refactor - [ ] 💄 style - [ ] 🔨 chore - [ ] 📝 docs ### What is in this change? The Chat backend for chat/stream/embed was getting messy and have multiple execution paths, now they are normalized across all interfaces for easier readability and maintainability. ### Additional Information This PR needs to be heavily QA'd - [x] stream chat empty workspace - [x] stream chat empty history recall test - [x] query chat empty - [x] query chat with embedding test - [x] query chat ensure no history recall - [x] Do all of the above on default and threaded - [x] Embed chat - [x] Embed query - [x] Async chat response test for empty workpsace - [x] Aysnc chat response test empty history recall - [x] Async query empty - [x] Async query embedding - [x] API chat - [x] API stream ### Developer Validations <!-- All of the applicable items should be checked. --> - [x] I ran `yarn lint` from the root of the repo & committed changes - [x] Relevant documentation has been updated - [x] I have tested my code functionality - [x] Docker build succeeds locally --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-22 18:33:50 -05:00
yindo closed this issue 2026-02-22 18:33:50 -05:00
yindo changed title from [PR #717] Refactor LLM chat backend to [PR #717] [MERGED] Refactor LLM chat backend 2026-06-05 15:13:35 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#3466