mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
🐳 experimental: Dev Image Workflow & Remove Unused Code (#1928)
* chore: remove unused code in progressCallback, as well as handle reply.trim(), post `getCompletion` * chore(Dockerfile): remove curl installation * experimental: dev image parallelized with matrix strategy and building for amd64/arm64 support * make platforms explicit
This commit is contained in:
parent
388dc1789b
commit
93803323cf
4 changed files with 33 additions and 58 deletions
|
|
@ -7,36 +7,13 @@ const addSpaceIfNeeded = (text) => (text.length > 0 && !text.endsWith(' ') ? tex
|
|||
|
||||
const createOnProgress = ({ generation = '', onProgress: _onProgress }) => {
|
||||
let i = 0;
|
||||
let code = '';
|
||||
let precode = '';
|
||||
let codeBlock = false;
|
||||
let tokens = addSpaceIfNeeded(generation);
|
||||
|
||||
const progressCallback = async (partial, { res, text, bing = false, ...rest }) => {
|
||||
let chunk = partial === text ? '' : partial;
|
||||
tokens += chunk;
|
||||
precode += chunk;
|
||||
tokens = tokens.replaceAll('[DONE]', '');
|
||||
|
||||
if (codeBlock) {
|
||||
code += chunk;
|
||||
}
|
||||
|
||||
if (precode.includes('```') && codeBlock) {
|
||||
codeBlock = false;
|
||||
precode = precode.replace(/```/g, '');
|
||||
code = '';
|
||||
}
|
||||
|
||||
if (precode.includes('```') && code === '') {
|
||||
precode = precode.replace(/```/g, '');
|
||||
codeBlock = true;
|
||||
}
|
||||
|
||||
if (tokens.match(/^\n(?!:::plugins:::)/)) {
|
||||
tokens = tokens.replace(/^\n/, '');
|
||||
}
|
||||
|
||||
if (bing) {
|
||||
tokens = citeText(tokens, true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue