|
import axios from './config' |
|
|
|
|
|
export const SERVER_URL = (import.meta.env.MODE === 'development') ? '/api' : '/api' |
|
export const ASSET_URL = '/data' |
|
|
|
export default { |
|
getMockData(filename: string): Promise<any> { |
|
return axios.get(`./mocks/${filename}.json`) |
|
}, |
|
|
|
getFileData(filename: string): Promise<any> { |
|
return axios.get(`${ASSET_URL}/${filename}.json`) |
|
}, |
|
|
|
AIPPT_Outline( |
|
content: string, |
|
language: string, |
|
model: string, |
|
): Promise<any> { |
|
return fetch(`${SERVER_URL}/tools/aippt_outline`, { |
|
method: 'POST', |
|
headers: { |
|
'Content-Type': 'application/json', |
|
}, |
|
body: JSON.stringify({ |
|
content, |
|
language, |
|
model, |
|
stream: true, |
|
}), |
|
}) |
|
}, |
|
|
|
AIPPT( |
|
content: string, |
|
language: string, |
|
model: string, |
|
): Promise<any> { |
|
return fetch(`${SERVER_URL}/tools/aippt`, { |
|
method: 'POST', |
|
headers: { |
|
'Content-Type': 'application/json', |
|
}, |
|
body: JSON.stringify({ |
|
content, |
|
language, |
|
model, |
|
stream: true, |
|
}), |
|
}) |
|
}, |
|
|
|
|
|
login(username: string, password: string): Promise<any> { |
|
return axios.post(`${SERVER_URL}/auth/login`, { username, password }) |
|
}, |
|
|
|
verifyToken(): Promise<any> { |
|
return axios.get(`${SERVER_URL}/auth/verify`) |
|
}, |
|
|
|
getUserInfo(): Promise<any> { |
|
return axios.get(`${SERVER_URL}/auth/user`) |
|
}, |
|
|
|
|
|
getPPTList(): Promise<any> { |
|
return axios.get(`${SERVER_URL}/ppt/list`) |
|
}, |
|
|
|
getPPT(pptId: string): Promise<any> { |
|
return axios.get(`${SERVER_URL}/ppt/${pptId}`) |
|
}, |
|
|
|
savePPT(pptData: any): Promise<any> { |
|
return axios.post(`${SERVER_URL}/ppt/save`, pptData) |
|
}, |
|
|
|
createPPT(title: string): Promise<any> { |
|
return axios.post(`${SERVER_URL}/ppt/create`, { title }) |
|
}, |
|
|
|
deletePPT(pptId: string): Promise<any> { |
|
return axios.delete(`${SERVER_URL}/ppt/${pptId}`) |
|
}, |
|
|
|
copyPPT(pptId: string, title: string): Promise<any> { |
|
return axios.post(`${SERVER_URL}/ppt/${pptId}/copy`, { title }) |
|
}, |
|
|
|
|
|
generateShareLink(userId: string, pptId: string, slideIndex?: number): Promise<any> { |
|
return axios.post(`${SERVER_URL}/public/generate-share-link`, { |
|
userId, |
|
pptId, |
|
slideIndex |
|
}) |
|
}, |
|
|
|
getPublicPPT(userId: string, pptId: string): Promise<any> { |
|
return axios.get(`${SERVER_URL}/public/ppt/${userId}/${pptId}`) |
|
}, |
|
|
|
getPublicSlide(userId: string, pptId: string, slideIndex: number): Promise<any> { |
|
return axios.get(`${SERVER_URL}/public/view/${userId}/${pptId}/${slideIndex}`) |
|
} |
|
} |