Added history in streaming convo + fixed little bug with message margins on loading state

This commit is contained in:
Alex
2023-05-31 23:47:16 +01:00
parent 6c95d8b13e
commit f8910ba136
5 changed files with 24 additions and 14 deletions

View File

@@ -59,6 +59,7 @@ export function fetchAnswerSteaming(
question: string,
apiKey: string,
selectedDocs: Doc,
history: Array<any> = [],
onEvent: (event: MessageEvent) => void,
): Promise<Answer> {
let namePath = selectedDocs.name;
@@ -86,8 +87,8 @@ export function fetchAnswerSteaming(
url.searchParams.append('question', question);
url.searchParams.append('api_key', apiKey);
url.searchParams.append('embeddings_key', apiKey);
url.searchParams.append('history', localStorage.getItem('chatHistory'));
url.searchParams.append('active_docs', docPath);
url.searchParams.append('history', JSON.stringify(history));
const eventSource = new EventSource(url.href);