mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-30 09:03:15 +00:00
adds default doc
This commit is contained in:
@@ -12,13 +12,15 @@ export function fetchAnswerApi(
|
||||
}
|
||||
|
||||
const docPath =
|
||||
selectedDocs.language +
|
||||
'/' +
|
||||
namePath +
|
||||
'/' +
|
||||
selectedDocs.version +
|
||||
'/' +
|
||||
selectedDocs.model;
|
||||
selectedDocs.name === 'default'
|
||||
? 'default'
|
||||
: selectedDocs.language +
|
||||
'/' +
|
||||
namePath +
|
||||
'/' +
|
||||
selectedDocs.version +
|
||||
'/' +
|
||||
selectedDocs.model;
|
||||
|
||||
return fetch('https://docsapi.arc53.com/api/answer', {
|
||||
method: 'POST',
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// not all properties in Doc are going to be present. Make some optional
|
||||
export type Doc = {
|
||||
name: string;
|
||||
language: string;
|
||||
@@ -52,7 +53,9 @@ export function setLocalRecentDocs(doc: Doc): void {
|
||||
}
|
||||
|
||||
const docPath =
|
||||
doc.language + '/' + namePath + '/' + doc.version + '/' + doc.model;
|
||||
doc.name === 'default'
|
||||
? 'default'
|
||||
: doc.language + '/' + namePath + '/' + doc.version + '/' + doc.model;
|
||||
fetch('https://docsapi.arc53.com/api/docs_check', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
||||
@@ -29,7 +29,7 @@ export const prefSlice = createSlice({
|
||||
state.selectedDocs = action.payload;
|
||||
},
|
||||
setSourceDocs: (state, action) => {
|
||||
state.sourceDocs = action.payload;
|
||||
state.sourceDocs?.push(...action.payload);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -13,7 +13,18 @@ const store = configureStore({
|
||||
preference: {
|
||||
apiKey: key ?? '',
|
||||
selectedDocs: doc !== null ? JSON.parse(doc) : null,
|
||||
sourceDocs: null,
|
||||
sourceDocs: [
|
||||
{
|
||||
language: '',
|
||||
name: 'default',
|
||||
version: '',
|
||||
dat: '',
|
||||
description: '',
|
||||
docLink: '',
|
||||
fullName: '',
|
||||
model: '1.0',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
reducer: {
|
||||
|
||||
Reference in New Issue
Block a user