mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 10:20:15 +01:00
🔧 fix: Consolidate Text Parsing and TTS Edge Initialization (#6582)
* 🔧 fix: Update useTextToSpeechExternal to include loading state and improve text parsing logic
* fix: update msedge-tts and prevent excessive initialization attempts
* fix: Refactor text parsing logic in mongoMeili model to use parseTextParts function
This commit is contained in:
parent
a6f062e468
commit
b9ebdd4aa5
6 changed files with 57 additions and 29 deletions
|
|
@ -375,9 +375,23 @@ export function parseTextParts(contentParts: a.TMessageContentParts[]): string {
|
|||
let result = '';
|
||||
|
||||
for (const part of contentParts) {
|
||||
if (!part.type) {
|
||||
continue;
|
||||
}
|
||||
if (part.type === ContentTypes.TEXT) {
|
||||
const textValue = typeof part.text === 'string' ? part.text : part.text.value;
|
||||
|
||||
if (
|
||||
result.length > 0 &&
|
||||
textValue.length > 0 &&
|
||||
result[result.length - 1] !== ' ' &&
|
||||
textValue[0] !== ' '
|
||||
) {
|
||||
result += ' ';
|
||||
}
|
||||
result += textValue;
|
||||
} else if (part.type === ContentTypes.THINK) {
|
||||
const textValue = typeof part.think === 'string' ? part.think : '';
|
||||
if (
|
||||
result.length > 0 &&
|
||||
textValue.length > 0 &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue