feat: dropdown to adjust conversational history limits

This commit is contained in:
Siddhant Rai
2024-05-26 23:13:01 +05:30
parent 9f1d3b0269
commit 220d137e66
11 changed files with 152 additions and 27 deletions

View File

@@ -1,5 +1,6 @@
import { Answer, FEEDBACK } from './conversationModels';
import { Doc } from '../preferences/preferenceApi';
import { selectTokenLimit } from '../preferences/preferenceSlice';
const apiHost = import.meta.env.VITE_API_HOST || 'https://docsapi.arc53.com';
@@ -38,6 +39,7 @@ export function fetchAnswerApi(
conversationId: string | null,
promptId: string | null,
chunks: string,
token_limit: number,
): Promise<
| {
result: any;
@@ -73,6 +75,7 @@ export function fetchAnswerApi(
conversation_id: conversationId,
prompt_id: promptId,
chunks: chunks,
token_limit: token_limit,
}),
signal,
})
@@ -103,6 +106,7 @@ export function fetchAnswerSteaming(
conversationId: string | null,
promptId: string | null,
chunks: string,
token_limit: number,
onEvent: (event: MessageEvent) => void,
): Promise<Answer> {
const docPath = getDocPath(selectedDocs);
@@ -119,6 +123,7 @@ export function fetchAnswerSteaming(
conversation_id: conversationId,
prompt_id: promptId,
chunks: chunks,
token_limit: token_limit,
};
fetch(apiHost + '/stream', {
method: 'POST',
@@ -181,6 +186,7 @@ export function searchEndpoint(
conversation_id: string | null,
history: Array<any> = [],
chunks: string,
token_limit: number,
) {
const docPath = getDocPath(selectedDocs);
@@ -190,6 +196,7 @@ export function searchEndpoint(
conversation_id,
history,
chunks: chunks,
token_limit: token_limit,
};
return fetch(`${apiHost}/api/search`, {
method: 'POST',