🐳 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:
Danny Avila 2024-02-29 09:24:55 -05:00 committed by GitHub
parent 388dc1789b
commit 93803323cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 33 additions and 58 deletions

View file

@ -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);
}