mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-30 00:53:14 +00:00
Added history in streaming convo + fixed little bug with message margins on loading state
This commit is contained in:
@@ -79,11 +79,7 @@ export default function Conversation() {
|
||||
<Fragment key={index}>
|
||||
<ConversationBubble
|
||||
ref={endMessageRef}
|
||||
className={`${
|
||||
index === queries.length - 1 && status === 'loading'
|
||||
? 'mb-24'
|
||||
: 'mb-7'
|
||||
}`}
|
||||
className={'mb-7'}
|
||||
key={`${index}QUESTION`}
|
||||
message={query.prompt}
|
||||
type="QUESTION"
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ export const fetchAnswer = createAsyncThunk<Answer, { question: string }>(
|
||||
question,
|
||||
state.preference.apiKey,
|
||||
state.preference.selectedDocs!,
|
||||
state.conversation.queries,
|
||||
(event) => {
|
||||
const data = JSON.parse(event.data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user