mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-27 05:38:51 +01:00
🖼️ fix: correct image extraction (#3538)
* fix: regex issue extracting text with images in markdown * fix: update addImages function to include only the first observed image path in the response message * ci: tests for addImages function: correct image extraction * fix(GoogleClient): linting --------- Co-authored-by: Dongwoo Jeong <dongwoo.jeong@lge.com> Co-authored-by: Dongwoo Jeong <dongwoo@duck.com>
This commit is contained in:
parent
389b2a6cab
commit
5baa95bd9a
3 changed files with 86 additions and 26 deletions
|
|
@ -60,10 +60,10 @@ function addImages(intermediateSteps, responseMessage) {
|
|||
if (!observation || !observation.includes('![')) {
|
||||
return;
|
||||
}
|
||||
const observedImagePath = observation.match(/!\[.*\]\([^)]*\)/g);
|
||||
const observedImagePath = observation.match(/!\[[^(]*\]\([^)]*\)/g);
|
||||
if (observedImagePath && !responseMessage.text.includes(observedImagePath[0])) {
|
||||
responseMessage.text += '\n' + observation;
|
||||
logger.debug('[addImages] added image from intermediateSteps:', observation);
|
||||
responseMessage.text += '\n' + observedImagePath[0];
|
||||
logger.debug('[addImages] added image from intermediateSteps:', observedImagePath[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue