mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
🧹 chore: Remove Deprecated BingAI Code & Address Mobile Focus (#5565)
* chore: remove all bing code * chore: remove bing code and auto-focus effects * chore: add back escapeRegExp helper function for regex special character handling * chore: remove deprecated fields from settings and conversation schema * fix: ensure default endpoint is set correctly in conversation setup * feat: add disableFocus option to newConversation for improved search behavior
This commit is contained in:
parent
1226f56d0c
commit
19fa4d9f54
52 changed files with 52 additions and 1384 deletions
|
|
@ -10,10 +10,16 @@ const {
|
|||
defaultAssistantsVersion,
|
||||
} = require('librechat-data-provider');
|
||||
const { Providers } = require('@librechat/agents');
|
||||
const { getCitations, citeText } = require('./citations');
|
||||
const partialRight = require('lodash/partialRight');
|
||||
const { sendMessage } = require('./streamResponse');
|
||||
const citationRegex = /\[\^\d+?\^]/g;
|
||||
|
||||
/** Helper function to escape special characters in regex
|
||||
* @param {string} string - The string to escape.
|
||||
* @returns {string} The escaped string.
|
||||
*/
|
||||
function escapeRegExp(string) {
|
||||
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
}
|
||||
|
||||
const addSpaceIfNeeded = (text) => (text.length > 0 && !text.endsWith(' ') ? text + ' ' : text);
|
||||
|
||||
|
|
@ -64,18 +70,9 @@ const createOnProgress = (
|
|||
return { onProgress, getPartialText, sendIntermediateMessage };
|
||||
};
|
||||
|
||||
const handleText = async (response, bing = false) => {
|
||||
const handleText = async (response) => {
|
||||
let { text } = response;
|
||||
response.text = text;
|
||||
|
||||
if (bing) {
|
||||
const links = getCitations(response);
|
||||
if (response.text.match(citationRegex)?.length > 0) {
|
||||
text = citeText(response);
|
||||
}
|
||||
text += links?.length > 0 ? `\n- ${links}` : '';
|
||||
}
|
||||
|
||||
return text;
|
||||
};
|
||||
|
||||
|
|
@ -262,6 +259,7 @@ module.exports = {
|
|||
isEnabled,
|
||||
handleText,
|
||||
formatSteps,
|
||||
escapeRegExp,
|
||||
formatAction,
|
||||
isUserProvided,
|
||||
generateConfig,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue