mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-23 03:40:14 +01:00
adds bing ai functionality, still need to code out message/convo storing since it returns a lot of useful parameters
This commit is contained in:
parent
e0a26f52cd
commit
5c7000c273
11 changed files with 462 additions and 21 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { SSE } from '../../app/sse';
|
||||
const endpoint = 'http://localhost:3050/ask';
|
||||
|
||||
export default function handleSubmit({
|
||||
model,
|
||||
|
|
@ -17,7 +18,8 @@ export default function handleSubmit({
|
|||
};
|
||||
}
|
||||
|
||||
const events = new SSE('http://localhost:3050/ask', {
|
||||
const server = model === 'bingai' ? endpoint + '/bing' : endpoint;
|
||||
const events = new SSE(server, {
|
||||
payload: JSON.stringify(payload),
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
});
|
||||
|
|
@ -28,8 +30,9 @@ export default function handleSubmit({
|
|||
|
||||
events.onmessage = function (e) {
|
||||
const data = JSON.parse(e.data);
|
||||
const text = data.text || data.response;
|
||||
if (!!data.message) {
|
||||
messageHandler(data.text.replace(/^\n/, ''));
|
||||
messageHandler(text.replace(/^\n/, ''));
|
||||
} else if (!!data.final) {
|
||||
console.log(data);
|
||||
convoHandler(data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue