mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
merge from dannya
feat: support unfinished messages.
This commit is contained in:
parent
bbf2f8a6ca
commit
a5a0eab7f7
15 changed files with 308 additions and 221 deletions
|
|
@ -17,7 +17,7 @@ const sendMessage = (res, message) => {
|
|||
res.write(`event: message\ndata: ${JSON.stringify(message)}\n\n`);
|
||||
};
|
||||
|
||||
const createOnProgress = () => {
|
||||
const createOnProgress = ({ onProgress: _onProgress }) => {
|
||||
let i = 0;
|
||||
let code = '';
|
||||
let tokens = '';
|
||||
|
|
@ -65,14 +65,21 @@ const createOnProgress = () => {
|
|||
}
|
||||
|
||||
sendMessage(res, { text: tokens + cursor, message: true, initial: i === 0, ...rest });
|
||||
|
||||
_onProgress && _onProgress({ text: tokens, message: true, initial: i === 0, ...rest });
|
||||
|
||||
i++;
|
||||
};
|
||||
|
||||
const onProgress = opts => {
|
||||
const onProgress = (opts) => {
|
||||
return _.partialRight(progressCallback, opts);
|
||||
};
|
||||
|
||||
return onProgress;
|
||||
const getPartialText = () => {
|
||||
return tokens;
|
||||
};
|
||||
|
||||
return { onProgress, getPartialText };
|
||||
};
|
||||
|
||||
const handleText = async (response, bing = false) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue