mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-30 00:53:14 +00:00
API conversation
This commit is contained in:
@@ -14,7 +14,24 @@ export const fetchAnswer = createAsyncThunk<
|
||||
{ state: RootState }
|
||||
>('fetchAnswer', async ({ question }, { getState }) => {
|
||||
const state = getState();
|
||||
const answer = await fetchAnswerApi(question, state.preference.apiKey);
|
||||
let namePath = state.preference.selectedDocs?.name;
|
||||
if (state.preference.selectedDocs?.language === namePath) {
|
||||
namePath = '.project';
|
||||
}
|
||||
|
||||
const docPath =
|
||||
state.preference.selectedDocs?.language +
|
||||
'/' +
|
||||
namePath +
|
||||
'/' +
|
||||
state.preference.selectedDocs?.version +
|
||||
'/' +
|
||||
state.preference.selectedDocs?.model;
|
||||
const answer = await fetchAnswerApi(
|
||||
question,
|
||||
state.preference.apiKey,
|
||||
docPath,
|
||||
);
|
||||
return answer;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user