mirror of
https://github.com/arc53/DocsGPT
synced 2024-11-02 03:40:17 +00:00
fixes on comments
This commit is contained in:
parent
4769eb31e9
commit
fdc8a509de
@ -19,30 +19,31 @@ export function fetchAnswerApi(
|
||||
selectedDocs.version +
|
||||
'/' +
|
||||
selectedDocs.model;
|
||||
return new Promise((resolve, reject) => {
|
||||
const activeDocs = 'default';
|
||||
fetch('https://docsgpt.arc53.com/api/answer', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
question: question,
|
||||
api_key: apiKey,
|
||||
embeddings_key: apiKey,
|
||||
history: localStorage.getItem('chatHistory'),
|
||||
active_docs: docPath,
|
||||
}),
|
||||
|
||||
return fetch('https://docsgpt.arc53.com/api/answer', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
question: question,
|
||||
api_key: apiKey,
|
||||
embeddings_key: apiKey,
|
||||
history: localStorage.getItem('chatHistory'),
|
||||
active_docs: docPath,
|
||||
}),
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
} else {
|
||||
Promise.reject(response);
|
||||
}
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
const result = data.answer;
|
||||
resolve({ answer: result, query: question, result });
|
||||
})
|
||||
.catch((error) => {
|
||||
reject();
|
||||
});
|
||||
});
|
||||
.then((data) => {
|
||||
const result = data.answer;
|
||||
return { answer: result, query: question, result };
|
||||
});
|
||||
}
|
||||
|
||||
function getRandomInt(min: number, max: number) {
|
||||
|
@ -18,7 +18,7 @@ export const fetchAnswer = createAsyncThunk<
|
||||
const answer = await fetchAnswerApi(
|
||||
question,
|
||||
state.preference.apiKey,
|
||||
state.preference.selectedDocs,
|
||||
state.preference.selectedDocs!,
|
||||
);
|
||||
return answer;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user